VR-Forces 4.8 Class Documentation
 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 DtExerciseConnection;
24 class DtThread;
25 
26 namespace makVrf
27 {
29  const int DtDisplayPort = 4567;
30 
31  class DtBaseMessage;
32 
33  template <typename Ret, typename Param0>
34  class DtDelegate;
35 
39  {
40  public:
43 
46  virtual ~DtDebugDrawConnector();
47 
51  virtual void connect(const std::string& address, int port = DtDisplayPort, const std::string& simAddress = "", bool attemptRetry=true);
52 
54  virtual void disconnect();
55 
57  virtual bool isOk();
58 
60  virtual void tick();
61 
64  virtual void sendMessage(DtBaseMessage& request);
65 
69  virtual DtMessageHandler& messageHandler() {return myMessageHandler;}
70 
72  virtual void addConnectedCallback(const DtConnectionDelegate& delegate);
74  virtual void removeConnectedCallback(const DtConnectionDelegate& delegate);
75 
77  virtual void addDisconnectedCallback(const DtConnectionDelegate& delegate);
79  virtual void removeDisconnectedCallback(const DtConnectionDelegate& delegate);
80 
83  virtual DtMessageFactory& messageFactory() { return myMessageFactory; }
84 
87  virtual unsigned int nextId();
88 
91  virtual std::string& requesterName();
92 
94  static double defaultRetryTimeout();
96  static void setDefaultRetryTimeout(double val);
97 
99  static double defaultHeartbeatTimeout();
101  static void setDefaultHeatbeatTimeout(double val);
102 
103  protected:
104  DtInetAddr findFirstNetworkDeviceAddress(bool& found) const;
105 
107 
108  std::list<DtConnectionDelegate> myConnectionCallbacks;
109  std::list<DtConnectionDelegate> myDisconnectionCallbacks;
110 
112  unsigned int myNextId;
113  std::string myRequestorName;
114 
117  DtThread* myWorkerThread;
118  DtInetTcpSocket* mySocket;
119 
122  std::string myAddress;
123  std::string mySimAddress;
124  int myPort;
125 
126  static void workerFunction(void* data, volatile bool* stop);
128 
130  static double theDefaultRetryTimeout;
131  };
132 }
#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:38
int myPort
Definition: vrfDebugDrawConnector.h:124
unsigned int myNextId
Definition: vrfDebugDrawConnector.h:112
virtual DtMessageFactory & messageFactory()
Gets the message factory for all messages.
Definition: vrfDebugDrawConnector.h:83
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:129
DtLocklessQueue< DtBaseMessage * > myIncomingQueue
Definition: vrfDebugDrawConnector.h:116
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:130
std::list< DtConnectionDelegate > myDisconnectionCallbacks
Definition: vrfDebugDrawConnector.h:109
std::string myAddress
Definition: vrfDebugDrawConnector.h:122
DtMessageFactory myMessageFactory
Definition: vrfDebugDrawConnector.h:111
DtThread * myWorkerThread
Definition: vrfDebugDrawConnector.h:117
virtual DtMessageHandler & messageHandler()
Get the message handler the connector is using to dispatch messages when they arrive users will regis...
Definition: vrfDebugDrawConnector.h:69
DtDelegate< void, DtDebugDrawConnector * > DtConnectionDelegate
Connection callback definition.
Definition: vrfDebugDrawConnector.h:42
Defines a message factory for creating DtBaseMessage classes from an array of bytes.
DtMessageHandler myMessageHandler
Definition: vrfDebugDrawConnector.h:106
std::string myRequestorName
Definition: vrfDebugDrawConnector.h:113
Defines a class for storing message delegates.
bool myShouldQuit
Definition: vrfDebugDrawConnector.h:127
bool myShouldRetryConnect
Definition: vrfDebugDrawConnector.h:120
double myRetryTimeout
Definition: vrfDebugDrawConnector.h:121
const int DtDisplayPort
the default port the server application is listening on
Definition: vrfDebugDrawConnector.h:29
DtLocklessQueue< DtBaseMessage * > myOutgoingQueue
Definition: vrfDebugDrawConnector.h:115
std::string mySimAddress
Definition: vrfDebugDrawConnector.h:123
the DtMessageFactory class
Definition: vrfMessageFactory.h:26
DtLocklessQueue is a thread safe queue for single reader/single writer.
Definition: locklessQueue.h:20
DtMessageHandler manages message delegates.
Definition: vrfMessageHandler.h:27
std::list< DtConnectionDelegate > myConnectionCallbacks
Definition: vrfDebugDrawConnector.h:108
DtInetTcpSocket * mySocket
Definition: vrfDebugDrawConnector.h:118

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)