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

oxygen::SimulationServer Class Reference

#include <simulationserver.h>

Inheritance diagram for oxygen::SimulationServer:

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

Collaboration graph
[legend]
List of all members.

Public Types

enum  EControlEvent {
  CE_Init, CE_Done, CE_StartCycle, CE_SenseAgent,
  CE_ActAgent, CE_EndCycle
}

Public Member Functions

 SimulationServer ()
 ~SimulationServer ()
virtual float GetTime ()
 returns the current simulation time
virtual void SetSimStep (float deltaTime)
 sets the simulation time step
virtual float GetSimStep ()
 returns the simulation time step
virtual void AdvanceTime (float deltaTime)
 increases the accumulated time since the last simulation step, but does not step the simulation
virtual float GetSumDeltaTime ()
 returns the accumulated time since the last simulation step
bool InitControlNode (const std::string &className, const std::string &name)
 creates and registers a new SimControlNode to the SimulationServer
void SetAutoTimeMode (bool set)
 sets the auto time mode of the SimulationServer.
bool GetAutoTimeMode ()
 returns the current auto time setting
boost::shared_ptr< oxygen::SimControlNodeGetControlNode (const std::string &controlName)
 returns the instance of a registerd SimControlNode
int GetArgC ()
 returns the cached argc
char ** GetArgV ()
 returns the cached argv
virtual void Run (int argc=0, char **argv=0)
 the runloop of the simulation
boost::shared_ptr< MonitorServerGetMonitorServer ()
 returns the cached MonitorServer reference
boost::shared_ptr< GameControlServerGetGameControlServer ()
 returns the cached GameControlServer reference
boost::shared_ptr< SceneServerGetSceneServer ()
 returns thr cached SceneServer reference
int GetCycle ()
 returns the current simulation cycle

Static Public Member Functions

static void Quit ()
 exits the simulation on the next simulation step

Protected Member Functions

virtual void OnLink ()
 This method is called, when the hierarchy object has been linked to a parent.
virtual void OnUnlink ()
 This rountine is called, before the hierarchy object is removed from the parent.
virtual void Step ()
 advances the simulation mSumDeltaTime seconds.
void ControlEvent (EControlEvent event)
 dispatches a ControlEvent to the set of registered SimControlNodes, i.e.

Static Protected Member Functions

static void CatchSignal (int sig_num)
 SIGINT handler used to catch ctrl-C.

Protected Attributes

int mArgC
 the argc parameter passed to Run()
char ** mArgV
 the argv parameter passed to Run()
float mSimTime
 the current simulation time
float mSimStep
 the discrete simulation time step, or 0 for a non discrete simulation
float mSumDeltaTime
 the accumulated simulation time since the last simulation step
bool mAutoTime
 true if the server automatically advances the simulation time mSimStep every cycle (this is the default), otherwise a SimControlNode is responsible to advance the ime
int mCycle
 the current simulation cycle
boost::shared_ptr< MonitorServermMonitorServer
 a cached reference to the monitor server
boost::shared_ptr< GameControlServermGameControlServer
 a cached reference to the GameControlServer
boost::shared_ptr< SceneServermSceneServer
 a cached reference to the SceneServer

Static Protected Attributes

static bool mExit = false
 if true, the simulaion will exit on next simulation step

Detailed Description

Definition at line 34 of file simulationserver.h.


Member Enumeration Documentation

enum oxygen::SimulationServer::EControlEvent
 

Enumerator:
CE_Init 
CE_Done 
CE_StartCycle 
CE_SenseAgent 
CE_ActAgent 
CE_EndCycle 

Definition at line 43 of file simulationserver.h.


Constructor & Destructor Documentation

SimulationServer::SimulationServer  ) 
 

Definition at line 48 of file simulationserver.cpp.

References CatchSignal(), mArgC, mArgV, mAutoTime, mCycle, mSimStep, mSimTime, and mSumDeltaTime.

Here is the call graph for this function:

SimulationServer::~SimulationServer  ) 
 

Definition at line 61 of file simulationserver.cpp.


Member Function Documentation

void SimulationServer::AdvanceTime float  deltaTime  )  [virtual]
 

increases the accumulated time since the last simulation step, but does not step the simulation

Definition at line 191 of file simulationserver.cpp.

References mSumDeltaTime.

Referenced by Run().

void SimulationServer::CatchSignal int  sig_num  )  [static, protected]
 

SIGINT handler used to catch ctrl-C.

Definition at line 38 of file simulationserver.cpp.

References mExit.

Referenced by SimulationServer().

void SimulationServer::ControlEvent EControlEvent  event  )  [protected]
 

dispatches a ControlEvent to the set of registered SimControlNodes, i.e.

calls a method corresponding to the given event

Definition at line 226 of file simulationserver.cpp.

References zeitgeist::Node::begin(), CE_ActAgent, CE_Done, CE_EndCycle, CE_Init, CE_SenseAgent, CE_StartCycle, zeitgeist::Node::end(), and zeitgeist::Object::GetLog().

Referenced by Run().

Here is the call graph for this function:

int SimulationServer::GetArgC  ) 
 

returns the cached argc

Definition at line 108 of file simulationserver.cpp.

References mArgC.

char ** SimulationServer::GetArgV  ) 
 

returns the cached argv

Definition at line 113 of file simulationserver.cpp.

References mArgV.

bool SimulationServer::GetAutoTimeMode  ) 
 

returns the current auto time setting

Definition at line 143 of file simulationserver.cpp.

References mAutoTime.

boost::shared_ptr<oxygen::SimControlNode> oxygen::SimulationServer::GetControlNode const std::string &  controlName  ) 
 

returns the instance of a registerd SimControlNode

int SimulationServer::GetCycle  ) 
 

returns the current simulation cycle

Definition at line 148 of file simulationserver.cpp.

References mCycle.

shared_ptr< GameControlServer > SimulationServer::GetGameControlServer  ) 
 

returns the cached GameControlServer reference

Definition at line 315 of file simulationserver.cpp.

References mGameControlServer.

shared_ptr< MonitorServer > SimulationServer::GetMonitorServer  ) 
 

returns the cached MonitorServer reference

Definition at line 320 of file simulationserver.cpp.

References mMonitorServer.

shared_ptr< SceneServer > SimulationServer::GetSceneServer  ) 
 

returns thr cached SceneServer reference

Definition at line 325 of file simulationserver.cpp.

References mSceneServer.

float SimulationServer::GetSimStep  )  [virtual]
 

returns the simulation time step

Definition at line 123 of file simulationserver.cpp.

References mSimStep.

float SimulationServer::GetSumDeltaTime  )  [virtual]
 

returns the accumulated time since the last simulation step

Definition at line 133 of file simulationserver.cpp.

References mSumDeltaTime.

float SimulationServer::GetTime  )  [virtual]
 

returns the current simulation time

Definition at line 118 of file simulationserver.cpp.

References mSimTime.

bool SimulationServer::InitControlNode const std::string &  className,
const std::string &  name
 

creates and registers a new SimControlNode to the SimulationServer

Definition at line 153 of file simulationserver.cpp.

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

Here is the call graph for this function:

void SimulationServer::OnLink  )  [protected, virtual]
 

This method is called, when the hierarchy object has been linked to a parent.

At that point, traversal can commence. It can be overridden to support custom 'link' behavior.

Reimplemented from zeitgeist::Leaf.

Definition at line 65 of file simulationserver.cpp.

References zeitgeist::Object::GetCore(), zeitgeist::Object::GetLog(), mGameControlServer, mMonitorServer, and mSceneServer.

Here is the call graph for this function:

void SimulationServer::OnUnlink  )  [protected, virtual]
 

This rountine is called, before the hierarchy object is removed from the parent.

It can be overridden to support custom 'unlink' behavior.

Reimplemented from zeitgeist::Leaf.

Definition at line 96 of file simulationserver.cpp.

References mGameControlServer, mMonitorServer, and mSceneServer.

void SimulationServer::Quit  )  [static]
 

exits the simulation on the next simulation step

Definition at line 103 of file simulationserver.cpp.

References mExit.

void SimulationServer::Run int  argc = 0,
char **  argv = 0
[virtual]
 

the runloop of the simulation

Definition at line 277 of file simulationserver.cpp.

References AdvanceTime(), CE_ActAgent, CE_Done, CE_EndCycle, CE_Init, CE_SenseAgent, CE_StartCycle, ControlEvent(), zeitgeist::Object::GetLog(), mArgC, mArgV, mAutoTime, mCycle, mExit, mSimStep, mSimTime, and Step().

Here is the call graph for this function:

void SimulationServer::SetAutoTimeMode bool  set  ) 
 

sets the auto time mode of the SimulationServer.

if set to true the SimulationServer automatically advances the simulation mSimStep time every cycle, this is the default mode. Otherwise a registered ControlNode takes the responsibility to do so (by calling AdvanceTime regularly)

Definition at line 138 of file simulationserver.cpp.

References mAutoTime.

void SimulationServer::SetSimStep float  deltaTime  )  [virtual]
 

sets the simulation time step

Definition at line 128 of file simulationserver.cpp.

References mSimStep.

void SimulationServer::Step  )  [protected, virtual]
 

advances the simulation mSumDeltaTime seconds.

If mSimStep is nonzero this is done in discrete steps

Definition at line 196 of file simulationserver.cpp.

References mGameControlServer, mSceneServer, mSimStep, mSimTime, and mSumDeltaTime.

Referenced by Run().


Member Data Documentation

int oxygen::SimulationServer::mArgC [protected]
 

the argc parameter passed to Run()

Definition at line 141 of file simulationserver.h.

Referenced by GetArgC(), Run(), and SimulationServer().

char** oxygen::SimulationServer::mArgV [protected]
 

the argv parameter passed to Run()

Definition at line 144 of file simulationserver.h.

Referenced by GetArgV(), Run(), and SimulationServer().

bool oxygen::SimulationServer::mAutoTime [protected]
 

true if the server automatically advances the simulation time mSimStep every cycle (this is the default), otherwise a SimControlNode is responsible to advance the ime

Definition at line 163 of file simulationserver.h.

Referenced by GetAutoTimeMode(), Run(), SetAutoTimeMode(), and SimulationServer().

int oxygen::SimulationServer::mCycle [protected]
 

the current simulation cycle

Definition at line 166 of file simulationserver.h.

Referenced by GetCycle(), Run(), and SimulationServer().

bool SimulationServer::mExit = false [static, protected]
 

if true, the simulaion will exit on next simulation step

Definition at line 147 of file simulationserver.h.

Referenced by CatchSignal(), Quit(), and Run().

boost::shared_ptr<GameControlServer> oxygen::SimulationServer::mGameControlServer [protected]
 

a cached reference to the GameControlServer

Definition at line 172 of file simulationserver.h.

Referenced by GetGameControlServer(), OnLink(), OnUnlink(), and Step().

boost::shared_ptr<MonitorServer> oxygen::SimulationServer::mMonitorServer [protected]
 

a cached reference to the monitor server

Definition at line 169 of file simulationserver.h.

Referenced by GetMonitorServer(), OnLink(), and OnUnlink().

boost::shared_ptr<SceneServer> oxygen::SimulationServer::mSceneServer [protected]
 

a cached reference to the SceneServer

Definition at line 175 of file simulationserver.h.

Referenced by GetSceneServer(), OnLink(), OnUnlink(), and Step().

float oxygen::SimulationServer::mSimStep [protected]
 

the discrete simulation time step, or 0 for a non discrete simulation

Definition at line 154 of file simulationserver.h.

Referenced by GetSimStep(), Run(), SetSimStep(), SimulationServer(), and Step().

float oxygen::SimulationServer::mSimTime [protected]
 

the current simulation time

Definition at line 150 of file simulationserver.h.

Referenced by GetTime(), Run(), SimulationServer(), and Step().

float oxygen::SimulationServer::mSumDeltaTime [protected]
 

the accumulated simulation time since the last simulation step

Definition at line 158 of file simulationserver.h.

Referenced by AdvanceTime(), GetSumDeltaTime(), SimulationServer(), and Step().


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