Object Class Reference

Base object in the matrix. More...

#include <Object.h>

Inheritance diagram for Object:

ObjectAgent ObjectFixed ObjectTrail ObjectTransferable List of all members.

Public Types

typedef int Priority
 Priority type.
typedef size_t TicketSize
 Data type of the ticket size.

Public Member Functions

 Object (const Config &config)
 Constructor - config initializes whole object.
virtual ~Object ()
 Destructor.
virtual void Collision (Object *collisionObject)=0
 Handles collision caused by another object.
virtual ConfigCreateObjectConfig () const =0
 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)=0
 Sets a new action.
const ActionGetAction () const
 Returns object's action.
virtual void SetDirection (const Direction &newDirection)=0
 Sets a new direction.
void ChangeDirectionAccToAction ()
 Sets new direction according to the current action.
const DirectionGetDirection () const
 Returns object's direction.
void DrawImage (wxCoord x, wxCoord y, wxDC &dc)
 Draws image on the matrix.
void ScaleImage (int size)
 Scales image.
virtual const PriorityGetPriority () const =0
 Returns object's priority.
virtual bool CanAppearMoreThenOnce () const =0
 Returns true if selected object can appear more then once in the container (in Matrix).
virtual const string & GetClassName () const =0
 Returns object's name (class name, respectively).
virtual void ChooseNextAction ()=0
 Object will choose it's new action.
virtual bool IsImaginary () const =0
 Some kinds of objects are only imaginary and other objects can stand or lay on it. This method returns if the object is imaginary or not.
virtual bool IsEditableByUser () const =0
 Returns true if the object is editable by user (e.g. via graphical window).
virtual bool IsMoveableByUser () const =0
 Returns true if the object is moveable by user (e.g. moved to another place).
void SetTicketNumber (TicketSize number)
 Sets ticket number.
TicketSize GetTicketNumber () const
 Returns current ticket number.
void SetObjectName (const string &newName)
 Sets object name.
const string & GetObjectName () const
 Gets object name.
void SetObjectDescription (const string &newDescription)
 Sets object description.
const string & GetObjectDescription () const
 Gets object description.

Protected Member Functions

const string & GetImageFileName () const
 Returns file name of the image (with path).
void ChangeImage (const string &newImageFileName)
 Changes object image according to the new image filename.

Protected Attributes

Direction direction
 Direction.
Action action
 Action.

Private Attributes

GUI::Image image
 Image.
TicketSize ticketNumber
 Ticket from the matrix.
string name
 Name of the object.
string description
 Description of the object.

Classes

class  Action
 Possible object actions. More...
class  Config
 Base config object for the objects in the matrix. More...

Detailed Description

Base object in the matrix.

Every object in the matrix must be derived from this class.


Member Typedef Documentation

typedef int Object::Priority

Priority type.

Priority is used to sort objects in the item of the Matrix. Object with higher priority is placed over objects with lower priority.

typedef size_t Object::TicketSize

Data type of the ticket size.


Constructor & Destructor Documentation

Object::Object ( const Config config  )  [inline]

Constructor - config initializes whole object.

Parameters:
config In this object is stored every information needed to construct whole object

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

Destructor.


Member Function Documentation

virtual bool Object::CanAppearMoreThenOnce (  )  const [pure virtual]

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

Implemented in ObjectAgent, ObjectFixed, ObjectTrail, and ObjectTransferable.

void Object::ChangeDirectionAccToAction (  ) 

Sets new direction according to the current action.

Only actions that change direction.

void Object::ChangeImage ( const string &  newImageFileName  )  [inline, protected]

Changes object image according to the new image filename.

Parameters:
newImageFileName File name of the file containing new image

virtual void Object::ChooseNextAction (  )  [pure virtual]

Object will choose it's new action.

Each object should decide its next action.

Implemented in ObjectAgent, ObjectFixed, ObjectTrail, and ObjectTransferable.

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

Handles collision caused by another object.

Parameters:
collisionObject Conflicting object

Implemented in ObjectAgent, ObjectFixed, ObjectTrail, and ObjectTransferable.

virtual Config* Object::CreateObjectConfig (  )  const [pure 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!

Implemented in ObjectAgent, ObjectFixed, ObjectTrail, and ObjectTransferable.

void Object::DrawImage ( wxCoord  x,
wxCoord  y,
wxDC &  dc 
) [inline]

Draws image on the matrix.

Parameters:
x X-line
y Y-line
dc Device context onto which graphics can be drawn.
Draws object image.

const Action& Object::GetAction (  )  const [inline]

Returns object's action.

virtual const string& Object::GetClassName (  )  const [pure virtual]

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

Implemented in ObjectAgent, ObjectFixed, ObjectTrail, and ObjectTransferable.

const Direction& Object::GetDirection (  )  const [inline]

Returns object's direction.

const string& Object::GetImageFileName (  )  const [inline, protected]

Returns file name of the image (with path).

Needed in configs.

const string& Object::GetObjectDescription (  )  const [inline]

Gets object description.

const string& Object::GetObjectName (  )  const [inline]

Gets object name.

virtual const Priority& Object::GetPriority (  )  const [pure virtual]

Returns object's priority.

Implemented in ObjectAgent, ObjectFixed, ObjectTrail, and ObjectTransferable.

TicketSize Object::GetTicketNumber (  )  const [inline]

Returns current ticket number.

virtual bool Object::IsEditableByUser (  )  const [pure virtual]

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

Implemented in ObjectAgent, ObjectFixed, ObjectTrail, and ObjectTransferable.

virtual bool Object::IsImaginary (  )  const [pure virtual]

Some kinds of objects are only imaginary and other objects can stand or lay on it. This method returns if the object is imaginary or not.

Implemented in ObjectAgent, ObjectFixed, ObjectTrail, and ObjectTransferable.

virtual bool Object::IsMoveableByUser (  )  const [pure virtual]

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

Implemented in ObjectAgent, ObjectFixed, ObjectTrail, and ObjectTransferable.

void Object::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 (depends on the object type, see description in drived classes for more info).

Reimplemented in ObjectAgent, ObjectFixed, ObjectTrail, and ObjectTransferable.

void Object::ScaleImage ( int  size  )  [inline]

Scales image.

Parameters:
size Size of the picture in pixels
Scales image of the object.

virtual void Object::SetAction ( const Action newAction  )  [pure 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 Object::SetDirection ( const Direction newDirection  )  [pure virtual]

Sets a new direction.

Parameters:
newDirection New direction that has to be set

Implemented in ObjectAgent, ObjectFixed, ObjectTrail, and ObjectTransferable.

void Object::SetObjectDescription ( const string &  newDescription  )  [inline]

Sets object description.

Parameters:
newDescription New description to be set

void Object::SetObjectName ( const string &  newName  )  [inline]

Sets object name.

Parameters:
newName Name to be set

void Object::SetTicketNumber ( TicketSize  number  )  [inline]

Sets ticket number.

Parameters:
number Ticket number to be set


Member Data Documentation

Action Object::action [protected]

Action.

string Object::description [private]

Description of the object.

Direction Object::direction [protected]

Direction.

GUI::Image Object::image [private]

Image.

string Object::name [private]

Name of the object.

TicketSize Object::ticketNumber [private]

Ticket from the matrix.


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