Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

DALT_Server::DALTServer Class Reference

This class handles incoming SOAP request and dispatches them accordingly to the relevant classes methods, after decoding the SOAP payload and re-encoding it in a more 'friendly' format. More...

#include <dalt_server.h>

Inheritance diagram for DALT_Server::DALTServer:

Inheritance graph
[legend]
Collaboration diagram for DALT_Server::DALTServer:

Collaboration graph
[legend]
List of all members.

Public Methods

 DALTServer ()
 DALTServer (string map_file)
virtual ~DALTServer ()
virtual void stepSimulation ()
virtual void allocateEntity (Entity &entity)
virtual bool entitiesLeft ()
virtual bool isIdle ()
virtual void serverCycle ()=0
void setMapFile (string map_file)
virtual void soap_scanSense (const SOAPMethod &request, SOAPMethod &response)=0
virtual void soap_actionRequest (const SOAPMethod &request, SOAPMethod &response)
virtual void soap_cycleComplete (const SOAPMethod &request, SOAPMethod &response)
virtual void soap_stateChange (const SOAPMethod &request, SOAPMethod &response)
virtual void soap_getMapSize (const SOAPMethod &request, SOAPMethod &response)
virtual void soap_getMapState (const SOAPMethod &request, SOAPMethod &response)
virtual void soap_sayHello (const SOAPMethod &request, SOAPMethod &response)
virtual void soap_stepSimulation (const SOAPMethod &request, SOAPMethod &response)
virtual void soap_getDelta (const SOAPMethod &request, SOAPMethod &response)
virtual void soap_isIdle (const SOAPMethod &request, SOAPMethod &response)
virtual void soap_registerClient (const SOAPMethod &request, SOAPMethod &response)
virtual void soap_abort (const SOAPMethod &request, SOAPMethod &response)

Protected Types

typedef void (DALTServer::* HandlerFunction )(const SOAPMethod &request, SOAPMethod &response)
enum  simulationStatus { preparing, paused, running }

Protected Attributes

WorldMapwm
ClientManagerclient_manager
ActionArbitrageaction_arbitrage
int time_frame
simulationStatus simulation_status
map<int, Client*> entity_dictionary
bool server_cycle_done
RunTimeInfo rti
string map_file

Detailed Description

This class handles incoming SOAP request and dispatches them accordingly to the relevant classes methods, after decoding the SOAP payload and re-encoding it in a more 'friendly' format.

This class is a virtual class. You will need to overload the soap_scanSense and soap_actionRequest methods in order to use this class. The behaviour of the server can be further modified by overloading the other available methods

The class also acts as a top-level simulation manager

Author:
Vlad Mereuta


Member Typedef Documentation

typedef void(DALTServer::* DALT_Server::DALTServer::HandlerFunction)(const SOAPMethod &request, SOAPMethod &response) [protected]
 

type defined to enable the extended classes to handle soap requests.


Member Enumeration Documentation

enum DALT_Server::DALTServer::simulationStatus [protected]
 

enumeration describing the current status of the simulation.

  • a simulation is preparing when there are no clients available. as soon as a client becomes available the map is loaded and the status moves to paused until the simulation is started
  • the simulation is paused when it is ran step by step and a step was completed or when the simulation has not been started yet.
  • the simulation is running at all other times
Enumeration values:
preparing  
paused  
running  


Constructor & Destructor Documentation

DALT_Server::DALTServer::DALTServer ( )
 

constructor: registers functions, allocates objects.

DALT_Server::DALTServer::DALTServer ( string map_file )
 

constructor: registers functions, allocates objects.

Parameters:
map_file   file to read the map layout from
Parameters:
map_file  

DALT_Server::DALTServer::~DALTServer ( ) [virtual]
 

destructor: de-allocates objects.


Member Function Documentation

void DALT_Server::DALTServer::allocateEntity ( Entity & entity ) [virtual]
 

allocates an entity to a client.

That is, given at the least an entity type and an entity id will get a client to create the relevant agent

Parameters:
entity   the entity to allocate
Returns:
nothing
Parameters:
entity  

bool DALT_Server::DALTServer::entitiesLeft ( ) [virtual]
 

tests whether there are entities in the simulation which are still working.

bool DALT_Server::DALTServer::isIdle ( ) [virtual]
 

tests whether the simulation is idle, waiting for a new cycle.

void DALT_Server::DALTServer::serverCycle ( ) [pure virtual]
 

the server processing cycle.

all the computation done by the server at each cycle goes here this function is called automatically when the last agent finished its cycle

Reimplemented in CAServer.

void DALT_Server::DALTServer::setMapFile ( string map_file ) [inline]
 

sets the filename from which the map is to be read.

Parameters:
map_file   file containing the map
Parameters:
map_file  

void DALT_Server::DALTServer::soap_abort ( const SOAPMethod & request,
SOAPMethod & response ) [virtual]
 

causes the server to abort its execution.

this method does not clean up after itself, it just calls exit(0)

Parameters:
request  
response  

void DALT_Server::DALTServer::soap_actionRequest ( const SOAPMethod & request,
SOAPMethod & response ) [virtual]
 

process an action request from an entity.This method needs to be defined in any derived class.

Parameters:
request  
response  

void DALT_Server::DALTServer::soap_cycleComplete ( const SOAPMethod & request,
SOAPMethod & response ) [virtual]
 

called by agents when completing their cycle.

Parameters:
request  
response  

void DALT_Server::DALTServer::soap_getDelta ( const SOAPMethod & request,
SOAPMethod & response ) [virtual]
 

returns the rezults of the last simulation cycle.

Parameters:
request  
response  

void DALT_Server::DALTServer::soap_getMapSize ( const SOAPMethod & request,
SOAPMethod & response ) [virtual]
 

returns the map size in a vector (should be used by the observer to set the initial view dimensions.

Parameters:
request  
response  

void DALT_Server::DALTServer::soap_getMapState ( const SOAPMethod & request,
SOAPMethod & response ) [virtual]
 

returns the state of the map as an array of entites, without making any changes.

Parameters:
request  
response  

void DALT_Server::DALTServer::soap_isIdle ( const SOAPMethod & request,
SOAPMethod & response ) [virtual]
 

returns 0 if there are entities still processing and 1 otherwise.

Parameters:
request  
response  

void DALT_Server::DALTServer::soap_registerClient ( const SOAPMethod & request,
SOAPMethod & response ) [virtual]
 

register a client.

Parameters:
request  
response  

void DALT_Server::DALTServer::soap_sayHello ( const SOAPMethod & request,
SOAPMethod & response ) [virtual]
 

test method for SOAP RMI.

Parameters:
request  
response  

void DALT_Server::DALTServer::soap_scanSense ( const SOAPMethod & request,
SOAPMethod & response ) [pure virtual]
 

scan a given sense for a given entity.

This method needs to be defined in any derived class

Parameters:
request  
response  

Reimplemented in CAServer.

void DALT_Server::DALTServer::soap_stateChange ( const SOAPMethod & request,
SOAPMethod & response ) [virtual]
 

handles state change notifications.

Parameters:
request  
response  

void DALT_Server::DALTServer::soap_stepSimulation ( const SOAPMethod & request,
SOAPMethod & response ) [virtual]
 

attempts to run a step of the simulation and return 0 or a positive value depending on whether a new cycle was started.

Parameters:
request  
response  

void DALT_Server::DALTServer::stepSimulation ( ) [virtual]
 

executes a step of the simulation.


Member Data Documentation

ActionArbitrage * DALT_Server::DALTServer::action_arbitrage [protected]
 

manages the action queue.

ClientManager * DALT_Server::DALTServer::client_manager [protected]
 

manages client allocation, workload distrubution.

map< int, Client *> DALT_Server::DALTServer::entity_dictionary [protected]
 

this map keeps a a relation in between each entity id and a client. This can be used to trace the client running each agent.

string DALT_Server::DALTServer::map_file [protected]
 

the file containing the map layout.

RunTimeInfo DALT_Server::DALTServer::rti [protected]
 

time information.

bool DALT_Server::DALTServer::server_cycle_done [protected]
 

this flag signals whether the server did its processing for the current cycle (this is optional).

simulationStatus DALT_Server::DALTServer::simulation_status [protected]
 

current status of the simulation.

int DALT_Server::DALTServer::time_frame [protected]
 

current time frame.

WorldMap * DALT_Server::DALTServer::wm [protected]
 

Holds the simulation map.


The documentation for this class was generated from the following file:
Generated at Thu Jan 31 15:22:41 2002 for DALT Server by doxygen1.2.8 written by Dimitri van Heesch, © 1997-2001