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

GBE::GInvestigationAgent Class Reference

Allows for environment investigation and analysation. More...

#include <GInvestigationAgent.h>

Inheritance diagram for GBE::GInvestigationAgent:

Inheritance graph
[legend]
Collaboration diagram for GBE::GInvestigationAgent:

Collaboration graph
[legend]
List of all members.

Public Slots

virtual void createAndSendBasicInfluence (double fraction_of_own_energy, unsigned long targetID=0)
virtual void followTarget (unsigned long destinationElementID)
virtual void setSpeed (const GCS::GVector3 &new_speed)

Signals

void influenceReceived (const GCS::GElementInfluence &i)
void knownElementsListChanged (const QStringList &known_elements)

Public Member Functions

 GInvestigationAgent (GWE::GWEInterface *gwe, int update_interval_msec=500, QObject *parent=0, const char *name=0)

Protected Slots

virtual void sendChangedSignals ()

Protected Member Functions

virtual void run ()
virtual void receiveInfluence (GCS::GElementInfluence &influence)

Protected Attributes

QTimer UpdateTimer
QValueList< GCS::GElementIDKnownElements
bool KnownElementsEmitPending
GWE::GWEInterfaceGwe
int UpdateInterval
unsigned long CurrentTarget
GCS::GVector3 CurrentSpeed

Detailed Description

Allows for environment investigation and analysation.

Author:
Raphael Langerhorst
This agent allows for easy environment analysation. It periodically emits information about itself as well as received influence. Not all information is emitted from signals of this class, the GAgent base class already offers some signals like energy change or form change signals, these are also used!

The investigation agent uses a direct pointer to a GWE to access data from other elements, this is NOT standard and shouldn't be done in other agents.


Member Function Documentation

void GBE::GInvestigationAgent::createAndSendBasicInfluence double  fraction_of_own_energy,
unsigned long  targetID = 0
[virtual, slot]
 

Creates a standard GElementInfluence object and sends it to given ID, if ID == 0 (default value) then it is radiated

void GBE::GInvestigationAgent::followTarget unsigned long  destinationElementID  )  [virtual, slot]
 

Makes this element move to given ID and follow it

See also:
run(), CurrentTarget

void GBE::GInvestigationAgent::influenceReceived const GCS::GElementInfluence i  )  [signal]
 

Emitted every time an influence had been received

void GBE::GInvestigationAgent::knownElementsListChanged const QStringList &  known_elements  )  [signal]
 

Emitted every time the KnownElements list has changed

void GBE::GInvestigationAgent::receiveInfluence GCS::GElementInfluence influence  )  [protected, virtual]
 

Here the agent basically adds the received influence amount to EnergyAmountReceived.

Todo:
: this has to be improved as we want a usable sensor

: that means an energylevel spectrum analysation would be good for example

Reimplemented from GCS::GAgent.

void GBE::GInvestigationAgent::run  )  [protected, virtual]
 

Constantly accelerates towards the element with the ID of currentTarget.

Reimplemented from GCS::GAgent.

void GBE::GInvestigationAgent::sendChangedSignals  )  [protected, virtual, slot]
 

Sends updates about form and energy.

Note:
If you think that the signal of GElement can be used as well for these changes, then you are correct in principal, but the agent is simplier to use when all signals can be connected from one object.

void GBE::GInvestigationAgent::setSpeed const GCS::GVector3 new_speed  )  [virtual, slot]
 

Sets the speed attribute.

See also:
CurrentSpeed


Member Data Documentation

GCS::GVector3 GBE::GInvestigationAgent::CurrentSpeed [protected]
 

Sets the current speed of the element, the agent will try force this onto the form's speed attribute.

Note:
CurrentTarget must be set to 0 for this to work, otherwise the element will follow its current target.

unsigned long GBE::GInvestigationAgent::CurrentTarget [protected]
 

The investigation element is following this target

GWE::GWEInterface* GBE::GInvestigationAgent::Gwe [protected]
 

Used to get exact locations of elements (for movement,...).

QValueList<GCS::GElementID> GBE::GInvestigationAgent::KnownElements [protected]
 

All elements that get in contact with this investigation element (i.e. from which influences where received) are listed here.

Todo:
: older entries should be removed(?)

bool GBE::GInvestigationAgent::KnownElementsEmitPending [protected]
 

If set to true and the changed signals are emitted, then the known elements are also emited with the knownElementsListChanged() signal.

See also:
UpdateTimer, KnownElements, knownElementsListChanged().

int GBE::GInvestigationAgent::UpdateInterval [protected]
 

Determines the time between emitting of updates.

QTimer GBE::GInvestigationAgent::UpdateTimer [protected]
 

Update timer used for energyChanged and formChanged signals.


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