LRAUV  revA
SimDaemon.h
Go to the documentation of this file.
1 
9 #ifndef SIMDAEMON_H_
10 #define SIMDAEMON_H_
11 
12 #include "io/SocketServer.h"
13 
14 #include "utils/FastMap.h"
15 #include "utils/Mutex.h"
16 #include "utils/Str.h"
17 
18 class EnvSimulator;
19 
28 class SimDaemon
29 {
30 public:
31  //static const int SOCKET_SERVER_PORT = 54324;
32  static const int SOCKET_SERVER_PORT = SIMPORT;
33 
34  SimDaemon( bool debug );
35  virtual ~SimDaemon();
36  void run() throw( SocketException& );
37 
54  static void Daemonize( bool hideOutputs );
55 
56 private:
57  // Note that the copy constructor below is private and not given a body.
58  // Any attempt to call it will return a compiler error.
59  SimDaemon( const SimDaemon& old ); // disallow copy constructor
60 
61  static bool Debug_;
62  static bool Shutdown_;
65  static FastMap<uint64_t, EnvSimulator*> SimulatorMap_;
66  static void* ServiceClient( void* clientSocketPtr );
67 
68 };
69 
70 #endif /*SIMDAEMON_H_*/
SocketServer * socketServer_
Definition: SimDaemon.h:64
static bool Shutdown_
Definition: SimDaemon.h:62
Definition: SocketException.h:6
Simple class for providing key-pointer mappings.
Definition: Slate.h:44
static const int SOCKET_SERVER_PORT
Definition: SimDaemon.h:32
Combines a EnvSimulator with a SocketServer to provide either remote, or out-of-process simulation...
Definition: SimDaemon.h:28
static Mutex ShutdownMutex_
Definition: SimDaemon.h:63
A simple pthread Mutex abstraction.
Definition: Mutex.h:20
Contains the SocketServer class declaration.
virtual ~SimDaemon()
Definition: SimDaemon.cpp:100
static void Daemonize(bool hideOutputs)
Code borrowed from http://www-theorie.physik.unizh.ch/~dpotter/howto/daemonize.
Definition: SimDaemon.cpp:115
static void * ServiceClient(void *clientSocketPtr)
Definition: SimDaemon.cpp:171
void run()
Definition: SimDaemon.cpp:52
Contains the Mutex, ThreadCondition, and MutexLocker class declarations.
Implements a listening Socket server.
Definition: SocketServer.h:19
Contains the FastMap class declaration.
SimDaemon(bool debug)
Definition: SimDaemon.cpp:47
The EnvSimulator adds lookup of environmental parameters to the base Simulator class.
Definition: EnvSimulator.h:21
static bool Debug_
Definition: SimDaemon.h:61
const int SIMPORT
Definition: Socket.h:24
static FastMap< uint64_t, EnvSimulator * > SimulatorMap_
Definition: SimDaemon.h:65