ObjectAgent Class Reference

Agent. More...

#include <ObjectAgent.h>

Inheritance diagram for ObjectAgent:

Object List of all members.

Public Member Functions

 ObjectAgent (const ObjectAgent::Config &config)
 Constructor - initialize whole object.
virtual ~ObjectAgent ()
 Destructor.
virtual void Collision (Object *collisionObject)
 Handles collision caused by another object.
virtual Object::ConfigCreateObjectConfig () const
 Returns full object's config (allocated on the heap).
virtual void LoadFromConfig (const Object::Config &config, bool fullLoad=true)
 Loads object state (attributes etc.) from the selected config.
virtual void SetAction (const Action &newAction)
 Sets a new action.
virtual void SetDirection (const Direction &newDirection)
 Sets a new direction.
virtual const PriorityGetPriority () const
 Returns object's priority.
virtual bool CanAppearMoreThenOnce () const
 Returns true if selected object can appear more then once in the container (in Matrix).
virtual const string & GetClassName () const
 Returns object's name (class name, respectively).
virtual void ChooseNextAction ()
 Object will choose it's new action.
virtual bool IsImaginary () const
 Some kinds of objects are only imaginary and other objects can stand or lay on it. Agents aren't imaginery.
virtual bool IsEditableByUser () const
 Returns true if the object is editable by user (e.g. via graphical window).
virtual bool IsMoveableByUser () const
 Returns true if the object is moveable by user (e.g. moved to another place).
bool HasObject () const
 Returns true if the agent is carrying object.
void TakeObject (ObjectTransferable *object)
 Takes object from the ground.
ObjectTransferableDropObject ()
 Drops object.
string GetBehavior () const
 Queries agent for it's behavior.
void ChangeBehavior (const string &newBehavior)
 Changes agent's behavior.
const string & GetTrailImageFileName () const
 Returns image file name of the trail.
ObjectTrail::DurationSize GetTrailDuration () const
 Returns trail duration.
bool IsPuttingTrail () const
 Returns true if the agent's is putting trails.

Static Public Attributes

static const string CLASS_NAME = "ObjectAgent"
 Name of the class.

Private Member Functions

void Interpret ()
 Calls interpret when agent should decide next action after no collision happened to him in the last turn.
void Interpret (string type)
 Calls interpret when agent is in collision.
bool SimkinHasObject () const
 Returns true if the agent is carrying object.
bool SimkinTakeObject ()
 Takes object from the ground.
bool SimkinDropObject ()
 Drops object.
void SimkinTurnLeft ()
 Turns left (change direction).
void SimkinTurnRight ()
 Turns right (change direction).
void SimkinTurnBack ()
 Turns back (change direction - turning round).
void SimkinGo ()
 Goes forward (one step).
void RandomAction ()
 Performs random action.

Private Attributes

ObjectTransferablecarryingObject
 This points to the carrying object (if any).
GUI::Image trailImage
 Picture of agent's trail.
ObjectTrail::DurationSize trailDuration
 Duration of agent's trail.
bool nextActionSet
 Holds information whether the object has already set its next action.
Behavior behavior
 Object carrying info about behaviour script (Simkin).

Static Private Attributes

static const Object::Priority PRIORITY = 10
 Priority of the object.
static const bool CAN_APPEAR_MORE_THEN_ONCE = false
 If true, object can appear more then once in the container (in Matrix).
static const int AGENT_MOVEMENT_ACTIONS = Object::Action::TURN_BACK - Object::Action::FIRST_ACTION
 Maximum (movement) actions that object can perform.

Friends

class Interpreter

Classes

class  Behavior
 Agent's behavior information. More...
class  Config
 Config object for agents in the matrix. More...

Detailed Description

Agent.


Constructor & Destructor Documentation

ObjectAgent::ObjectAgent ( const ObjectAgent::Config config  ) 

Constructor - initialize whole object.

Parameters:
config Config with the important info

virtual ObjectAgent::~ObjectAgent (  )  [inline, virtual]

Destructor.


Member Function Documentation

virtual bool ObjectAgent::CanAppearMoreThenOnce (  )  const [inline, virtual]

Returns true if selected object can appear more then once in the container (in Matrix).

Implements Object.

void ObjectAgent::ChangeBehavior ( const string &  newBehavior  )  [inline]

Changes agent's behavior.

virtual void ObjectAgent::ChooseNextAction (  )  [inline, virtual]

Object will choose it's new action.

Implements Object.

void ObjectAgent::Collision ( Object collisionObject  )  [virtual]

Handles collision caused by another object.

Parameters:
collisionObject Conflicting object

Implements Object.

Object::Config * ObjectAgent::CreateObjectConfig (  )  const [virtual]

Returns full object's config (allocated on the heap).

Warning: Config is allocated on the heap in this member function, so explicit deleting after usage is needed!

Implements Object.

ObjectTransferable* ObjectAgent::DropObject (  )  [inline]

Drops object.

Returns:
The object agent was carrying

string ObjectAgent::GetBehavior (  )  const [inline]

Queries agent for it's behavior.

Returns:
Agent's behavior script

virtual const string& ObjectAgent::GetClassName (  )  const [inline, virtual]

Returns object's name (class name, respectively).

Implements Object.

virtual const Priority& ObjectAgent::GetPriority (  )  const [inline, virtual]

Returns object's priority.

Implements Object.

ObjectTrail::DurationSize ObjectAgent::GetTrailDuration (  )  const [inline]

Returns trail duration.

const string& ObjectAgent::GetTrailImageFileName (  )  const [inline]

Returns image file name of the trail.

bool ObjectAgent::HasObject (  )  const [inline]

Returns true if the agent is carrying object.

void ObjectAgent::Interpret ( string  type  )  [private]

Calls interpret when agent is in collision.

Parameters:
type Type of the collision

void ObjectAgent::Interpret (  )  [private]

Calls interpret when agent should decide next action after no collision happened to him in the last turn.

virtual bool ObjectAgent::IsEditableByUser (  )  const [inline, virtual]

Returns true if the object is editable by user (e.g. via graphical window).

Implements Object.

virtual bool ObjectAgent::IsImaginary (  )  const [inline, virtual]

Some kinds of objects are only imaginary and other objects can stand or lay on it. Agents aren't imaginery.

Implements Object.

virtual bool ObjectAgent::IsMoveableByUser (  )  const [inline, virtual]

Returns true if the object is moveable by user (e.g. moved to another place).

Implements Object.

bool ObjectAgent::IsPuttingTrail (  )  const [inline]

Returns true if the agent's is putting trails.

void ObjectAgent::LoadFromConfig ( const Object::Config config,
bool  fullLoad = true 
) [virtual]

Loads object state (attributes etc.) from the selected config.

Parameters:
config Object's config
fullLoad Should object load all data from the config, or only some?
If fullLoad is true, object will load all data from the config. If it's false, only some data will be loaded (in this case agent's carrying object won't be loaded).

Reimplemented from Object.

void ObjectAgent::RandomAction (  )  [private]

Performs random action.

virtual void ObjectAgent::SetAction ( const Action &  newAction  )  [inline, virtual]

Sets a new action.

Parameters:
newAction New action that has to be set
Handles the type of the action, so fixed objects cannot move etc.

virtual void ObjectAgent::SetDirection ( const Direction newDirection  )  [inline, virtual]

Sets a new direction.

Parameters:
newDirection New direction that has to be set

Implements Object.

bool ObjectAgent::SimkinDropObject (  )  [inline, private]

Drops object.

Returns:
True if this operation was sucessfull (e.g. it had an object before)

void ObjectAgent::SimkinGo (  )  [inline, private]

Goes forward (one step).

bool ObjectAgent::SimkinHasObject (  )  const [inline, private]

Returns true if the agent is carrying object.

bool ObjectAgent::SimkinTakeObject (  )  [inline, private]

Takes object from the ground.

Returns:
True if this operation was sucessfull (e.g. it didn't have an object before)

void ObjectAgent::SimkinTurnBack (  )  [inline, private]

Turns back (change direction - turning round).

void ObjectAgent::SimkinTurnLeft (  )  [inline, private]

Turns left (change direction).

void ObjectAgent::SimkinTurnRight (  )  [inline, private]

Turns right (change direction).

void ObjectAgent::TakeObject ( ObjectTransferable object  )  [inline]

Takes object from the ground.

Parameters:
object Object to take


Friends And Related Function Documentation

friend class Interpreter [friend]


Member Data Documentation

const int ObjectAgent::AGENT_MOVEMENT_ACTIONS = Object::Action::TURN_BACK - Object::Action::FIRST_ACTION [static, private]

Maximum (movement) actions that object can perform.

Behavior ObjectAgent::behavior [private]

Object carrying info about behaviour script (Simkin).

const bool ObjectAgent::CAN_APPEAR_MORE_THEN_ONCE = false [static, private]

If true, object can appear more then once in the container (in Matrix).

ObjectTransferable* ObjectAgent::carryingObject [private]

This points to the carrying object (if any).

const string ObjectAgent::CLASS_NAME = "ObjectAgent" [static]

Name of the class.

bool ObjectAgent::nextActionSet [private]

Holds information whether the object has already set its next action.

const Object::Priority ObjectAgent::PRIORITY = 10 [static, private]

Priority of the object.

ObjectTrail::DurationSize ObjectAgent::trailDuration [private]

Duration of agent's trail.

GUI::Image ObjectAgent::trailImage [private]

Picture of agent's trail.


The documentation for this class was generated from the following files:
Generated on Sun Apr 29 11:46:11 2007 for IPP/ICP2007 by  doxygen 1.4.7