GCS::GObject Class Reference

Holds all data of an element including energy and form. More...

#include <GObject.h>

Inheritance diagram for GCS::GObject:

Inheritance graph
[legend]
Collaboration diagram for GCS::GObject:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GObject (GEnergy *energy, GForm *form, const GElementID &parent, const GElementID &ID, const GElementID &connection, GElementData *ElementData, const GWorldData *WorldData)
virtual ~GObject ()
bool hasEnergy () const
GEnergygetEnergy ()
const GEnergygetEnergy () const
bool hasForm () const
GFormgetForm ()
const GFormgetForm () const
const GElementIDgetParent () const
const GElementIDgetID () const
const GElementIDgetConnection () const
bool hasElementData () const
const GElementData * getElementData () const
GElementData * getElementData ()
bool hasWorldData () const
const GWorldDatagetWorldData () const
void reparent (const GElementID &new_parent)
bool isChild (const GElementID &) const
QList< GElementIDgetChildren () const

Private Attributes

GEnergyEnergy
GFormForm
GElementID Parent
const GElementID ID
const GElementID Connection
GElementData * ElementData
const GWorldDataWorldData

Detailed Description

Holds all data of an element including energy and form.

Author:
Raphael Langerhorst
The GObject is very fundamental. Together with GAgent it forms GElement. The whole world is ONLY built up with elements. The object's role is to represent matter (GForm), the matter's attribute is solely energy (GEnergy).

See the detailed description of GObject::Connection for another central idea of the G system.

Parent-child-relation (an advice for agent design):

Since the world is built in a hierarchical structure every object can contain sub-elements so there should be only one element that is its own parent - the universe itself.

The energy difference between children and their parents also affect the energy distribution of the parent among its children. This means that if a child's energy is like the parent's energy the child is receiving (= is able to receive) more energy from the parent than children which have completely different kinds of energy because they are not responsive to the kind of energy given.

In other words: the parent distributes its own energy flow among its children according to the children's energy levels; the more the child's energy is like the parent's, the more energy the child can receive.

Todo:
Much of this can be handled by GEnergy::put(), it should be implemented there.

Move all inline methods into implementation files.

Also there is always some amount of energy that is cast into the object's sorroundings, which means: the energy is handed back to the object's parent. This probably should be implemented by agents that "radiate" influences.

Note:
Considering the use of QObject's object tree for GObject: This is not a good idea since it is by no means guranteed that all elements are on _one_ machine running on _one_ world engine.


Constructor & Destructor Documentation

GCS::GObject::GObject ( GEnergy energy,
GForm form,
const GElementID parent,
const GElementID ID,
const GElementID connection,
GElementData *  ElementData,
const GWorldData WorldData 
)

Constructor

GCS::GObject::~GObject (  )  [virtual]

A virtual destructor allows cleaner subclassing.


Member Function Documentation

QList< GElementID > GCS::GObject::getChildren (  )  const

Returns:
list of children IDs.

const GElementID & GCS::GObject::getConnection (  )  const

Returns:
const reference of the ID of the connection element.

GElementData * GCS::GObject::getElementData (  ) 

Returns:
pointer to the additional element data.

const GElementData * GCS::GObject::getElementData (  )  const

Returns:
const pointer to the additional element data.

const GEnergy * GCS::GObject::getEnergy (  )  const

Returns:
const pointer to the energy.

GEnergy * GCS::GObject::getEnergy (  ) 

Returns:
pointer to the energy.

const GForm * GCS::GObject::getForm (  )  const

Returns:
const pointer to the form (const reference).

GForm * GCS::GObject::getForm (  ) 

Returns:
pointer to the form.

const GElementID & GCS::GObject::getID (  )  const

Returns:
const reference of the own element ID.

const GElementID & GCS::GObject::getParent (  )  const

Returns:
const reference of the parent ID.

const GWorldData * GCS::GObject::getWorldData (  )  const

Returns:
const pointer to the world data.

bool GCS::GObject::hasElementData (  )  const

Returns:
true if this element has additional data.

bool GCS::GObject::hasEnergy (  )  const

Returns:
true when energy is available.

bool GCS::GObject::hasForm (  )  const

Returns:
true if a form is available.

bool GCS::GObject::hasWorldData (  )  const

Returns:
true if this world data is available.

bool GCS::GObject::isChild ( const GElementID  )  const

Checks if given element is registered as a child.

Note:
: Only one level is checked and no recursions are done, so if the element with given ID is a child of a child, this method returns false.
Returns:
true when element with given ID is a direct child.

void GCS::GObject::reparent ( const GElementID new_parent  ) 

Sets given element ID as new parent of this element.


Member Data Documentation

const GElementID GCS::GObject::Connection [private]

The element ID of the connected element. Connections also represent a central idea of the G system, since any thing can only "exist" if it is concerned with something. This idea can be applied to every setting. Also multiple elements are needed to represent a complex element that is concerned with multiple things. ... think about it ...

GElementData* GCS::GObject::ElementData [private]

Can hold arbitrary additional element data. This can be seen as an element wide storage facility that is shared among all agents. All data stored here is also automatically transported through the network.

GEnergy* GCS::GObject::Energy [private]

The object's energy.

GForm* GCS::GObject::Form [private]

The object's form.

const GElementID GCS::GObject::ID [private]

The element's ID.

GElementID GCS::GObject::Parent [private]

The element's parent's ID.

const GWorldData* GCS::GObject::WorldData [private]

This is an interface that can be used by agents to access data from other elements (read only). The implementation also depends on the GWE! It is not the GObject's responsibility to delete the WorldData object.


The documentation for this class was generated from the following files:
Generated on Thu Nov 16 07:49:36 2006 for G System by  doxygen 1.4.7