GCS::GElement Class Reference
Everything in the world is an element, they consist of energy, agents and form.
More...
#include <GElement.h>
Inheritance diagram for GCS::GElement:
[legend]Collaboration diagram for GCS::GElement:
[legend]List of all members.
Detailed Description
Everything in the world is an element, they consist of energy, agents and form.
- Author:
- Raphael Langerhorst
GElement is the basic building block with which the whole universe is built. It is possible to order elements in a hierarchical structure - like universe - galaxies - solar systems - planets - continents - ... for this structuring child elements are used.
GElement is the interface class for an element that consists of multiple individual classes. Most notably GObject is used to store data.
Every element basically consists of three things: matter/form, energy, behaviour
Matter and form are represented by the GForm, energy is represented by GEnergy. Behaviour is represented by GAgent.
From elements with these three parts everything can be made.
Everything influences each other, so elements are "connected" to each other; this connection can be used for influencing by the behaviour part of the element.
Constructor & Destructor Documentation
| GCS::GElement::GElement |
( |
GObject * |
object |
) |
|
|
|
|
Constructor: GElement takes over ownership of the object; that means that the object is destroyed when the element is destroyed; |
|
|
Destructor also deletes the Object and all Agents. If you need to save a specific agent, you need to use removeAgent() before deleting the element. |
Member Function Documentation
| void GCS::GElement::addAgent |
( |
GCS::GAgent * |
agent |
) |
[slot] |
|
|
|
Initializes given agent for this element and adds it to the private list of agents;
Initialization includes connecting signals and slots and setting the agent's Object and Agents member to enable the agent access to these parts of the element. |
| void GCS::GElement::agentChanged |
( |
const GCS::GAgent & |
changedAgent |
) |
[signal] |
|
|
|
Emitted when the agent changed it's state/data. |
| void GCS::GElement::childElementCreated |
( |
GCS::GElement * |
newElement |
) |
[signal] |
|
|
|
Emitted when a child element has been created - Note:
- If an agent creates a child and doesn't emit this signal it is NOT guranteed that your element gets recognized by the GWE.
|
| void GCS::GElement::childElementRemoved |
( |
const GCS::GElementID & |
childID |
) |
[signal] |
|
|
|
Emitted when a child element was removed (deleted) - Note:
- This signal should NOT be emitted when the child just changed its parent.
- See also:
- parentChanged()
|
| void GCS::GElement::energyChanged |
( |
const GCS::GEnergy & |
changedEnergy |
) |
[signal] |
|
|
|
Emitted when the element's energy has changed. |
| void GCS::GElement::execute |
( |
double |
seconds_elapsed |
) |
[signal] |
|
|
|
Resumes all element-internal processing (execution of agents).
- Parameters:
-
| seconds_elapsed | tells how much time has passed since parking. |
- See also:
- park(), parkElement(), executeElement()
|
| void GCS::GElement::executeElement |
( |
double |
seconds_delta_t_offset = 0 |
) |
|
|
|
|
Emits an execute signal.
- Parameters:
-
| seconds_delta_t_offset | can be used to compensate time differences between two hosts, e.g. when an element was parked, transfered to another host and executed again. This should be target host time minus source host time. |
- See also:
- execute()
|
| void GCS::GElement::formChanged |
( |
const GCS::GForm & |
changedForm |
) |
[signal] |
|
|
|
Emitted when the element's form has changed. |
|
|
takes any kind of element influence and passes it on to all agents for processing;
please note that this is a blocking call until all agents have received the influence; some agents might even process the influence fully before returning |
| const QPtrList< GAgent > & GCS::GElement::getAgents |
( |
|
) |
const |
|
|
|
- Returns:
- a list with all agents (const reference)
|
| const GElementID & GCS::GElement::getElementID |
( |
|
) |
const |
|
|
|
returns a read only reference to the element's GElementID; |
| const GObject * GCS::GElement::getObject |
( |
|
) |
const |
|
|
|
- Returns:
- the element's object (const pointer)
|
| bool GCS::GElement::isParked |
( |
|
) |
|
|
|
|
Returns true when element is parked. In such a state the element could be safely serialized for example.
- Note:
- when the element is parked, this means that no agent is executing
|
|
|
Emitted when the element moves out of its current parent region into another parent region. - Note:
- This means a restructuring of the element hierarchy! The GWE might be interested in this.
|
| void GCS::GElement::park |
( |
|
) |
[signal] |
|
|
|
Stops all element-internal processing (execution of agents). This is useful for removing the element from memory and keeping it somewhere in a database. If the element needs to be reactivated then this can be performed with executeElement(). By doing so the element measures the time between where it was
- Note:
- It is not guranteed that this signal returns immediately because it depends on the agent's implementation of GAgent::beginPark().
- See also:
- execute(), executeElement(), parkElement(), ParkTime
|
| void GCS::GElement::parkElement |
( |
|
) |
|
|
|
|
Emits a park signal. - See also:
- park()
|
|
|
Connected from all agents' radiateInfluence signals. |
|
|
Takes any kind of element influence. Currently it only emits a forwardInfluence signal which is connected to all the agent's receiveInfluence slot.
- See also:
- GElement::forwardInfluenceInternal()
|
| void GCS::GElement::removeAgent |
( |
GCS::GAgent * |
agent, |
|
|
bool |
del = FALSE |
|
) |
[slot] |
|
|
|
Removes given agent from element but does not delete it (by default). all signals and slots between this element and the agent are disconnected. If del is set to TRUE then the agent is also deleted from memory. |
|
|
Connected from all agents' sendInfluence signals. |
Member Data Documentation
|
|
Contains all behaviour for this element, that is, agents. |
|
|
The elements object, contains energy, form, ... |
|
|
Used to measure the elapsed time between element parking and resuming execution. When the element is parked ParkTime is set to the current time. When execution of the element resumes, this attribute can be used to tell how much time has elapsed. - See also:
- parkElement(), executeElement()
|
The documentation for this class was generated from the following files:
Generated on Thu Oct 21 21:18:21 2004 for G System by
1.3.6