Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

VIAgents.Plan Class Reference

The parent class for all the plans used by the agents. It starts a new thread executing the plan body as soon as the specified event fires. The class also supports pausing, resuming and cancelling the plan. More...

List of all members.

Public Member Functions

 Plan (int inPriority, Agent inAgent)
 The constructor of the plan where we initialize a new thread. The PlanBody() method will be started as the thread body.
 Plan (Agent inAgent)
 The constructor of the plan where we initialize a new thread. The PlanBody() method will be started as the thread body. The priority is set to "normal" if this constructor is used.
void Sleep (int inMSec)
 Sleep for a given number of miliseconds.
bool IsRunning ()
virtual void HandleUserInput (String inCommand)
void HandleEvent (Event inEvent)
 Add an event for this plan to handle.
void Run ()
 The starting of the initialized thread happens here. This method should also be called to resume the paused thread.
void Pause ()
 If you need to suspend the plan temporarily call this method. To resume it call Run().
void Resume ()
 Calls the Run() method to resume a paused plan.
void Cancel ()
 Call this method if the plan has to be terminated without a need to resume it.
void Dispose ()
 Same as Cancel.

Public Attributes

const int kLowPriority = 0
const int kNormalPriority = 1
const int kHighPriority = 2

Protected Member Functions

abstract void PlanBody ()
 EasyThread provides a facade to inheriting from a Thread class. Override the PlanBody() method to perform your tasks.

Protected Attributes

Agent m_agent = null

Detailed Description

The parent class for all the plans used by the agents. It starts a new thread executing the plan body as soon as the specified event fires. The class also supports pausing, resuming and cancelling the plan.


Constructor & Destructor Documentation

VIAgents.Plan.Plan ( int  inPriority,
Agent  inAgent 
)

The constructor of the plan where we initialize a new thread. The PlanBody() method will be started as the thread body.

Parameters:
inPriority The priority value of the plan (one of the constants above)
VIAgents.Plan.Plan ( Agent  inAgent  ) 

The constructor of the plan where we initialize a new thread. The PlanBody() method will be started as the thread body. The priority is set to "normal" if this constructor is used.


Member Function Documentation

void VIAgents.Plan.Cancel (  ) 

Call this method if the plan has to be terminated without a need to resume it.

void VIAgents.Plan.Dispose (  ) 

Same as Cancel.

void VIAgents.Plan.HandleEvent ( Event  inEvent  ) 

Add an event for this plan to handle.

Parameters:
inEvent A Event
virtual void VIAgents.Plan.HandleUserInput ( String  inCommand  )  [virtual]
bool VIAgents.Plan.IsRunning (  ) 
void VIAgents.Plan.Pause (  ) 

If you need to suspend the plan temporarily call this method. To resume it call Run().

abstract void VIAgents.Plan.PlanBody (  )  [protected, pure virtual]

EasyThread provides a facade to inheriting from a Thread class. Override the PlanBody() method to perform your tasks.

void VIAgents.Plan.Resume (  ) 

Calls the Run() method to resume a paused plan.

void VIAgents.Plan.Run (  ) 

The starting of the initialized thread happens here. This method should also be called to resume the paused thread.

void VIAgents.Plan.Sleep ( int  inMSec  ) 

Sleep for a given number of miliseconds.


Member Data Documentation

Agent VIAgents.Plan.m_agent = null [protected]

The documentation for this class was generated from the following file: