Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

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)
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
void reparent (const GElementID &new_parent)
void addChild (const GElementID &)
bool isChild (const GElementID &) const
void removeChild (const GElementID &)
QValueList< GElementIDgetChildren () const

Private Attributes

GEnergyEnergy
GFormForm
GElementID Parent
const GElementID ID
const GElementID Connection
QValueList< GElementIDChildren

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
[inline]
 

Constructor

virtual GCS::GObject::~GObject  )  [inline, virtual]
 

A virtual destructor allows cleaner subclassing.


Member Function Documentation

void GCS::GObject::addChild const GElementID  ) 
 

Adds given element as child and sets it's GOjbect::Parent attribute.

QValueList< GElementID > GCS::GObject::getChildren  )  const
 

Returns:
const children container

const GElementID& GCS::GObject::getConnection  )  const [inline]
 

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

const GEnergy* GCS::GObject::getEnergy  )  const [inline]
 

Returns:
const pointer to the energy.

GEnergy* GCS::GObject::getEnergy  )  [inline]
 

Returns:
pointer to the energy.

const GForm* GCS::GObject::getForm  )  const [inline]
 

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

GForm* GCS::GObject::getForm  )  [inline]
 

Returns:
pointer to the form.

const GElementID& GCS::GObject::getID  )  const [inline]
 

Returns:
const reference of the own element ID.

const GElementID& GCS::GObject::getParent  )  const [inline]
 

Returns:
const reference of the parent ID.

bool GCS::GObject::hasEnergy  )  const [inline]
 

Returns:
true when energy is available.

bool GCS::GObject::hasForm  )  const [inline]
 

Returns:
true when a form 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::removeChild const GElementID  ) 
 

Removes given child ID from list of children.

Note:
: it does not change the GObject::Parent attribute of specified child.

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

Sets given element ID as new parent of this element.


Member Data Documentation

QValueList<GElementID> GCS::GObject::Children [private]
 

This value list stores all IDs of the element's children.

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 ...

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.


The documentation for this class was generated from the following files:
Generated on Thu Oct 21 21:18:25 2004 for G System by doxygen 1.3.6