VR-Vantage 3.2 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 }


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