VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
networkInterfaceManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
10 #include "vlpi/simulationAddress.h"
11 #include <boost/signals2.hpp>
12 #include <vlutil/vlPrint.h>
13 
16 class DtEntityType;
17 class Coordinate_System;
18 class DtVrfParameterDb;
19 class DtScenario;
20 class DtObjectType;
22 
23 namespace makVrf
24 {
25  class DtStateData;
26  class DtStateDataManager;
27 }
28 
29 namespace makVrfEvents
30 {
31  class DtEvent;
32  class DtEventManager;
33 }
34 
35 class DtUUID;
37 typedef DtNetworkInterfaceManager* (*DtNetworkInterfaceManagerCreatorFcn)(makVrf::DtStateDataManager*);
38 
46 {
47 public:
48 
51 
52  virtual ~DtNetworkInterfaceManager();
53 
57  static void setNetworkInterfaceManagerCreatorFcn(DtNetworkInterfaceManagerCreatorFcn fcn);
58  static DtNetworkInterfaceManager* createNetworkInterfaceManager(makVrf::DtStateDataManager*);
60 
62  {
63  return myStateDataManager;
64  }
65 
67  virtual void beginFrame(double simTime, double dt);
68 
69  double simTime() const
70  {
71  return mySimTime;
72  }
73 
74  double dT() const
75  {
76  return myDt;
77  }
78 
80  virtual bool isConnectionless() const;
81 
84  virtual bool preAdvanceFrame();
85 
88  virtual void advanceFrame(double* networkFrameTime = nullptr);
89 
92  virtual DtString nextEventId(const DtString& = DtString::nullString());
93 
97  virtual bool insertManagerAtBeginning(DtNetworkManagerInterface*);
98 
100  virtual void setNumCallbackThreads(unsigned);
101 
103  virtual std::string protocol() const;
104 
106  virtual bool addManager(DtNetworkManagerInterface*);
107 
109  virtual void removeManager(const char*);
110 
112  virtual bool hasNetworkManager(const char*) const;
113 
115  virtual bool typeIsPublishable(const DtEntityType&) const;
116 
118  virtual DtNetworkManagerInterface* networkManagerInterface(const char*) const;
119 
121  virtual void printDataToStream(const DtUUID&, DtOutputStream&) const;
122 
124  virtual void setInterest(const DtVector& geocentricCenter, double radius);
125 
127  virtual void reserve(unsigned numToReserve);
128 
130  virtual void printReflectedObjectCounts() const;
131 
134  virtual void requestUpdatesForRemoteNonVrfObjects() const;
135 
136  virtual void setCommunicationManager(DtCommunicationManager*);
138  {
139  return myCommunicationManager;
140  }
141 
143  virtual void setEnabled(bool);
144  bool enabled() const { return myEnabled; };
145 
147  virtual const makVrf::DtStateData* stateDataForGlobalId(const DtString&) const;
148 
150  virtual void setRunFullyThreaded(bool);
151  bool runFullyThreaded() const { return myRunFullyThreaded; };
152 
154  virtual void setCoordinateSystem(const Coordinate_System*);
155 
157  virtual void setParameterDatabase(DtVrfParameterDb*);
158 
160  virtual unsigned int maxNameLengthForType(const DtObjectType&) const;
161 
163  virtual void setVrfSessionId(int);
164 
166  virtual void setVrfMessageVersionSupported(int);
168  {
169  return myVrfMessageVersionSupported;
170  }
171 
173  virtual void startScenarioLoad(bool);
174 
176  virtual void endScenarioLoad(bool);
177 
179  virtual void setFrameRateMode(const DtString& mode, double deltaTime, bool manageTime = false);
180 
182  virtual void rewindScenario();
183 
185  virtual void run();
186 
188  virtual void pause();
189 
191  virtual void setExerciseStartTime(double);
192 
194  virtual void setSimTime(double);
195 
197  virtual void setTimeMultiplier(double);
198 
200  virtual void setSiteAppId(int, int);
201  const DtSimulationAddress& simulationAddress() const
202  {
203  return mySimulationAddress;
204  }
205 
206  int numManagers() const
207  {
208  return myNetworkManagers.size();
209  }
210 
212  virtual double determineSimTime(double& dt, DtCommunicationManagerPerformanceTimerInformation* performanceTimerInformation = nullptr);
213 
216  virtual void addEvent(const makVrfEvents::DtEvent&, bool& selfReflected);
217 
219  virtual void sendEvent(const makVrfEvents::DtEvent&);
220 
222  virtual void setEventManager(makVrfEvents::DtEventManager*);
223 
225  virtual void resetSimulation();
226 
228  virtual bool validateScenario(const DtScenario&, DtString& error) const;
229 
231  virtual void removeAndDeleteAll();
232 
235  virtual bool needsUnpublishedDatabase() const;
236 
238  virtual bool publishingOnLegionNetwork() const;
239 
241  virtual bool selfReflecting() const;
242 
245  virtual void setSelfReflecting(bool);
246 
248  virtual bool rediscoverObjects();
249 
250  virtual void beginBulkCreate();
251  virtual void endBulkCreate();
252 
254  virtual void reserveEntityId(const DtEntityIdentifier&);
255 
256 public:
258  boost::signals2::signal<void (DtNetworkManagerInterface*)> signal_interfaceAdded;
259 
261  boost::signals2::signal<void (DtNetworkManagerInterface*)> signal_interfaceRemoved;
262 
263 protected:
265  virtual void slot_stateDataAdded(makVrf::DtStateData*);
266 
268  virtual void slot_stateDataAboutToBeRemoved(const makVrf::DtStateData*);
269 
271  virtual void initialize(DtNetworkManagerInterface*);
272 
273 protected:
274  std::vector<DtNetworkManagerInterface*> myNetworkManagers;
277  bool myEnabled;
283  DtSimulationAddress mySimulationAddress;
285 
286  double mySimTime;
287  double myDt;
288 
291 
295 
296  boost::signals2::scoped_connection myStateDataAddedConnection;
297  boost::signals2::scoped_connection myStateDataRemovedConnection;
298 };
UUID is a unique ID wrapper class.
Definition: uuid.h:59
int myVrfSessionId
Definition: networkInterfaceManager.h:281
boost::signals2::signal< void(DtNetworkManagerInterface *)> signal_interfaceAdded
Signal sent when an interface is added.
Definition: networkInterfaceManager.h:258
DtString myFrameRateMode
Definition: networkInterfaceManager.h:289
Instances of DtVrfParameterDb are the database of DtVrfObjectParameters objects used in the construct...
Definition: vrfParameterDb.h:40
DtSimulationAddress mySimulationAddress
Definition: networkInterfaceManager.h:283
Definition: scenario.h:52
std::vector< DtNetworkManagerInterface * > myNetworkManagers
Definition: networkInterfaceManager.h:274
The DtEventManager handles the sending and receipt of system events (fire, detonate, command, etc). It provides a thread-safe way for the sim engine to send and receive such events, between both components within this sim engine and other remote applications.
Definition: eventManager.h:33
double myDt
Definition: networkInterfaceManager.h:287
double mySimTime
Definition: networkInterfaceManager.h:286
makVrf::DtStateDataManager * stateDataManager() const
Definition: networkInterfaceManager.h:61
bool enabled() const
Definition: networkInterfaceManager.h:144
int vrfMessageVersionSupported() const
Definition: networkInterfaceManager.h:167
double myFrameDeltaTime
Definition: networkInterfaceManager.h:290
DtVrfParameterDb * myParameterDb
Definition: networkInterfaceManager.h:280
double dT() const
Definition: networkInterfaceManager.h:74
Definition: objectType.h:27
bool runFullyThreaded() const
Definition: networkInterfaceManager.h:151
bool myOwnsCoordinateSystem
Definition: networkInterfaceManager.h:279
boost::signals2::signal< void(DtNetworkManagerInterface *)> signal_interfaceRemoved
Signal sent when an interface is removed.
Definition: networkInterfaceManager.h:261
Definition: communicationManager.h:35
bool myRunFullyThreaded
Definition: networkInterfaceManager.h:276
DtCommunicationManager * communicationManager()
Definition: networkInterfaceManager.h:137
DtNetworkManagerInterface is the base class which all network interfaces must be derived from...
Definition: networkManagerInterface.h:42
Definition: coordSystem.h:54
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:339
Definition: event.h:13
DtNetworkInterfaceManager *(* DtNetworkInterfaceManagerCreatorFcn)(makVrf::DtStateDataManager *)
Definition: networkInterfaceManager.h:37
bool myEnabled
Definition: networkInterfaceManager.h:277
The DtCommunicationManager class is a convenience class that will create both the DtNetworkInterfaceM...
Definition: communicationManager.h:51
boost::signals2::scoped_connection myStateDataAddedConnection
Definition: networkInterfaceManager.h:296
int numManagers() const
Definition: networkInterfaceManager.h:206
static DtNetworkInterfaceManagerCreatorFcn theNetworkInterfaceManagerCreatorFcn
Definition: networkInterfaceManager.h:293
int myVrfMessageVersionSupported
Definition: networkInterfaceManager.h:282
int myNumberOfCallbackThreads
Definition: networkInterfaceManager.h:284
Definition: asyncJobServer.h:39
const DtSimulationAddress & simulationAddress() const
Definition: networkInterfaceManager.h:201
The DtNetworkInterfaceManager manages all network interfaces utilized by the sim engine. Often there is only one, but it is possible for there to be multiple. Each network interface is an instance of a subclass of DtNetworkManagerInterface. As state data is created or removed, the DtNetworkInterfaceManager will notify each of its network interfaces, so that they may create object network interfaces to output required state data to the network.
Definition: networkInterfaceManager.h:45
boost::signals2::scoped_connection myStateDataRemovedConnection
Definition: networkInterfaceManager.h:297
DtCommunicationManager * myCommunicationManager
Definition: networkInterfaceManager.h:294
const char int mode
Definition: ioapi.h:38
double simTime() const
Definition: networkInterfaceManager.h:69
makVrfEvents::DtEventManager * myEventManager
Definition: networkInterfaceManager.h:292
#define DT_DLL_vrfMsgTransport
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfCommunicationManagerDefines.h:26
const Coordinate_System * myCoordinateSystem
Definition: networkInterfaceManager.h:278
makVrf::DtStateDataManager * myStateDataManager
Definition: networkInterfaceManager.h:275
This class holds the state data that represents each simulation object in the system.
Definition: stateDataManager.h:73

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)