VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vrfDebugDrawConnector.h
Go to the documentation of this file.
1 
9 
10 
11 #pragma once
12 
17 
18 #include <vlutil/vlInetTcpSocket.h>
19 
20 #include <list>
21 #include <string>
22 
23 class DtThread;
24 
25 namespace makVrf
26 {
28  const int DtDisplayPort = 4580;
29 
30  class DtBaseMessage;
31 
32  template <typename Ret, typename Param0>
33  class DtDelegate;
34 
38  {
39  public:
42 
45  virtual ~DtDebugDrawConnector();
46 
50  virtual void connect(const std::string& address, int port = DtDisplayPort, const std::string& simAddress = "", bool attemptRetry=true);
51 
53  virtual void disconnect();
54 
56  virtual bool isOk();
57 
59  virtual void tick();
60 
63  virtual void sendMessage(DtBaseMessage& request);
64 
68  virtual DtMessageHandler& messageHandler() {return myMessageHandler;}
69 
71  virtual void addConnectedCallback(const DtConnectionDelegate& delegate);
73  virtual void removeConnectedCallback(const DtConnectionDelegate& delegate);
74 
76  virtual void addDisconnectedCallback(const DtConnectionDelegate& delegate);
78  virtual void removeDisconnectedCallback(const DtConnectionDelegate& delegate);
79 
82  virtual DtMessageFactory& messageFactory() { return myMessageFactory; }
83 
86  virtual unsigned int nextId();
87 
90  virtual std::string& requesterName();
91 
93  static double defaultRetryTimeout();
95  static void setDefaultRetryTimeout(double val);
96 
98  static double defaultHeartbeatTimeout();
100  static void setDefaultHeatbeatTimeout(double val);
101 
102  protected:
103  DtInetAddr findFirstNetworkDeviceAddress(bool& found) const;
104 
106 
107  std::list<DtConnectionDelegate> myConnectionCallbacks;
108  std::list<DtConnectionDelegate> myDisconnectionCallbacks;
109 
111  unsigned int myNextId;
112  std::string myRequestorName;
113 
116  DtThread* myWorkerThread;
117  DtInetTcpSocket* mySocket;
118 
121  std::string myAddress;
122  std::string mySimAddress;
123  int myPort;
124 
125  static void workerFunction(void* data, volatile bool* stop);
127 
129  static double theDefaultRetryTimeout;
130  };
131 }
#define DT_DLL_DEBUGDRAWCONNECTOR
Definition: export.h:15
The DtDebugDrawConnector class manages the connection with the server and provides and interface to s...
Definition: vrfDebugDrawConnector.h:37
int myPort
Definition: vrfDebugDrawConnector.h:123
unsigned int myNextId
Definition: vrfDebugDrawConnector.h:111
virtual DtMessageFactory & messageFactory()
Gets the message factory for all messages. The user can add new message decoders to this factory...
Definition: vrfDebugDrawConnector.h:82
DtBaseMessage is the base class for all messages that can be sent between the server and the client...
Definition: vrfMessage.h:25
static double theDefaultHeatbeatTimeout
Definition: vrfDebugDrawConnector.h:128
DtLocklessQueue< DtBaseMessage * > myIncomingQueue
Definition: vrfDebugDrawConnector.h:115
Delegate template for binding static or member functions for callback at later time The return type a...
Definition: delegate.h:115
static double theDefaultRetryTimeout
Definition: vrfDebugDrawConnector.h:129
std::list< DtConnectionDelegate > myDisconnectionCallbacks
Definition: vrfDebugDrawConnector.h:108
std::string myAddress
Definition: vrfDebugDrawConnector.h:121
DtMessageFactory myMessageFactory
Definition: vrfDebugDrawConnector.h:110
DtThread * myWorkerThread
Definition: vrfDebugDrawConnector.h:116
virtual DtMessageHandler & messageHandler()
Get the message handler the connector is using to dispatch messages when they arrive users will regis...
Definition: vrfDebugDrawConnector.h:68
DtDelegate< void, DtDebugDrawConnector * > DtConnectionDelegate
Connection callback definition.
Definition: vrfDebugDrawConnector.h:41
Defines a message factory for creating DtBaseMessage classes from an array of bytes.
DtMessageHandler myMessageHandler
Definition: vrfDebugDrawConnector.h:105
std::string myRequestorName
Definition: vrfDebugDrawConnector.h:112
Defines a class for storing message delegates.
bool myShouldQuit
Definition: vrfDebugDrawConnector.h:126
bool myShouldRetryConnect
Definition: vrfDebugDrawConnector.h:119
double myRetryTimeout
Definition: vrfDebugDrawConnector.h:120
const int DtDisplayPort
the default port the server application is listening on
Definition: vrfDebugDrawConnector.h:28
DtLocklessQueue< DtBaseMessage * > myOutgoingQueue
Definition: vrfDebugDrawConnector.h:114
std::string mySimAddress
Definition: vrfDebugDrawConnector.h:122
the DtMessageFactory class
Definition: vrfMessageFactory.h:26
DtLocklessQueue is a thread safe queue for single reader/single writer. It may block if the queue fil...
Definition: locklessQueue.h:20
DtMessageHandler manages message delegates. More than one delegate may be registered for a given mess...
Definition: vrfMessageHandler.h:27
std::list< DtConnectionDelegate > myConnectionCallbacks
Definition: vrfDebugDrawConnector.h:107
DtInetTcpSocket * mySocket
Definition: vrfDebugDrawConnector.h:117

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)