VR-Forces 5.0.2 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;
21 
22 namespace makVrf
23 {
24  class DtStateData;
25  class DtStateDataManager;
26 }
27 
28 namespace makVrfEvents
29 {
30  class DtEvent;
31  class DtEventManager;
32 }
33 
34 class DtUUID;
36 typedef DtNetworkInterfaceManager* (*DtNetworkInterfaceManagerCreatorFcn)(makVrf::DtStateDataManager*);
37 
45 {
46 public:
47 
50 
51  virtual ~DtNetworkInterfaceManager();
52 
56  static void setNetworkInterfaceManagerCreatorFcn(DtNetworkInterfaceManagerCreatorFcn fcn);
57  static DtNetworkInterfaceManager* createNetworkInterfaceManager(makVrf::DtStateDataManager*);
59 
61  {
62  return myStateDataManager;
63  }
64 
66  virtual void beginFrame(double simTime, double dt);
67 
68  double simTime() const
69  {
70  return mySimTime;
71  }
72 
73  double dT() const
74  {
75  return myDt;
76  }
77 
79  virtual bool isConnectionless() const;
80 
83  virtual bool preAdvanceFrame();
84 
87  virtual void advanceFrame(double* networkFrameTime = nullptr);
88 
91  virtual DtString nextEventId(const DtString& = DtString::nullString());
92 
96  virtual bool insertManagerAtBeginning(DtNetworkManagerInterface*);
97 
99  virtual void setNumCallbackThreads(unsigned);
100 
102  virtual std::string protocol() const;
103 
105  virtual bool addManager(DtNetworkManagerInterface*);
106 
108  virtual void removeManager(const char*);
109 
111  virtual bool hasNetworkManager(const char*) const;
112 
114  virtual bool typeIsPublishable(const DtEntityType&) const;
115 
117  virtual DtNetworkManagerInterface* networkManagerInterface(const char*) const;
118 
120  virtual void printDataToStream(const DtUUID&, DtOutputStream&) const;
121 
123  virtual void setInterest(const DtVector& geocentricCenter, double radius);
124 
126  virtual void reserve(unsigned numToReserve);
127 
129  virtual void printReflectedObjectCounts() const;
130 
133  virtual void requestUpdatesForRemoteNonVrfObjects() const;
134 
135  virtual void setCommunicationManager(DtCommunicationManager*);
137  {
138  return myCommunicationManager;
139  }
140 
142  virtual void setEnabled(bool);
143  bool enabled() const { return myEnabled; };
144 
146  virtual const makVrf::DtStateData* stateDataForGlobalId(const DtString&) const;
147 
149  virtual void setRunFullyThreaded(bool);
150  bool runFullyThreaded() const { return myRunFullyThreaded; };
151 
153  virtual void setCoordinateSystem(const Coordinate_System*);
154 
156  virtual void setParameterDatabase(DtVrfParameterDb*);
157 
159  virtual unsigned int maxNameLengthForType(const DtObjectType&) const;
160 
162  virtual void setVrfSessionId(int);
163 
165  virtual void setVrfMessageVersionSupported(int);
167  {
168  return myVrfMessageVersionSupported;
169  }
170 
172  virtual void startScenarioLoad(bool);
173 
175  virtual void endScenarioLoad(bool);
176 
178  virtual void setFrameRateMode(const DtString& mode, double deltaTime, bool manageTime = false);
179 
181  virtual void rewindScenario();
182 
184  virtual void run();
185 
187  virtual void pause();
188 
190  virtual void setExerciseStartTime(double);
191 
193  virtual void setSimTime(double);
194 
196  virtual void setTimeMultiplier(double);
197 
199  virtual void setSiteAppId(int, int);
200  const DtSimulationAddress& simulationAddress() const
201  {
202  return mySimulationAddress;
203  }
204 
205  int numManagers() const
206  {
207  return myNetworkManagers.size();
208  }
209 
211  virtual double determineSimTime(double& dt);
212 
215  virtual void addEvent(const makVrfEvents::DtEvent&, bool& selfReflected);
216 
218  virtual void sendEvent(const makVrfEvents::DtEvent&);
219 
221  virtual void setEventManager(makVrfEvents::DtEventManager*);
222 
224  virtual void resetSimulation();
225 
227  virtual bool validateScenario(const DtScenario&, DtString& error) const;
228 
230  virtual void removeAndDeleteAll();
231 
234  virtual bool needsUnpublishedDatabase() const;
235 
237  virtual bool publishingOnLegionNetwork() const;
238 
240  virtual bool selfReflecting() const;
241 
244  virtual void setSelfReflecting(bool);
245 
247  virtual bool rediscoverObjects();
248 
249  virtual void beginBulkCreate();
250  virtual void endBulkCreate();
251 
252 public:
254  boost::signals2::signal<void (DtNetworkManagerInterface*)> signal_interfaceAdded;
255 
257  boost::signals2::signal<void (DtNetworkManagerInterface*)> signal_interfaceRemoved;
258 
259 protected:
261  virtual void slot_stateDataAdded(makVrf::DtStateData*);
262 
264  virtual void slot_stateDataAboutToBeRemoved(const makVrf::DtStateData*);
265 
267  virtual void initialize(DtNetworkManagerInterface*);
268 
269 protected:
270  std::vector<DtNetworkManagerInterface*> myNetworkManagers;
273  bool myEnabled;
279  DtSimulationAddress mySimulationAddress;
281 
282  double mySimTime;
283  double myDt;
284 
287 
291 
292  boost::signals2::scoped_connection myStateDataAddedConnection;
293  boost::signals2::scoped_connection myStateDataRemovedConnection;
294 };
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
int myVrfSessionId
Definition: networkInterfaceManager.h:277
boost::signals2::signal< void(DtNetworkManagerInterface *)> signal_interfaceAdded
Signal sent when an interface is added.
Definition: networkInterfaceManager.h:254
DtString myFrameRateMode
Definition: networkInterfaceManager.h:285
Instances of DtVrfParameterDb are the database of DtVrfObjectParameters objects used in the construct...
Definition: vrfParameterDb.h:38
DtSimulationAddress mySimulationAddress
Definition: networkInterfaceManager.h:279
Definition: scenario.h:52
std::vector< DtNetworkManagerInterface * > myNetworkManagers
Definition: networkInterfaceManager.h:270
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:283
double mySimTime
Definition: networkInterfaceManager.h:282
makVrf::DtStateDataManager * stateDataManager() const
Definition: networkInterfaceManager.h:60
bool enabled() const
Definition: networkInterfaceManager.h:143
int vrfMessageVersionSupported() const
Definition: networkInterfaceManager.h:166
double myFrameDeltaTime
Definition: networkInterfaceManager.h:286
DtVrfParameterDb * myParameterDb
Definition: networkInterfaceManager.h:276
double dT() const
Definition: networkInterfaceManager.h:73
Definition: objectType.h:27
bool runFullyThreaded() const
Definition: networkInterfaceManager.h:150
bool myOwnsCoordinateSystem
Definition: networkInterfaceManager.h:275
boost::signals2::signal< void(DtNetworkManagerInterface *)> signal_interfaceRemoved
Signal sent when an interface is removed.
Definition: networkInterfaceManager.h:257
bool myRunFullyThreaded
Definition: networkInterfaceManager.h:272
DtCommunicationManager * communicationManager()
Definition: networkInterfaceManager.h:136
DtNetworkManagerInterface is the base class which all network interfaces must be derived from...
Definition: networkManagerInterface.h:40
Definition: coordSystem.h:54
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:336
Definition: event.h:13
DtNetworkInterfaceManager *(* DtNetworkInterfaceManagerCreatorFcn)(makVrf::DtStateDataManager *)
Definition: networkInterfaceManager.h:36
bool myEnabled
Definition: networkInterfaceManager.h:273
The DtCommunicationManager class is a convenience class that will create both the DtNetworkInterfaceM...
Definition: communicationManager.h:50
boost::signals2::scoped_connection myStateDataAddedConnection
Definition: networkInterfaceManager.h:292
int numManagers() const
Definition: networkInterfaceManager.h:205
static DtNetworkInterfaceManagerCreatorFcn theNetworkInterfaceManagerCreatorFcn
Definition: networkInterfaceManager.h:289
int myVrfMessageVersionSupported
Definition: networkInterfaceManager.h:278
int myNumberOfCallbackThreads
Definition: networkInterfaceManager.h:280
Definition: asyncJobServer.h:39
const DtSimulationAddress & simulationAddress() const
Definition: networkInterfaceManager.h:200
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:44
boost::signals2::scoped_connection myStateDataRemovedConnection
Definition: networkInterfaceManager.h:293
DtCommunicationManager * myCommunicationManager
Definition: networkInterfaceManager.h:290
const char int mode
Definition: ioapi.h:38
double simTime() const
Definition: networkInterfaceManager.h:68
makVrfEvents::DtEventManager * myEventManager
Definition: networkInterfaceManager.h:288
#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:274
makVrf::DtStateDataManager * myStateDataManager
Definition: networkInterfaceManager.h:271
This class holds the state data that represents each simulation object in the system.
Definition: stateDataManager.h:71

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)