VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
localObjectManager.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2021 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 #pragma once
7 
11 #include <readerWriter/rwList.h>
16 #include "vrfobjcore/simObject.h"
26 #include <tbb/spin_mutex.h>
27 #include <tbb/recursive_mutex.h>
28 #include <tbb/queuing_mutex.h>
29 #include <tbb/atomic.h>
30 #include <boost/unordered_set.hpp>
31 #include <boost/signals2.hpp>
32 #include <boost/unordered_map.hpp>
33 
35 #include <vlpi/appearance.h>
36 #include <vlutil/vlFilename.h>
37 #include <vlutil/vlList.h>
38 #include <vlutil/vlHashlist.h>
39 #include <vlutil/vlConfig.h>
40 #include <vlutil/vlSmartPointers.h>
41 
43 #include <vector>
44 #include <list>
45 #include <set>
46 #include <tbb/spin_rw_mutex.h>
47 #include <tbb/spin_mutex.h>
48 #include <tbb/mutex.h>
49 #include <vrfutil/vrf4XAPI.h>
50 
52 #define DT_SINGLE_STATE_UPDATE_MESSAGE 0
53 
55 class DtRwActivities;
57 class DtVrfNameGenerator;
59 class DtVrfParameterDb;
60 class DtSimObjectSubComponentTypes;
63 class DtVertexList;
65 class DtBaseEntityStateRepository;
66 class DtSimObjectManager;
67 class DtVrfObjectManagerTickArguments;
68 class DtSimTickArguments;
69 class DtSimMessage;
71 class DtIfAggregateAs;
72 class DtLocalObjectstateRepository;
73 class DtEchelonId;
74 class Coordinate_System;
77 class DtCreateQueueEntry;
78 class DtModifyQueueEntry;
80 class DtlInputStream;
84 class DtVrfObjectTransferManager;
86 
87 namespace makVrfEvents
88 {
89  class DtEventManager;
90  class DtEvent;
91 }
92 
93 namespace makVrf
94 {
95  class DtStateData;
96  class DtStateDataManager;
97 }
98 
99 typedef std::map<DtEntityIdentifier, DtLocalObject*> DtEntityIdMap;
100 typedef std::map<DtUUID, DtLocalObject*> DtSimObjectMap;
101 
103 typedef bool (*DtSimObjectUserInitFcn)(DtLocalObject* object, void* usr);
104 
108 const int DtSimMaxForceTypes = 256;
109 
112 {
116 };
117 
120 {
122 
126 };
127 
133 
152 {
153 private:
154 
157 
160 
162  DtLocalObjectManager& operator=(const DtLocalObjectManager& orig);
163 
164 public:
165 
168 
174  virtual ~DtLocalObjectManager();
177 
179  virtual void clearRemoteComponentAttachmentSystem();
180 
182  void removeAllRemoteComponentAttachments();
183 
184  const DtSimObjectManager* simObjectManager() const;
185 
188  virtual void createRemoteComponentAttachmentManager();
189 
191  virtual bool isRemoteComponentAttachment(const DtUUID&) const;
192 
194  virtual bool initializeRemoteComponentAttachmentSystem(const DtFilename& fromFile);
195 
197  DtRemoteComponentAttachmentManager* remoteComponentAttachmentManager();
198  const DtRemoteComponentAttachmentManager* remoteComponentAttachmentManager() const;
200 
203  virtual bool init();
204 
206  virtual DtVisualMetaDataManager* visualMetaDataManager() const;
207 
210  virtual DtFilename metaDataFilename(const DtObjectType&) const;
211 
216  virtual DtRwStringAttributeList* customizedMarkingsFor(const DtObjectType&);
217 
220  virtual bool add(DtLocalObject* simObject);
221 
223  virtual bool completeObjectAddition(DtLocalObject* simObject);
224 
227  virtual bool checkAndMoveIfUniqueObject(const DtVrfLocalObjectCreateInformation&);
228 
230  virtual bool isValidState() const;
231 
234  virtual void setOwnershipTransferManager(DtOwnershipTransferManager*);
235  DtOwnershipTransferManager* ownershipTransferManager() const;
236 
237 public:
239 
244  virtual DtString generateUniqueName(int maxLength, const DtString& root = "Object") const;
247  virtual DtString nextNameWithPrefix(const DtObjectType&, const DtString& potentialPrefix);
250  virtual DtString nextNameWithPrefix(unsigned int maxLength, const DtString& potentialPrefix);
251 
259  virtual DtString nextName(const DtObjectType& objectType);
260 
261  virtual DtString nextUnorganizedName();
262 
263 public:
264  virtual void insertObjectCreatedThisTick(DtLocalObject*);
265  virtual void removeObjectCreatedThisTick(DtLocalObject*);
266 
267 public:
269  virtual void setRunFullyThreaded(bool b);
270  bool runFullyThreaded() const;
271 
273  virtual void setParameterDatabase(DtVrfParameterDb* parameterDatabase);
274  virtual DtVrfParameterDb* parameterDatabase();
275 
276  virtual makVrf::DtStateDataManager* stateDataManager() const;
277 
278  virtual void setStateDataManager(makVrf::DtStateDataManager*);
279 
280  virtual void setCommunicationManager(DtCommunicationManager*);
282  {
283  return myCommunicationManager;
284  }
285 
286  DtNetworkInterfaceManager* networkInterfaceManager() const;
287  makVrfEvents::DtEventManager* eventManager() const;
288 
294  virtual void removeAndDelete(const DtUUID& objectName, bool andRemoveFromOrbat, bool andRemoveSubordinatres = true);
295  virtual void removeAndDelete(DtLocalObject* object, bool andRemoveFromOrbat, bool andRemoveSubordinatres = true);
296 
298  bool removingAllObjects() const
299  {
300  return myRemovingAllObjects;
301  }
302 
305  virtual void removeAndDeleteAll(bool andDeleteFromOrbat = false);
306 
308  virtual bool objectInRemovalQueue(const DtUUID& uuid);
309 
316  virtual void registerInterfaceCallbacks();
317 
319  const DtSimulationServices* simulationServices() const;
321  DtSimulationServices* simulationServices();
322 
332  virtual void processCreateVrfObject(DtSimMessage* msg);
333 
335  typedef DtBoost::shared_ptr<DtCreateQueueEntry> DtCreateQueueEntryPtr;
336  typedef std::list<DtCreateQueueEntryPtr> DtVrfObjectCreateQueue;
337  virtual const DtVrfObjectCreateQueue& objectCreateQueue() const;
338 
345  virtual void processCreateVrfObject(const DtVrfLocalObjectCreateInformation& ifCreateVrfObject);
346 
354  virtual void processModifyVrfObject(DtSimMessage* msg);
355 
362  virtual void processModifyVrfObject(DtIfModifyVrfObject modObj);
363 
366  virtual void processModifyVrfOverlay(DtSimMessage* msg);
369  virtual void processDeleteVrfObject(DtSimMessage* msg);
372  virtual void processDeleteVrfObjectById(DtSimMessage* msg);
373 
376  virtual void processAggregateAs(DtSimMessage* msg);
379  virtual void processSkipTask(DtSimMessage* msg);
380 
382  virtual void queueSetSuperiorToForce(const DtUUID&, int force, int designator = 0);
383  virtual void queueSetSuperior(const DtUUID& subordinate, const DtUUID& superior, int designator = 0);
384  virtual void clearSubordinateOperations();
385  virtual bool hasOutstandingSubordinateChanges() const;
386 
391  virtual void processSetThresholds(DtSimMessage* msg);
392 
394  virtual void processDeleteDynamicTerrainServer(DtSimMessage*);
395 
398  virtual void removeObjectSubordinates(DtLocalObject* object, bool andRemoveFromOrbat);
399 
402  virtual void queueObjectForRemoval(const DtUUID& key, bool andRemoveFromOrbat = false);
403 
405  virtual void removeObjectsQueuedForRemoval();
406 
415  virtual void tick();
416 
418  virtual DtLocalObject* createAndInitVrfObject(DtIfCreateVrfObject* creationInfo);
419 
420  virtual DtLocalObject* createAndInitVrfObject(DtIfAggregateAs* aggInfo);
421 
431  virtual DtLocalObject* createAndInitVrfObject(
432  const DtObjectType& objectType,
433  bool publishLocalObject = true,
434  const DtString& objectName = DtString::nullString(),
435  const DtString& objectLabel = DtString::nullString(),
436  DtForceType forceType = DtForceOther,
437  const DtList* vertices = 0,
438  const DtTaitBryan* orientation = 0,
439  bool projection = false,
440  bool closedFigure = false,
441  const DtAppearance& appearance = DtAppearance::nullAppearance(),
442  bool createSubObjects = false,
443  DtVrfObjectUserInitFcn userInit = 0,
444  void* userInitData = 0,
445  bool organize = true,
446  const DtString& startingFormation = DtDefaultFormationString,
447  DtAggregateCreationMode initialAggregateState =
449  unsigned long requestId = 0,
450  const DtString& overlayParent = "",
451  const DtUUID& uuid = DtUUID::nullUUID(),
452  bool addToOrbat = false);
453 
454  virtual DtLocalObject* createAndInitVrfObject(const DtVrfLocalObjectCreateInformation& crt);
455 
463  virtual DtLocalObject* createAndInitVrfObject(
464  const DtObjectType& objectType,
465  bool publishLocalObject = true,
466  const DtString& objectName = DtString::nullString(),
467  const DtString& objectLabel = DtString::nullString(),
468  DtForceType forceType = DtForceOther,
469  const DtVector& position = DtVector::zero(),
470  const DtTaitBryan* orientation = 0,
471  bool projection = false,
472  bool closedFigure = false,
473  const DtAppearance& appearance = DtAppearance::nullAppearance(),
474  bool createSubObjects = false,
475  DtVrfObjectUserInitFcn userInitFcn = 0,
476  void* userInitData = 0,
477  bool organize = true,
478  const DtString& startingFormation = DtDefaultFormationString,
479  DtAggregateCreationMode initialAggregateState =
481  unsigned long requestId = 0, const DtString& overlayParent = "",
482  const DtUUID& startingUUID = DtUUID::nullUUID(),
483  bool addToOrbat = false);
484 
486  virtual void preallocateLuaScriptHandles(int);
487 
490  static void tickCallback(void* args);
491 
495  virtual void addVrfObjectAboutToBeAddedCallback(
496  DtVrfObjectListActivityCallbackFcn fcn, void* usrData,
497  const DtObjectType& filter = DtObjectType::anyType(),
498  bool invertFilter = false) const;
499 
503  virtual void addVrfObjectAddedCallback(
504  DtVrfObjectListActivityCallbackFcn fcn, void* usrData,
505  const DtObjectType& filter = DtObjectType::anyType(),
506  bool invertFilter = false) const;
507 
511  virtual void addVrfObjectAboutToBeLoadedCallback(
512  DtVrfObjectListActivityCallbackFcn fcn, void* usrData,
513  const DtObjectType& filter = DtObjectType::anyType(),
514  bool invertFilter = false) const;
515 
520  virtual void addVrfObjectAboutToBeRemovedCallback(
521  DtVrfObjectListActivityCallbackFcn fcn, void* usrData,
522  const DtObjectType& filter = DtObjectType::anyType(),
523  bool invertFilter = false) const;
524 
527  virtual void removeVrfObjectAboutToBeAddedCallback(
528  DtVrfObjectListActivityCallbackFcn fcn, void* usrData,
529  const DtObjectType& filter = DtObjectType::anyType(),
530  bool invertFilter = false) const;
531 
534  virtual void removeVrfObjectAboutToBeLoadedCallback(
535  DtVrfObjectListActivityCallbackFcn fcn, void* usrData,
536  const DtObjectType& filter = DtObjectType::anyType(),
537  bool invertFilter = false) const;
538 
541  virtual void removeVrfObjectAddedCallback(
542  DtVrfObjectListActivityCallbackFcn fcn, void* usrData,
543  const DtObjectType& filter = DtObjectType::anyType(),
544  bool invertFilter = false) const;
545 
548  virtual void removeVrfObjectAboutToBeRemovedCallback(
549  DtVrfObjectListActivityCallbackFcn fcn, void* usrData,
550  const DtObjectType& filter = DtObjectType::anyType(),
551  bool invertFilter = false) const;
552 
554  virtual int numLocalPublished() const;
555 
559  virtual bool objectNameExists(const DtString&) const;
560 
562  virtual DtLocalObject* createAndInitTopLevelVrfObject(DtForceType forceType);
565  virtual DtLocalObject* createAndInitTopLevelVrfObject(DtForceType forceType,
566  const DtString& name);
568  virtual DtString topLevelName(DtForceType forceType);
569 
572  virtual void objectNameChanged(const DtSimObject*, const DtString& oldName,
573  const DtString& newName);
574 
577  virtual void objectUUIDChanged(const DtUUID& oldUUID, const DtUUID& newUUID);
578 
580 
581  virtual void addObjectNameChangedCallback(DtVrfObjectNameChangedCallbackFcn fcn, void* usr) const;
582  virtual void removeObjectNameChangedCallback(DtVrfObjectNameChangedCallbackFcn fcn, void* usr) const;
584 
588 
589  virtual void addObjectUUIDChangedCallback(DtVrfObjectUUIDChangedCallbackFcn fcn, void* usr) const;
590  virtual void removeObjectUUIDChangedCallback(DtVrfObjectUUIDChangedCallbackFcn fcn, void* usr) const;
592 
609  virtual DtLocalObject* aggregateAs(
610  const DtObjectType& aggregateType,
611  DtForceType force,
612  const DtVector& dbPosition,
613  DtReal heading,
614  const std::vector<DtUUID>& subordinates = std::vector<DtUUID>(),
615  const DtString& aggregateName = DtString::nullString(),
616  bool addToOrbat = true);
617 
619  virtual void sendCapableTasksAndSets(const std::vector<DtUUID>&, bool forceUpdate = false) const;
620 
625  virtual void setSimulationDateTimeBasedOnLocation(const DtVector& geocentricLocation, int timeOfDay);
626 
628  virtual void setCoordinateSystem(const Coordinate_System* coordinateSystem);
629 
631  virtual unsigned objectCount() const;
632 
647  virtual DtLocalObject* lookup(const DtUUID&) const;
648 
650  DtLocalObject* lookup(const std::string&) const;
651 
653  DtLocalObject* lookup(const DtString&) const;
654 
657  virtual bool uuidExists(const DtUUID&) const;
658 
660  virtual bool hasObjectType(const DtObjectType&) const;
661 
664  virtual bool markingTextExists(const DtString&) const;
665 
667  virtual const DtSimulationAddress& simulationAddress() const;
668 
670  virtual bool createSimObjectList();
671 
674  virtual const DtSimObjectMap& objectMap() const;
675  virtual DtSimObjectMap localObjectMap() const;
676 
678  virtual bool hostingDynamicTerrainServer() const;
679 
681  virtual bool hasDynamicTerrainServer() const;
682 
684  virtual DtVrfParameterDb* objectParametersDB() const;
685 
687  virtual void addSimObjectQueuedForRemovalCallback(
688  DtVrfObjectQueuedForRemocalCallbackFcn fcn, void* usr) const;
689  virtual void removeSimObjectQueuedForRemovalCallback(
690  DtVrfObjectQueuedForRemocalCallbackFcn fcn, void* usr) const;
691  virtual void invokeSimObjectQueuedForRemovalCallbacks(
692  const DtLocalObject* object);
693 
695  virtual void addValidStateChangedCallbackFcn(
696  DtValidStateChangedCallbackFcn fcn, void* usr) const;
697  virtual void removeValidStateChangedCallbackFcn(
698  DtValidStateChangedCallbackFcn fcn, void* usr) const;
699  virtual void invokeValidStateChangedCallbacks();
700 
702  virtual void addSimObjectConvertedToLocalCallback(DtSimObjectListActivityCallbackFcn fcn, void* usrData);
703  virtual void removeSimObjectConvertedToLocalCallback(DtSimObjectListActivityCallbackFcn fcn, void* usrData);
704 
706  virtual void addSimObjectConvertedToRemoteCallback(DtSimObjectListActivityCallbackFcn fcn, void* usrData);
707  virtual void removeSimObjectConvertedToRemoteCallback(DtSimObjectListActivityCallbackFcn fcn, void* usrData);
708 
712  virtual void addSimObjectAboutToBeAddedCallback(
713  DtSimObjectListActivityCallbackFcn fcn, void* usrData,
714  const DtObjectType& filter = DtObjectType::anyType(),
715  bool invertFilter = false) const;
716 
720  virtual void addSimObjectAddedCallback(
721  DtSimObjectListActivityCallbackFcn fcn, void* usrData,
722  const DtObjectType& filter = DtObjectType::anyType(),
723  bool invertFilter = false) const;
724 
728  virtual void addSimObjectAboutToBeRemovedCallback(
729  DtSimObjectListActivityCallbackFcn fcn, void* usrData,
730  const DtObjectType& filter = DtObjectType::anyType(),
731  bool invertFilter = false) const;
732 
736  virtual void addSimObjectAboutToBeLoadedCallback(
737  DtSimObjectListActivityCallbackFcn fcn, void* usrData,
738  const DtObjectType& filter = DtObjectType::anyType(),
739  bool invertFilter = false) const;
740 
743  virtual void removeSimObjectAboutToBeAddedCallback(
744  DtSimObjectListActivityCallbackFcn fcn, void* usrData,
745  const DtObjectType& filter = DtObjectType::anyType(),
746  bool invertFilter = false) const;
747 
750  virtual void removeSimObjectAddedCallback(
751  DtSimObjectListActivityCallbackFcn fcn, void* usrData,
752  const DtObjectType& filter = DtObjectType::anyType(),
753  bool invertFilter = false) const;
754 
757  virtual void removeSimObjectAboutToBeLoadedCallback(
758  DtSimObjectListActivityCallbackFcn fcn, void* usrData,
759  const DtObjectType& filter = DtObjectType::anyType(),
760  bool invertFilter = false) const;
761 
764  virtual void removeSimObjectAboutToBeRemovedCallback(
765  DtSimObjectListActivityCallbackFcn fcn, void* usrData,
766  const DtObjectType& filter = DtObjectType::anyType(),
767  bool invertFilter = false) const;
768 
770  virtual void invokeSimObjectConvertedToLocalCallbacks(
771  const DtLocalObject* simObject);
772 
774  virtual void invokeSimObjectConvertedToRemoteCallbacks(
775  const DtLocalObject* simObject);
776 
780  virtual void invokeSimObjectAboutToBeAddedCallbacks(
781  const DtLocalObject* simObject);
782 
786  virtual void invokeSimObjectAddedCallbacks(
787  const DtLocalObject* simObject);
788 
792  virtual void invokeSimObjectAboutToBeRemovedCallbacks(
793  const DtLocalObject* simObject);
794 
798  virtual void invokeSimObjectAboutToBeLoadedCallbacks(
799  const DtLocalObject* simObject);
800 
804  virtual void setSimObjectType(const DtString& type);
805  virtual const DtString& simObjectType() const;
807 
809  virtual void closingScenario();
810 
813  virtual bool addUUIDMappingForObject(DtLocalObject* vrfObject);
814 
816  virtual void removeUUIDMappingForObject(DtLocalObject* vrfObject);
817 
820  virtual bool canSimulate() const;
821 
824  virtual void setCanSimulate(bool);
825 
828  virtual void addStealthType(const DtEntityType&);
829  virtual void removeStealthType(const DtEntityType&);
830  virtual bool isStealthType(const DtEntityType&) const;
831  std::vector<DtEntityType>& stealthTypes() { return myStealthTypes; };
832  const std::vector<DtEntityType>& stealthTypes() const { return myStealthTypes; };
833 
835  virtual DtLocalObject* getObjectByType(const DtEntityType&) const;
837  {
838  return myNameGenerator;
839  }
840 
841 public:
842 
846  virtual bool addSubordinatesToAggregate(DtLocalObject* object,
847  const std::vector<DtUUID>& subordinates, DtAggregateState desiredState = DtFullyDisaggregated);
848 
849 public:
851  virtual void convertToLocal(DtLocalObject*);
852  virtual void convertedToRemote(const DtLocalObject*);
853  public:
854 
857  virtual void removeVrfObject(const DtUUID&, bool queueDeletionOfVrfObject = false);
858 protected:
859  virtual DtEntityIdentifier generateObjectIdentifier();
860 
861  virtual void objectHandoffHandling(DtLocalObject*, int flag);
862 
863 protected:
865  virtual DtOwnershipTransferManager* createOwnershipTransferManager();
866 
869  virtual bool shouldAddImmediately(const DtLocalObject* simObject) const;
870 
871  public:
876  virtual void remove(DtLocalObject* simObject);
877 
878  virtual void objRemovedThisTick(const DtUUID& object);
879  virtual void addQueueObjectToDelete(DtLocalObject* vrfobject);
880  virtual void objectDeleteThisTick(DtLocalObject* vrfobject);
881  virtual void processModifyVrfOverlayObject(DtIfModifyVrfOverlay*, DtLocalObject*);
882 
883 protected:
886  virtual void onQueueObjectForRemoval(DtLocalObject* vrfObject, bool andRemoveFromOrbat = false);
887 
888  virtual const Coordinate_System* coordinateSystem() const;
889  virtual Coordinate_System* coordinateSystem();
890 
892  virtual void advanceFrame();
893 
894 protected:
895  virtual bool processPendingSubordinateRequests();
896  virtual void hookSuperiorToSubordinates(DtLocalObject* localObject);
897 
898 public:
900  virtual void deleteVrfObjectsToBeDeleted();
901 
902 protected:
903 
907  static void modifyVrfObjectCallback(DtSimMessage* msg, void* usr);
908  static void modifyVrfOverlayCallback(DtSimMessage* msg, void* usr);
909  static void skipTaskCallback(DtSimMessage* msg, void* usr);
910  static void setThresholdsCallback(DtSimMessage* msg, void* usr);
911  static void deleteDynamicTerrainServerCallback(DtSimMessage*, void*);
912 
913 #if DT_SINGLE_STATE_UPDATE_MESSAGE
914  static void vrfObjectStateUpdateCallback(DtSimMessage* msg, void* usr);
915 #endif
916 
924  static void createVrfObjectCallback(DtSimMessage* msg, void* usr);
925  static void deleteVrfObjectCallback(DtSimMessage* msg, void* usr);
926  static void deleteVrfObjectByIdCallback(DtSimMessage* msg, void* usr);
927  static void orderOfBattleOpCallback(DtSimMessage* msg, void* usr);
928  static void aggregateAsCallback(DtSimMessage* msg, void* usr);
929 
931  static void extendedLabelsOperationCallback(DtSimMessage* msg, void* usr);
932  virtual void processExtendedLabelsOperation(DtSimMessage*);
933 
935  static void requestActivitiesCallback(DtSimMessage* msg, void* usr);
936  virtual void processRequestActivities(DtSimMessage*);
937 
939  static void requestJoystickControlsCallback(DtSimMessage* msg, void* usr);
940  virtual void processRequestJoystickControls(DtSimMessage*);
941 
942  virtual void sendObjectsCreatedMessage();
943  virtual void sendObjectsDeletedMessage();
944 
945  virtual void placeObjectEvent(const makVrfEvents::DtEvent&);
946 
947 protected:
948 
951  virtual DtCreateQueueEntry* createQueueEntryCreator(const DtVrfLocalObjectCreateInformation& msg);
952 
955  virtual DtModifyQueueEntry* modifyQueueEntryCreator(const DtIfModifyVrfObject& msg);
956 
957  virtual void postInitFromParamsCallback(DtLocalObject*, DtAggregateCreationMode);
958  virtual DtVrfNameGenerator* createNameGenerator();
959  virtual DtObjectType potentialRandomObjectTypeFrom(const DtObjectType& original);
960 
968  virtual void createSubObjectsFromParameters(DtLocalObject* parent,
969  bool publishSubobjects, unsigned long requestId, const DtString& overlayParent, bool addToOrbat);
970 
973  virtual std::list<DtVector> calculateFormationOffsetsBasedOnFootprints(const DtList&) const;
974 
976  virtual std::vector<Dt3dBoundingVolume> boundingVolumesOfChildren(const DtList& subObjects,
977  int& totalLeafNodes) const;
978 
985  virtual DtLocalObject* createSubObjectFromParameterEntry(
986  const DtVrfSubObjectParameterEntry& entry, const DtVector& positionOffsetFromParent,
987  const DtLocalObject& parent,
988  const DtString& formationName,
989  bool publishSubObject, unsigned long requestId = 0, const DtString& overlayParent = "",
990  const DtString& markingText = "", const DtUUID& uuid = DtUUID::nullUUID(),
991  bool addToOrbat = true);
992 
995  virtual void modifyInterfaceContentForNewObject(DtSimInterfaceContent*, DtLocalObject*, bool& isLocal) const;
996 
997  virtual void updateSubordianteFunction(DtLocalObject* agg, const std::vector<DtUUID>& subordiantes);
998 
999 protected:
1002 
1004 
1006  mutable tbb::spin_rw_mutex mySimObjectListMutex;
1008 
1011 
1016 
1021 
1026 
1031 
1034 
1037 
1038  //mutable std::set<DtSimObjectListActivityCallbackInfo*> myRemovalCallbacksRemoved;
1039 
1042 
1044 
1047  std::map<DtUUID, bool> myObjectsToRemoveQueue;
1048 
1052 
1055  typedef DtBoost::shared_ptr<DtModifyQueueEntry> DtModifyQueueEntryPtr;
1056  typedef std::list<DtModifyQueueEntryPtr> DtVrfObjectModifyQueue;
1058 
1060 
1062 
1064 
1067 
1070 
1073 
1075 
1078 
1080 
1083 
1084  std::vector<DtEntityType> myStealthTypes;
1085 
1086  std::vector<DtLocalObject*> myVrfObjectsToDelete;
1087 
1089 
1092  std::set<DtLocalObject*> myCompleteObjectAddition;
1093 
1095 
1096  tbb::spin_mutex myObjectPublisherMutex;
1097  tbb::spin_mutex myRemovalQueueMutex;
1098 
1101 
1103  std::set<DtLocalObject*> myObjectsCreatedThisTick;
1104  std::set<DtString> myObjectsDeletedThisTick;
1105 
1106  tbb::atomic<int> myNumLocalPublished;
1108  mutable tbb::spin_rw_mutex myObjectsToRemoveQueueMutex;
1109 
1111  std::set<DtUUID> myObjectWasRemovedThisTick;
1112 
1114 
1115  mutable tbb::spin_rw_mutex myQueueSetSuperiorMutex;
1116  std::map<int, DtUUID> myForceLevelNodesByUUID;
1118 
1120  {
1121  PendingStruct() : superior(DtUUID::nullUUID()), designator(0) {};
1122  PendingStruct(const DtUUID& sup, int des) : superior(sup), designator(des) {};
1123  PendingStruct(const PendingStruct& orig) : superior(orig.superior), designator(orig.designator) {};
1124  PendingStruct& operator=(const PendingStruct& rhs) { superior = rhs.superior; designator = rhs.designator; return *this; };
1125 
1126  DtUUID superior;
1128  };
1129 
1130  typedef std::map<DtUUID, PendingStruct> PendingSetSuperior;
1132 
1133  typedef std::map<DtUUID, std::set<DtUUID> > PendingSuperiorsToSet;
1135 
1136  boost::signals2::scoped_connection myPlaceObjectEventConnection;
1137 
1138  typedef std::map<DtUUID, boost::signals2::connection> PostInitParamsConnections;
1141 
1143 
1144  typedef std::map<DtString, DtRwStringAttributeList*> VisualMarkings;
1146  tbb::spin_rw_mutex myVisualMarkingsMutex;
1147 
1148 public:
1152  VRF4API_METHOD DtSimObjectReference lookupVrfObjectByUUID(const DtUUID& u) const;
1153  VRF4API_METHOD const DtSimulationServices* simManager() const;
1154  VRF4API_METHOD DtSimulationServices* simManager();
1155 
1158  bool reevaluateFlag = false, DtTime evaluationPeriod = 0);
1159 
1160  VRF4API_METHOD DtVrfObjectPlanAdministrator* planAdministrator();
1161  VRF4API_METHOD DtSimObjectReference lookupVrfObjectByMarkingText(const DtString&) const;
1162  VRF4API_METHOD const DtReaderWriter::SearchPaths& searchPaths() const;
1164 };
1165 
1167 {
1169 }
1170 
1172 {
1174 }
1175 
1176 #include "localObjectManager.inl"
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
DtUUID superior
Definition: localObjectManager.h:1124
Class Description: DtVrfSimulationObjectGroupGeometry is a specialized that class will calculate obje...
Definition: vrfSimulationObjectGroupGeometry.h:50
std::map< int, DtUUID > myForceLevelNodesByUUID
Definition: localObjectManager.h:1116
This singleton class keeps track of components that should be added to remote, non VR-Forces entities...
Definition: remoteComponentAttachmentManager.h:35
DtValidStateChangedCallbackList myValidStateChangedCallbackList
Definition: localObjectManager.h:1077
class DtLocalObjectManager:
Definition: localObjectManager.h:151
DtString mySimObjectType
Type of DtSimObject to create. Types are defined in simObjectTypes.h.
Definition: localObjectManager.h:1041
class DtIfModifyVrfOverlay
Definition: ifModifyVrfOverlay.h:47
Instances of DtVrfParameterDb are the database of DtVrfObjectParameters objects used in the construct...
Definition: vrfParameterDb.h:38
tbb::spin_rw_mutex myVisualMarkingsMutex
Definition: localObjectManager.h:1146
DtBoost::shared_ptr< DtModifyQueueEntry > DtModifyQueueEntryPtr
Object modification queue; objects which are ground clamped are only moved once the terrain at the re...
Definition: localObjectManager.h:1055
DtSimulationServices * mySimulationServices
Definition: localObjectManager.h:1043
tbb::mutex myTopLevelNodeCreationMutex
Definition: localObjectManager.h:1003
DtString myNewName
Definition: localObjectManager.h:114
The DtVisualMetaDataManager will use ead meta data files based on the given entity type...
Definition: visualMetaDataManager.h:27
bool(* DtSimObjectUserInitFcn)(DtLocalObject *object, void *usr)
User action function definition for createAndInitSimObject()
Definition: localObjectManager.h:103
bool myRemovingAllObjects
Definition: localObjectManager.h:1102
const char DtDefaultFormationString[]
Definition: extendedAggregateEnums.h:23
DtVrfObjectModifyQueue myObjectsToModifyQueue
Definition: localObjectManager.h:1057
Definition: localObjectManager.h:1119
DtSimObjectListActivityCallbackList myAboutToBeRemovedSimObjectCallbackList
List of DtSimObjectListActivityCallbackFcn*s. Clients register callback functions on this list for no...
Definition: localObjectManager.h:1030
PendingStruct()
Definition: localObjectManager.h:1121
DtSimObjectListActivityCallbackList myAboutToBeLoadedSimObjectCallbackList
List of DtSimObjectListActivityCallbackFcn*s. Clients register callback functions on this list for no...
Definition: localObjectManager.h:1015
void(* DtSimObjectListActivityCallbackFcn)(const DtLocalObject *simObject, void *usr)
Callback function definition.
Definition: simObjectListActivityCallbackInfo.h:17
double myTimeToPublishNextStateUpdate
Definition: localObjectManager.h:1061
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
DtVrfNameGenerator * myNameGenerator
Definition: localObjectManager.h:1142
DtLocalObject * myDynamicTerrainServer
Definition: localObjectManager.h:1063
std::map< DtUUID, boost::signals2::connection > PostInitParamsConnections
Definition: localObjectManager.h:1138
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
DtRemoteComponentAttachmentManager * myRemoteComponentAttachmentManager
List of components to attach to remote, non-vrf entities.
Definition: localObjectManager.h:1001
DtCallbackList< const DtLocalObject * >::DtCallbackFunctionType DtVrfObjectQueuedForRemocalCallbackFcn
Definition: localObjectManager.h:131
DtBoost::shared_ptr< DtCreateQueueEntry > DtCreateQueueEntryPtr
Returns the objects to create queue.
Definition: localObjectManager.h:335
DtVrfSubObjectParameterEntry.
Definition: vrfSubObjectParameterEntry.h:27
VisualMarkings myVisualMarkings
Definition: localObjectManager.h:1145
bool(* DtVrfObjectUserInitFcn)(DtLocalObject *vrfObject, void *usr)
User action function definition for createAndInitVrfObject()
Definition: localObjectCreateInformation.h:25
makVrf::DtStateDataManager * myStateDataManager
Definition: localObjectManager.h:1099
The DtLocalObjectCreateInformation class is a subset of the information used in the DtIfCreateVrfObje...
Definition: vrfLocalObjectCreateInformation.h:26
Callback list for DtLocalObjectManager object list activity, such as adding and removing objects...
Definition: simObjectListActivityCallbackList.h:25
std::set< DtLocalObject * > myObjectsCreatedThisTick
Definition: localObjectManager.h:1103
PendingSuperiorsToSet myPendingSuperiorsToSet
Definition: localObjectManager.h:1134
tbb::spin_mutex myPostInitParamsConnectionsMutex
Definition: localObjectManager.h:1140
DtObjectQueuedForRemovalCallbackList myObjectQueuedForRemovalCallbackList
Definition: localObjectManager.h:1069
DtVrfObjectUUIDChangedCallbackInfo()
Definition: localObjectManager.h:121
Arguments passed by the DtLocalObjectManager::addUUIDChangedCallback callbacks.
Definition: localObjectManager.h:119
std::list< DtModifyQueueEntryPtr > DtVrfObjectModifyQueue
Definition: localObjectManager.h:1056
class DtIfModifyVrfObject:
Definition: ifModifyVrfObject.h:50
Definition: objectType.h:27
const std::vector< DtEntityType > & stealthTypes() const
Definition: localObjectManager.h:832
std::set< DtLocalObject * > myCompleteObjectAddition
Definition: localObjectManager.h:1092
Contains the DtVrfObjectPredicate class declaration.
Definition: vrfObjectPredicate.h:20
Manages loading and destruction of the geometric models for objects. Will reference the object parame...
Definition: objectGeometricModelsManager.h:29
int myAppIdRangeMax
Definition: localObjectManager.h:1094
Definition: ownershipTransferManager.h:26
DtNameChangedCallbackList myObjectNameChangedCallbackList
Definition: localObjectManager.h:1066
void(* DtVrfObjectListActivityCallbackFcn)(const DtLocalObject *vrfObject, void *usr)
Callback function definition (for callbacks registered on DtLocalObject* additions to and removals fr...
Definition: simObjectListActivityCallbackList.h:19
DtVrfObjectCreateQueue myObjectsToCreateQueue
Object creation queue; objects are only created once the terrain at the requested location has been p...
Definition: localObjectManager.h:1051
std::set< DtString > myObjectsDeletedThisTick
Definition: localObjectManager.h:1104
bool myInitialTimeSetThisFrame
Definition: localObjectManager.h:1088
static const DtUUID & nullUUID()
DtCallbackList< const DtVrfObjectNameChangedCallbackInfo & > DtNameChangedCallbackList
Definition: localObjectManager.h:1065
Definition: coordSystem.h:54
Definition: event.h:13
bool myRunFullyThreaded
Definition: localObjectManager.h:1090
std::map< DtEntityIdentifier, DtLocalObject * > DtEntityIdMap
Definition: localObjectManager.h:99
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
DtSimObjectMap mySimObjectList
Definition: localObjectManager.h:1007
std::map< DtUUID, DtLocalObject * > DtSimObjectMap
Definition: localObjectManager.h:100
The DtCommunicationManager class is a convenience class that will create both the DtNetworkInterfaceM...
Definition: communicationManager.h:51
Definition: createObjectServiceInterface.h:25
PendingStruct(const PendingStruct &orig)
Definition: localObjectManager.h:1123
File: simMsg.h.
Definition: simMessage.h:35
class DtVertexList:
Definition: vertexList.h:22
DtCallbackList< const DtVrfObjectUUIDChangedCallbackInfo & >::DtCallbackFunctionType DtVrfObjectUUIDChangedCallbackFcn
Definition: localObjectManager.h:130
DtUUID myNewUUID
Definition: localObjectManager.h:124
std::vector< DtFilename > SearchPaths
Definition: readerWriter.h:92
const int DtSimMaxForceTypes
The enumeration in DIS only specifies 4 types, but it goes across the network in an 8-bit field...
Definition: localObjectManager.h:108
DtCallbackList< const DtVrfObjectNameChangedCallbackInfo & >::DtCallbackFunctionType DtVrfObjectNameChangedCallbackFcn
Callback signature for DtLocalObjectManager::addNameChangedCallback().
Definition: localObjectManager.h:129
Definition: noArgumentCallbackList.h:91
std::vector< DtEntityType > myStealthTypes
Definition: localObjectManager.h:1084
A utility class for use with DtConsoleCommandManager. This class takes ownership of an arbitrary numb...
Definition: consoleCommandManager.h:166
const DtSimObject * myVrfObject
Definition: localObjectManager.h:115
tbb::spin_rw_mutex mySimObjectListMutex
Hashlist of all DtLocalObject*s, keyed on DtUUID.
Definition: localObjectManager.h:1006
DtCommunicationManager * communicationManager() const
Definition: localObjectManager.h:281
DtVrfNameGenerator * vrfNameGenerator() const
Definition: localObjectManager.h:836
bool myWasValid
Definition: localObjectManager.h:1082
bool removingAllObjects() const
Whether ot not all objects are being removed.
Definition: localObjectManager.h:298
PostInitParamsConnections myPostInitParamsConnections
Definition: localObjectManager.h:1139
DtCommunicationManager * myCommunicationManager
Definition: localObjectManager.h:1100
Definition: echelonId.h:13
DtSimObjectListActivityCallbackList mySimObjectConvertedToRemoteCallbacks
List of DtSimObjectListActivityCallbackFcn*s for objects that have been converted to a remote object...
Definition: localObjectManager.h:1036
DtUUIDChangedCallbackList myObjectUUIDChangedCallbackList
Definition: localObjectManager.h:1072
tbb::spin_mutex myCompleteObjectAdditionMutex
Definition: localObjectManager.h:1091
The DtVrfObjectPlanAdministrator performs plan-related tasks that must be done in a centralized manne...
Definition: vrfObjectPlanAdministrator.h:44
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
DtSimObjectListActivityCallbackList myAddedSimObjectCallbackList
List of DtSimObjectListActivityCallbackFcn*s. Clients register callback functions on this list for no...
Definition: localObjectManager.h:1025
std::map< DtString, DtRwStringAttributeList * > VisualMarkings
Definition: localObjectManager.h:1144
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:90
DtConsoleCommandOwner * myConsoleCommands
Definition: localObjectManager.h:1074
This class is the central access point for all current-frame state of all objects in the simulation i...
Definition: simObjectManager.h:42
DtCallbackList< bool >::DtCallbackFunctionType DtValidStateChangedCallbackFcn
Definition: localObjectManager.h:132
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: simObject.h:79
PendingSetSuperior myPendingSetSuperior
Definition: localObjectManager.h:1131
class DtCreateQueueEntry:
Definition: createQueueEntry.h:25
DtSimObjectListActivityCallbackList myAboutToBeAddedSimObjectCallbackList
List of DtSimObjectListActivityCallbackFcn*s. Clients register callback functions on this list for no...
Definition: localObjectManager.h:1020
DtManagedObjectListConstPtr myForceLevelNodes
Definition: localObjectManager.h:1117
Definition: modifyQueueEntry.h:24
std::vector< DtEntityType > & stealthTypes()
Definition: localObjectManager.h:831
std::list< DtCreateQueueEntryPtr > DtVrfObjectCreateQueue
Definition: localObjectManager.h:336
const Coordinate_System * myCoordinateSystemPtr
Definition: localObjectManager.h:1059
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
DtCallbackList< const DtVrfObjectUUIDChangedCallbackInfo & > DtUUIDChangedCallbackList
Definition: localObjectManager.h:1071
bool myCanSimulate
Definition: localObjectManager.h:1081
std::map< DtUUID, PendingStruct > PendingSetSuperior
Definition: localObjectManager.h:1130
tbb::spin_mutex myObjectsCreatedThisTickMutex
Definition: localObjectManager.h:1107
DtCallbackList< const DtLocalObject * > DtObjectQueuedForRemovalCallbackList
Definition: localObjectManager.h:1068
DtRemoteComponentAttachmentManager * remoteComponentAttachmentManager()
Returns the remote component attachment manager.
Definition: localObjectManager.h:1166
bool myCreatedCharacterManager
Definition: localObjectManager.h:1079
DtBoost::shared_ptr< const DtManagedObjectList > DtManagedObjectListConstPtr
Typedef for a shared pointer to a const DtOrgViewManagedObjectList. These lists are used within VR-Fo...
Definition: managedObjectList.h:35
DtOwnershipTransferManager * myOwnershipTransferManager
Definition: localObjectManager.h:1113
tbb::spin_mutex myRemovalQueueMutex
Definition: localObjectManager.h:1097
std::map< DtUUID, std::set< DtUUID > > PendingSuperiorsToSet
Definition: localObjectManager.h:1133
std::vector< DtLocalObject * > myVrfObjectsToDelete
Definition: localObjectManager.h:1086
const DtLocalObject * myVrfObject
Definition: localObjectManager.h:125
Definition: simInterfaceContent.h:45
PendingStruct(const DtUUID &sup, int des)
Definition: localObjectManager.h:1122
int designator
Definition: localObjectManager.h:1127
tbb::spin_rw_mutex myObjectWasRemovedThisTickMutex
Definition: localObjectManager.h:1110
std::set< DtUUID > myObjectWasRemovedThisTick
Definition: localObjectManager.h:1111
boost::signals2::scoped_connection myPlaceObjectEventConnection
Definition: localObjectManager.h:1136
This is the FIXED length portion of a DtIfAggregateAs message content when placed on the network...
Definition: ifAggregateAs.h:39
DtVrfParameterDb * myParameterDatabase
Parameter database used in creation and initialization of DtLocalObjects.
Definition: localObjectManager.h:1010
Arguments passed by the DtLocalObjectManager::addNameChangedCallback callbacks.
Definition: localObjectManager.h:111
DtSimObjectListActivityCallbackList mySimObjectConvertedToLocalCallbacks
List of DtSimObjectListActivityCallbackFcn*s for objects that have been converted to a local object...
Definition: localObjectManager.h:1033
tbb::atomic< int > myNumLocalPublished
Entity Identifier to be consistent with current DtIfVrfObjectDeleted message.
Definition: localObjectManager.h:1106
DtCallbackList< bool > DtValidStateChangedCallbackList
Definition: localObjectManager.h:1076
#define VRF4API_METHOD
Include this header file to allow for the definition/usage of the ability to mark something as deprec...
Definition: vrf4XAPI.h:22
tbb::spin_mutex myObjectPublisherMutex
Definition: localObjectManager.h:1096
A DtRwActivities list will contain a list of activities (key/value pair) by entity type that will sup...
Definition: rwActivities.h:20
DtAggregateCreationMode
Defines how the initial DtAggregateState should be set upon creation of an aggregate entity...
Definition: createObjectServiceInterface.h:23
static const DtObjectType & anyType()
DtUUID myOldUUID
Definition: localObjectManager.h:121
std::map< DtUUID, bool > myObjectsToRemoveQueue
Objects queued for removal; processed each tick by removeObjectsQueuedForRemoval. ...
Definition: localObjectManager.h:1047
DtString myOldName
Definition: localObjectManager.h:113
class DtRwStringAttributeList:
Definition: rwStringAttributeList.h:29
The DtVrfNameGenerator class will generate a unique name by object type.
Definition: vrfNameGenerator.h:20
tbb::spin_rw_mutex myQueueSetSuperiorMutex
Definition: localObjectManager.h:1115
class DtIfCreateVrfObject:
Definition: ifCreateVrfObject.h:77
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86
tbb::spin_rw_mutex myObjectsToRemoveQueueMutex
Definition: localObjectManager.h:1108
This class holds the state data that represents each simulation object in the system.
Definition: stateDataManager.h:71

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)