VR-Vantage 3.1.1 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rfxServer.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <radarFxServer/export.h>
13 
16 
17 #include <map>
18 #include <string>
20 
21 class DtThread;
22 class DtInetSocket;
23 class DtInetTcpSocket;
24 class DtInetSocketMgr;
25 
26 namespace makVrv
27 {
28  class DtDe;
29 }
30 
31 namespace makRadarFx
32 {
33  class DtRadarFxDriver;
34 
35  //default port
36  const int DtRadarFXPort = 4567;
37 
40  {
41  public:
42  //CTOR/DTOR
43  DtRadarFxServer(DtRadarFxDriver& driver, int port = 4567, bool allowMultiple=false);
44  virtual ~DtRadarFxServer();
45 
47  virtual void initializeServer();
48  virtual void shutdownServer();
49 
52  virtual void setPort(int port);
53 
55  virtual int port() const;
56 
60  virtual void sendMessage(DtBaseMessage& request);
61 
63  virtual DtBaseMessage* nextMessage();
64 
65  static double defaultHeartbeatTimeout();
66  static void setDefaultHeatbeatTimeout(double val);
67 
68  protected:
70  virtual bool handleSocketAddition(DtInetSocket* socket);
71  virtual bool handleSocketRemoval(DtInetSocket* socket);
72 
75  static bool socketAdditionCallback(DtInetSocket* sock, void* usr);
76  static bool socketRemovalCallback(DtInetSocket* sock, void* usr);
77 
79 
82  DtInetSocketMgr* mySocketManager;
83  int myPort;
84 
86 
88  static void workerFunction(void* usr, volatile bool* stop);
89  DtThread* myWorkerThread;
91 
93 
94  typedef std::map<std::string, DtInetTcpSocket*> ClientRequestMap;
96 
97  typedef std::list<DtInetTcpSocket*> ClientSocketList;
99  };
100 
103  {
104  public:
107  static DtRadarFxServerCreator& instance(makVrv::DtDe& de);
108 
110  static void registerInstance(makVrv::DtDe& de, DtRadarFxServerCreator* instance);
111 
113  virtual DtRadarFxServer* create(DtRadarFxDriver& driver,
114  int port = 4567, bool allowMultiple=false);
115  };
116 
117 }
bool myAllowMultipleClients
Definition: rfxServer.h:85
Virtual base class.
Definition: DtVirtualBaseClass.h:19
DtRadarFxDriver & myDriver
Definition: rfxServer.h:78
DtBaseMessage is the base class for all messages that can be sent between the server and the client...
Definition: rfxMessage.h:25
DtLocklessQueue is a thread safe queue for single reader/single writer.
Definition: locklessQueue.h:20
DtInetSocketMgr * mySocketManager
Definition: rfxServer.h:82
DtLocklessQueue< DtBaseMessage * > myIncomingQueue
Definition: rfxServer.h:81
ClientSocketList myClientSockets
Definition: rfxServer.h:98
the DtRadarFxServer is the network server for receving and sending messages to attached clients...
Definition: rfxServer.h:39
std::map< std::string, DtInetTcpSocket * > ClientRequestMap
Definition: rfxServer.h:94
DtRadarFxDriver is the main class that controls the processing flow of the RadarFX Server...
Definition: rfxDriver.h:28
int myPort
Definition: rfxServer.h:83
DtProcessFactory manages the creation of message processors.
Definition: rfxServer.h:102
Contains makVrv::DtVirtualBaseClass class.
ClientRequestMap myClientRequestMap
Definition: rfxServer.h:95
const int DtRadarFXPort
the default port the Radar FX server is listening on
Definition: radarFxConnector.h:30
DtLocklessQueue< DtBaseMessage * > myOutgoingQueue
Definition: rfxServer.h:80
bool myShouldQuit
Definition: rfxServer.h:90
#define DT_DLL_RFXSERVER
Definition: include/radarFxServer/export.h:15
Defines the base class for all messages that can be sent between the server and the client...
static double theDefaultHeatbeatTimeout
Definition: rfxServer.h:92
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:72
std::list< DtInetTcpSocket * > ClientSocketList
Definition: rfxServer.h:97
DtThread * myWorkerThread
Definition: rfxServer.h:89


Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)