#include <spadesserver.h>
Inheritance diagram for oxygen::SpadesServer:
Public Member Functions | |
SpadesServer () | |
~SpadesServer () | |
virtual bool | ConstructInternal () |
setup script variables used to customize the SpadesServer | |
virtual void | OnLink () |
set up GameControlServer and MonitorServer reference | |
virtual void | OnUnlink () |
reset GameControlServer and MonitorServer reference | |
boost::shared_ptr< GameControlServer > | GetGameControlServer () const |
helper function to locate the game control server | |
float | GetTimePerStep () const |
returns the amount of time in seconds a single simulation step corresponds to. | |
bool | GetRunIntegratedCommserver () const |
Get the value of the Spades.RunIntegratedCommserver variable. | |
int | GetCommServersWanted () const |
Get the value of the Spades.CommServersWanted variable. | |
int | GetMonitorInterval () const |
Get the value of the Spades.MonitorInterval variable. | |
bool | GetSendAgentThinkTimes () const |
Get the value of the Spades.SendAgentThinkTimes variable. | |
void | QueueAgents (const std::string &agentType="default", int num=1) |
queue up agents to be started. | |
void | Unpause () |
set simulation mode to normal | |
virtual void | UpdateCached () |
update cached variables | |
spades::EngineParam * | parseParameters (int argc, const char *const *argv) |
You probably want to inherit some parameters from EngineParam and use that to parse the commandline. | |
bool | initialize (spades::SimEngine *pSE) |
Most of the real initialization/finalization work should be done here. | |
spades::SimEngine * | GetSimEngine () |
returns a pointer to the spades simulation engine | |
bool | finalize () |
spades::SimTime | simToTime (spades::SimTime time_curr, spades::SimTime time_desired) |
This function should advance the world forward. | |
spades::DataArray | getMonitorHeaderInfo () |
This function is called once for every monitor. | |
spades::DataArray | getMonitorInfo (spades::SimTime time) |
This function will be called periodically to get information about the current state of the world. | |
void | parseMonitorMessage (const char *data, unsigned datalen) |
If a monitor sends information to the world model, this function is called to process it. | |
spades::SimTime | getMinActionLatency () const |
There is a latency (in simulation time) between when an action is sent by the agent and when it takes effect. | |
spades::SimTime | getMinSenseLatency () const |
Similar to getMinActionLatency, but the latency between when the sensation is generated from the world and when it is received by the agent. | |
spades::ActEvent * | parseAct (spades::SimTime t, spades::AgentID a, const char *data, unsigned datalen) const |
This function parses the action string received from the agents Note that this method is const! parsing the act can *not* affect the world at all, since this could then violate causality. | |
void | pauseModeCallback () |
When the simulation is paused, this is called peridically At some point, this function should unpause the simulation The simulation starts out in paused mode. | |
bool | agentConnect (spades::AgentID agent, spades::AgentTypeDB::AgentTypeConstIterator at) |
The world model initiates startup requests for agents. | |
bool | agentDisappear (spades::AgentID agent, spades::AgentLostReason reason) |
Any time an agent leaves the simulation (whether by crash, graceful exit request, etc. | |
void | notifyCommserverConnect (spades::ServerID s) |
Called every time a comm server connects. | |
void | notifyCommserverDisconnect (spades::ServerID s) |
Called every time a comm server dsiconnects. | |
Protected Types | |
typedef std::list< AgentItem > | TAgentQueue |
Protected Member Functions | |
void | StartAgents (const AgentItem &ai) |
Start up a number of agents of a given type. | |
Private Attributes | |
spades::SimEngine * | mSimEngine |
the Spades simulation engine | |
boost::shared_ptr< ParamReader > | mParamReader |
our commandline parser | |
bool | mSimulationModeChanged |
flag if there is a simulation mode change scheduled | |
spades::SimulationMode | mNewSimulationMode |
the next simulation mode for a mode change | |
TAgentQueue | mAgentQueue |
a queue of agents to be started up | |
float | mOffsetCreateSense |
the simTime offset in the scheduled times for the agents CreateSenseEvent | |
float | mNextInitialCreateSense |
the initial CreateSenseEvent simTime scheduled for the next connecing agent | |
boost::shared_ptr< MonitorServer > | mMonitorServer |
a cached reference to the monitor server | |
boost::shared_ptr< GameControlServer > | mGameControlServer |
a cached reference to the GameControlServer | |
boost::shared_ptr< SceneServer > | mSceneServer |
a cached reference to the SceneServer | |
float | mTimePerStep |
the cached Spades.TimePerStep value | |
Classes | |
struct | AgentItem |
Definition at line 40 of file spadesserver.h.
|
Definition at line 228 of file spadesserver.h. |
|
Definition at line 42 of file spadesserver.cpp. |
|
Definition at line 49 of file spadesserver.cpp. |
|
The world model initiates startup requests for agents. This function is called once the agent has been started successfully |
|
Any time an agent leaves the simulation (whether by crash, graceful exit request, etc. ), this function is called so that the world model can update it's data structures |
|
setup script variables used to customize the SpadesServer
Reimplemented from zeitgeist::Object. Definition at line 54 of file spadesserver.cpp. References zeitgeist::Object::GetScript(). Here is the call graph for this function: ![]() |
|
Definition at line 247 of file spadesserver.cpp. |
|
Get the value of the Spades.CommServersWanted variable. On startup SpadesServer will wait until at least 'CommServersWanted' CommServers have connected before it initially unpauses the simulation. Definition at line 118 of file spadesserver.cpp. References zeitgeist::Object::GetScript(). Referenced by pauseModeCallback(). Here is the call graph for this function: ![]() |
|
helper function to locate the game control server
Definition at line 156 of file spadesserver.cpp. References mGameControlServer. Referenced by oxygen::SpadesCreateSenseEvent::createSense(), oxygen::SpadesCreateSenseEvent::realizeEventWorldModel(), and oxygen::SpadesActEvent::realizeEventWorldModel(). |
|
There is a latency (in simulation time) between when an action is sent by the agent and when it takes effect. This function needs to return the minimum of all possible values of that latency. This is used to reason about causality Definition at line 335 of file spadesserver.cpp. |
|
Similar to getMinActionLatency, but the latency between when the sensation is generated from the world and when it is received by the agent.
Definition at line 341 of file spadesserver.cpp. |
|
This function is called once for every monitor. It should return any header/setup information that is needed. Definition at line 302 of file spadesserver.cpp. References mMonitorServer. |
|
This function will be called periodically to get information about the current state of the world. The format is completely determined by what the monitors will expect; no processing is done by the simulation engine |
|
Get the value of the Spades.MonitorInterval variable.
Definition at line 137 of file spadesserver.cpp. References zeitgeist::Object::GetScript(). Referenced by parseParameters(). Here is the call graph for this function: ![]() |
|
Get the value of the Spades.RunIntegratedCommserver variable.
Definition at line 127 of file spadesserver.cpp. References zeitgeist::Object::GetScript(). Referenced by parseParameters(). Here is the call graph for this function: ![]() |
|
Get the value of the Spades.SendAgentThinkTimes variable.
Definition at line 146 of file spadesserver.cpp. References zeitgeist::Object::GetScript(). Referenced by parseParameters(). Here is the call graph for this function: ![]() |
|
returns a pointer to the spades simulation engine
Definition at line 106 of file spadesserver.cpp. References mSimEngine. Referenced by oxygen::SpadesCreateSenseEvent::realizeEventWorldModel(). |
|
returns the amount of time in seconds a single simulation step corresponds to.
Definition at line 112 of file spadesserver.cpp. References mTimePerStep. Referenced by oxygen::SpadesCreateSenseEvent::createSense(), pauseModeCallback(), and oxygen::SpadesCreateSenseEvent::realizeEventWorldModel(). |
|
Most of the real initialization/finalization work should be done here. We do this so that the SimEngine can initialize after this class is created.
|
|
Called every time a comm server connects. Usually, this can be ignored as the WorldModel does not need to know when and how many commservers connect, unless it wants to do it's own load balancing |
|
Called every time a comm server dsiconnects. Usually, this can be ignored as the WorldModel does not need to know when and how many commservers connect, unless it wants to do it's own load balancing |
|
set up GameControlServer and MonitorServer reference
Reimplemented from zeitgeist::Leaf. Definition at line 67 of file spadesserver.cpp. References zeitgeist::Object::GetCore(), zeitgeist::Object::GetLog(), mGameControlServer, mMonitorServer, mSceneServer, and mTimePerStep. Here is the call graph for this function: ![]() |
|
reset GameControlServer and MonitorServer reference
Reimplemented from zeitgeist::Leaf. Definition at line 98 of file spadesserver.cpp. References mGameControlServer, mMonitorServer, and mSceneServer. |
|
This function parses the action string received from the agents Note that this method is const! parsing the act can *not* affect the world at all, since this could then violate causality. Also, at some point this functionality may be moved to the communication server (which manages communication with the agents) |
|
If a monitor sends information to the world model, this function is called to process it. Note that only the data section of the message (not the ID part which indicates that it is a message for the world model and not the simulation engine) is included here. If you need to keep the data, you must copy it Definition at line 324 of file spadesserver.cpp. References mMonitorServer. |
|
You probably want to inherit some parameters from EngineParam and use that to parse the commandline. See the ParamReader class. Definition at line 216 of file spadesserver.cpp. References zeitgeist::Object::GetCore(), GetMonitorInterval(), GetRunIntegratedCommserver(), GetSendAgentThinkTimes(), and mParamReader. Here is the call graph for this function: ![]() |
|
When the simulation is paused, this is called peridically At some point, this function should unpause the simulation The simulation starts out in paused mode.
Definition at line 374 of file spadesserver.cpp. References GetCommServersWanted(), zeitgeist::Object::GetLog(), GetTimePerStep(), mAgentQueue, mGameControlServer, mNewSimulationMode, mNextInitialCreateSense, mOffsetCreateSense, mSimEngine, mSimulationModeChanged, StartAgents(), and Unpause(). Here is the call graph for this function: ![]() |
|
queue up agents to be started.
Definition at line 208 of file spadesserver.cpp. References mAgentQueue. |
|
This function should advance the world forward. Events can be enqueed from this function. The time does *not* have to advance all the way to the time_desired, and if you put events in the queue, you should not advance past the time of those events. The simulation time here is an integer type, so the SpadesServer has to know how big a simulation step is.
|
|
Start up a number of agents of a given type.
Definition at line 162 of file spadesserver.cpp. References zeitgeist::Object::GetLog(), oxygen::SpadesServer::AgentItem::mAgentType, oxygen::SpadesServer::AgentItem::mNumber, and mSimEngine. Referenced by pauseModeCallback(). Here is the call graph for this function: ![]() |
|
set simulation mode to normal
Definition at line 201 of file spadesserver.cpp. References mNewSimulationMode, and mSimulationModeChanged. Referenced by pauseModeCallback(). |
|
update cached variables
Reimplemented from zeitgeist::Node. Definition at line 496 of file spadesserver.cpp. References zeitgeist::Object::GetScript(), and mTimePerStep. Here is the call graph for this function: ![]() |
|
a queue of agents to be started up
Definition at line 250 of file spadesserver.h. Referenced by pauseModeCallback(), and QueueAgents(). |
|
a cached reference to the GameControlServer
Definition at line 266 of file spadesserver.h. Referenced by GetGameControlServer(), OnLink(), OnUnlink(), and pauseModeCallback(). |
|
a cached reference to the monitor server
Definition at line 263 of file spadesserver.h. Referenced by getMonitorHeaderInfo(), OnLink(), OnUnlink(), and parseMonitorMessage(). |
|
the next simulation mode for a mode change
Definition at line 247 of file spadesserver.h. Referenced by pauseModeCallback(), and Unpause(). |
|
the initial CreateSenseEvent simTime scheduled for the next connecing agent
Definition at line 260 of file spadesserver.h. Referenced by pauseModeCallback(). |
|
the simTime offset in the scheduled times for the agents CreateSenseEvent
Definition at line 255 of file spadesserver.h. Referenced by pauseModeCallback(). |
|
our commandline parser
Definition at line 241 of file spadesserver.h. Referenced by parseParameters(). |
|
a cached reference to the SceneServer
Definition at line 269 of file spadesserver.h. Referenced by OnLink(), and OnUnlink(). |
|
the Spades simulation engine
Definition at line 238 of file spadesserver.h. Referenced by GetSimEngine(), pauseModeCallback(), and StartAgents(). |
|
flag if there is a simulation mode change scheduled
Definition at line 244 of file spadesserver.h. Referenced by pauseModeCallback(), and Unpause(). |
|
the cached Spades.TimePerStep value
Definition at line 272 of file spadesserver.h. Referenced by GetTimePerStep(), OnLink(), and UpdateCached(). |