Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

oxygen::GameControlServer Class Reference

#include <gamecontrolserver.h>

Inheritance diagram for oxygen::GameControlServer:

Inheritance graph
[legend]
Collaboration diagram for oxygen::GameControlServer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GameControlServer ()
 ~GameControlServer ()
bool InitParser (const std::string &parserName)
 creates a parser instance and registers it to the GameControlServer
void InitEffector (const std::string &effectorName)
 sets effectorName as the effector class that is initially created with every new AgentAspect instance.
bool InitControlAspect (const std::string &aspectName)
 creates an instance of aspectName and registers it as a ControlAspect to the GameControlServer.
boost::shared_ptr< BaseParserGetParser ()
 returns the parser currently registered to the GameControlServer
boost::shared_ptr< ActionObject::TListParse (int id, const std::string &str) const
 parses a command string using the registerd parser and uses the registered effectors of the agent identified by param to construct an ActionObject.
bool AgentConnect (int id)
 notifies the GameControlServer that an agent has connected to the simulation.
bool AgentDisappear (int id)
 notifies the GameControlServer that an agent has disappeared from the simulation.
float GetSenseInterval (int id)
 returns the time between to queries of the agents perceptors in seconds
float GetSenseLatency (int id)
 GetSenseLatency returns latency it takes to query the sensors of an agent in seconds.
float GetActionLatency (int id)
 GetActionLatency returns the latency it takes to realize an agent action in seconds.
boost::shared_ptr< AgentAspectGetAgentAspect (int id)
 returns the AgentAspect for the given
void Update (float deltaTime)
 This method is used to notify the GameControlServer that the game has advanced deltaTime seconds.
bool IsFinished () const
 This method is used to indicate that the simulation is finished.
void Quit ()
 This method is used to set the simulation into the 'finished' state.

Protected Types

typedef std::map< int, boost::shared_ptr<
AgentAspect > > 
TAgentMap

Protected Member Functions

boost::shared_ptr< SceneGetActiveScene ()
 helper method that queries the SceneServer for the currently active Scene

Protected Attributes

TAgentMap mAgentMap
 a map from agent IDs to agent instances
boost::shared_ptr< BaseParsermParser
 the parser instance used
std::string mCreateEffector
 the name of the initial effector class of each new agent has to construct all remaining parts
bool mExit
 flag if the simulation is over

Detailed Description

Definition at line 36 of file gamecontrolserver.h.


Member Typedef Documentation

typedef std::map<int, boost::shared_ptr<AgentAspect> > oxygen::GameControlServer::TAgentMap [protected]
 

Definition at line 129 of file gamecontrolserver.h.


Constructor & Destructor Documentation

GameControlServer::GameControlServer  ) 
 

Definition at line 38 of file gamecontrolserver.cpp.

References mExit.

GameControlServer::~GameControlServer  ) 
 

Definition at line 43 of file gamecontrolserver.cpp.


Member Function Documentation

bool GameControlServer::AgentConnect int  id  ) 
 

notifies the GameControlServer that an agent has connected to the simulation.

Parameters:
id should be a unique identifier for the new agent. It is not assigned by the GameControlServer.

Definition at line 119 of file gamecontrolserver.cpp.

References GetActiveScene(), zeitgeist::Object::GetCore(), zeitgeist::Object::GetLog(), mAgentMap, and mCreateEffector.

Here is the call graph for this function:

bool GameControlServer::AgentDisappear int  id  ) 
 

notifies the GameControlServer that an agent has disappeared from the simulation.

Parameters:
id was the unique identifier of the disappeared agent. The GameControlServer uses the AgentAspect corresponding to id to clean up after the agent left.

Definition at line 166 of file gamecontrolserver.cpp.

References GetActiveScene(), zeitgeist::Object::GetLog(), and mAgentMap.

Here is the call graph for this function:

float GameControlServer::GetActionLatency int  id  ) 
 

GetActionLatency returns the latency it takes to realize an agent action in seconds.

Definition at line 220 of file gamecontrolserver.cpp.

shared_ptr< Scene > GameControlServer::GetActiveScene  )  [protected]
 

helper method that queries the SceneServer for the currently active Scene

Definition at line 94 of file gamecontrolserver.cpp.

References zeitgeist::Object::GetCore(), and zeitgeist::Object::GetLog().

Referenced by AgentConnect(), and AgentDisappear().

Here is the call graph for this function:

shared_ptr< AgentAspect > GameControlServer::GetAgentAspect int  id  ) 
 

returns the AgentAspect for the given

Parameters:
id 

Definition at line 291 of file gamecontrolserver.cpp.

References mAgentMap.

shared_ptr< BaseParser > GameControlServer::GetParser  ) 
 

returns the parser currently registered to the GameControlServer

Definition at line 88 of file gamecontrolserver.cpp.

References mParser.

float GameControlServer::GetSenseInterval int  id  ) 
 

returns the time between to queries of the agents perceptors in seconds

Definition at line 204 of file gamecontrolserver.cpp.

float GameControlServer::GetSenseLatency int  id  ) 
 

GetSenseLatency returns latency it takes to query the sensors of an agent in seconds.

Definition at line 212 of file gamecontrolserver.cpp.

bool oxygen::GameControlServer::InitControlAspect const std::string &  aspectName  ) 
 

creates an instance of aspectName and registers it as a ControlAspect to the GameControlServer.

Parameters:
aspectName 

void GameControlServer::InitEffector const std::string &  effectorName  ) 
 

sets effectorName as the effector class that is initially created with every new AgentAspect instance.

Parameters:
effectorName the init effector of the agent

Definition at line 63 of file gamecontrolserver.cpp.

References mCreateEffector.

bool GameControlServer::InitParser const std::string &  parserName  ) 
 

creates a parser instance and registers it to the GameControlServer

Parameters:
parserName the name of the parser

Definition at line 48 of file gamecontrolserver.cpp.

References zeitgeist::Object::GetCore(), zeitgeist::Object::GetLog(), and mParser.

Here is the call graph for this function:

bool GameControlServer::IsFinished  )  const
 

This method is used to indicate that the simulation is finished.

The GameControlServer knows that the simulatio is finished if one of the GameControlAspects below indicate that the simulation is finished. The finished state is set during GameControlServer::Update().

Returns:
true if the simulation should be stopped.

Definition at line 330 of file gamecontrolserver.cpp.

References mExit.

boost::shared_ptr<ActionObject::TList> oxygen::GameControlServer::Parse int  id,
const std::string &  str
const
 

parses a command string using the registerd parser and uses the registered effectors of the agent identified by param to construct an ActionObject.

This method must be const as it is called from SpadesServer::ParseAct, which is const to prevent it from modifying the world model.

void GameControlServer::Quit  ) 
 

This method is used to set the simulation into the 'finished' state.

Definition at line 324 of file gamecontrolserver.cpp.

References mExit.

void GameControlServer::Update float  deltaTime  ) 
 

This method is used to notify the GameControlServer that the game has advanced deltaTime seconds.

The GameControlServer will in turn update all registered GameControlAspects below it.

Definition at line 303 of file gamecontrolserver.cpp.


Member Data Documentation

TAgentMap oxygen::GameControlServer::mAgentMap [protected]
 

a map from agent IDs to agent instances

Definition at line 132 of file gamecontrolserver.h.

Referenced by AgentConnect(), AgentDisappear(), and GetAgentAspect().

std::string oxygen::GameControlServer::mCreateEffector [protected]
 

the name of the initial effector class of each new agent has to construct all remaining parts

Definition at line 139 of file gamecontrolserver.h.

Referenced by AgentConnect(), and InitEffector().

bool oxygen::GameControlServer::mExit [protected]
 

flag if the simulation is over

Definition at line 142 of file gamecontrolserver.h.

Referenced by GameControlServer(), IsFinished(), and Quit().

boost::shared_ptr<BaseParser> oxygen::GameControlServer::mParser [protected]
 

the parser instance used

Definition at line 135 of file gamecontrolserver.h.

Referenced by GetParser(), and InitParser().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:44:25 2006 for rcssserver3d by  doxygen 1.4.4