VR-Forces 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 
842  virtual void createForceLevelObjects();
843 
844 public:
845 
849  virtual bool addSubordinatesToAggregate(DtLocalObject* object,
850  const std::vector<DtUUID>& subordinates, DtAggregateState desiredState = DtFullyDisaggregated);
851 
852 public:
854  virtual void convertToLocal(DtLocalObject*);
855  virtual void convertedToRemote(const DtLocalObject*);
856  public:
857 
860  virtual void removeVrfObject(const DtUUID&, bool queueDeletionOfVrfObject = false);
861 protected:
862  virtual DtEntityIdentifier generateObjectIdentifier();
863 
864  virtual void objectHandoffHandling(DtLocalObject*, int flag);
865 
866 protected:
868  virtual DtOwnershipTransferManager* createOwnershipTransferManager();
869 
872  virtual bool shouldAddImmediately(const DtLocalObject* simObject) const;
873 
874  public:
879  virtual void remove(DtLocalObject* simObject);
880 
881  virtual void objRemovedThisTick(const DtUUID& object);
882  virtual void addQueueObjectToDelete(DtLocalObject* vrfobject);
883  virtual void objectDeleteThisTick(DtLocalObject* vrfobject);
884  virtual void processModifyVrfOverlayObject(DtIfModifyVrfOverlay*, DtLocalObject*);
885 
886 protected:
889  virtual void onQueueObjectForRemoval(DtLocalObject* vrfObject, bool andRemoveFromOrbat = false);
890 
891  virtual const Coordinate_System* coordinateSystem() const;
892  virtual Coordinate_System* coordinateSystem();
893 
895  virtual void advanceFrame();
896 
897 protected:
898  virtual bool processPendingSubordinateRequests();
899  virtual void hookSuperiorToSubordinates(DtLocalObject* localObject);
900 
901 public:
903  virtual void deleteVrfObjectsToBeDeleted();
904 
905 protected:
906 
910  static void modifyVrfObjectCallback(DtSimMessage* msg, void* usr);
911  static void modifyVrfOverlayCallback(DtSimMessage* msg, void* usr);
912  static void skipTaskCallback(DtSimMessage* msg, void* usr);
913  static void setThresholdsCallback(DtSimMessage* msg, void* usr);
914  static void deleteDynamicTerrainServerCallback(DtSimMessage*, void*);
915 
916 #if DT_SINGLE_STATE_UPDATE_MESSAGE
917  static void vrfObjectStateUpdateCallback(DtSimMessage* msg, void* usr);
918 #endif
919 
927  static void createVrfObjectCallback(DtSimMessage* msg, void* usr);
928  static void deleteVrfObjectCallback(DtSimMessage* msg, void* usr);
929  static void deleteVrfObjectByIdCallback(DtSimMessage* msg, void* usr);
930  static void orderOfBattleOpCallback(DtSimMessage* msg, void* usr);
931  static void aggregateAsCallback(DtSimMessage* msg, void* usr);
932 
934  static void extendedLabelsOperationCallback(DtSimMessage* msg, void* usr);
935  virtual void processExtendedLabelsOperation(DtSimMessage*);
936 
938  static void requestActivitiesCallback(DtSimMessage* msg, void* usr);
939  virtual void processRequestActivities(DtSimMessage*);
940 
942  static void requestJoystickControlsCallback(DtSimMessage* msg, void* usr);
943  virtual void processRequestJoystickControls(DtSimMessage*);
944 
945  virtual void sendObjectsCreatedMessage();
946  virtual void sendObjectsDeletedMessage();
947 
948  virtual void placeObjectEvent(const makVrfEvents::DtEvent&);
949 
950 protected:
951 
954  virtual DtCreateQueueEntry* createQueueEntryCreator(const DtVrfLocalObjectCreateInformation& msg);
955 
958  virtual DtModifyQueueEntry* modifyQueueEntryCreator(const DtIfModifyVrfObject& msg);
959 
960  virtual void postInitFromParamsCallback(DtLocalObject*, DtAggregateCreationMode);
961  virtual DtVrfNameGenerator* createNameGenerator();
962  virtual DtObjectType potentialRandomObjectTypeFrom(const DtObjectType& original);
963 
971  virtual void createSubObjectsFromParameters(DtLocalObject* parent,
972  bool publishSubobjects, unsigned long requestId, const DtString& overlayParent, bool addToOrbat);
973 
976  virtual std::list<DtVector> calculateFormationOffsetsBasedOnFootprints(const DtList&) const;
977 
979  virtual std::vector<Dt3dBoundingVolume> boundingVolumesOfChildren(const DtList& subObjects,
980  int& totalLeafNodes) const;
981 
988  virtual DtLocalObject* createSubObjectFromParameterEntry(
989  const DtVrfSubObjectParameterEntry& entry, const DtVector& positionOffsetFromParent,
990  const DtLocalObject& parent,
991  const DtString& formationName,
992  bool publishSubObject, unsigned long requestId = 0, const DtString& overlayParent = "",
993  const DtString& markingText = "", const DtUUID& uuid = DtUUID::nullUUID(),
994  bool addToOrbat = true);
995 
998  virtual void modifyInterfaceContentForNewObject(DtSimInterfaceContent*, DtLocalObject*, bool& isLocal) const;
999 
1000  virtual void updateSubordianteFunction(DtLocalObject* agg, const std::vector<DtUUID>& subordiantes);
1001 
1002 protected:
1005 
1007 
1009  mutable tbb::spin_rw_mutex mySimObjectListMutex;
1011 
1014 
1019 
1024 
1029 
1034 
1037 
1040 
1041  //mutable std::set<DtSimObjectListActivityCallbackInfo*> myRemovalCallbacksRemoved;
1042 
1045 
1047 
1050  std::map<DtUUID, bool> myObjectsToRemoveQueue;
1051 
1055 
1058  typedef DtBoost::shared_ptr<DtModifyQueueEntry> DtModifyQueueEntryPtr;
1059  typedef std::list<DtModifyQueueEntryPtr> DtVrfObjectModifyQueue;
1061 
1063 
1065 
1067 
1070 
1073 
1076 
1078 
1081 
1083 
1086 
1087  std::vector<DtEntityType> myStealthTypes;
1088 
1089  std::vector<DtLocalObject*> myVrfObjectsToDelete;
1090 
1092 
1095  std::set<DtLocalObject*> myCompleteObjectAddition;
1096 
1098 
1099  tbb::spin_mutex myObjectPublisherMutex;
1100  tbb::spin_mutex myRemovalQueueMutex;
1101 
1104 
1106  std::set<DtLocalObject*> myObjectsCreatedThisTick;
1107  std::set<DtString> myObjectsDeletedThisTick;
1108 
1109  tbb::atomic<int> myNumLocalPublished;
1111  mutable tbb::spin_rw_mutex myObjectsToRemoveQueueMutex;
1112 
1114  std::set<DtUUID> myObjectWasRemovedThisTick;
1115 
1117 
1118  mutable tbb::spin_rw_mutex myQueueSetSuperiorMutex;
1119  std::map<int, DtUUID> myForceLevelNodesByUUID;
1121 
1123  {
1124  PendingStruct() : superior(DtUUID::nullUUID()), designator(0) {};
1125  PendingStruct(const DtUUID& sup, int des) : superior(sup), designator(des) {};
1126  PendingStruct(const PendingStruct& orig) : superior(orig.superior), designator(orig.designator) {};
1127  PendingStruct& operator=(const PendingStruct& rhs) { superior = rhs.superior; designator = rhs.designator; return *this; };
1128 
1129  DtUUID superior;
1131  };
1132 
1133  typedef std::map<DtUUID, PendingStruct> PendingSetSuperior;
1135 
1136  typedef std::map<DtUUID, std::set<DtUUID> > PendingSuperiorsToSet;
1138 
1139  boost::signals2::scoped_connection myPlaceObjectEventConnection;
1140 
1141  typedef std::map<DtUUID, boost::signals2::connection> PostInitParamsConnections;
1144 
1146 
1147  typedef std::map<DtString, DtRwStringAttributeList*> VisualMarkings;
1149  tbb::spin_rw_mutex myVisualMarkingsMutex;
1150 
1151 public:
1155  VRF4API_METHOD DtSimObjectReference lookupVrfObjectByUUID(const DtUUID& u) const;
1156  VRF4API_METHOD const DtSimulationServices* simManager() const;
1157  VRF4API_METHOD DtSimulationServices* simManager();
1158 
1161  bool reevaluateFlag = false, DtTime evaluationPeriod = 0);
1162 
1163  VRF4API_METHOD DtVrfObjectPlanAdministrator* planAdministrator();
1164  VRF4API_METHOD DtSimObjectReference lookupVrfObjectByMarkingText(const DtString&) const;
1165  VRF4API_METHOD const DtReaderWriter::SearchPaths& searchPaths() const;
1167 };
1168 
1170 {
1172 }
1173 
1175 {
1177 }
1178 
1179 #include "localObjectManager.inl"
UUID is a unique ID wrapper class.
Definition: uuid.h:59
DtUUID superior
Definition: localObjectManager.h:1127
Class Description: DtVrfSimulationObjectGroupGeometry is a specialized that class will calculate obje...
Definition: vrfSimulationObjectGroupGeometry.h:50
std::map< int, DtUUID > myForceLevelNodesByUUID
Definition: localObjectManager.h:1119
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:1080
class DtLocalObjectManager:
Definition: localObjectManager.h:151
DtString mySimObjectType
Type of DtSimObject to create. Types are defined in simObjectTypes.h.
Definition: localObjectManager.h:1044
class DtIfModifyVrfOverlay
Definition: ifModifyVrfOverlay.h:47
Instances of DtVrfParameterDb are the database of DtVrfObjectParameters objects used in the construct...
Definition: vrfParameterDb.h:40
tbb::spin_rw_mutex myVisualMarkingsMutex
Definition: localObjectManager.h:1149
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:1058
DtSimulationServices * mySimulationServices
Definition: localObjectManager.h:1046
tbb::mutex myTopLevelNodeCreationMutex
Definition: localObjectManager.h:1006
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:1105
const char DtDefaultFormationString[]
Definition: extendedAggregateEnums.h:23
DtVrfObjectModifyQueue myObjectsToModifyQueue
Definition: localObjectManager.h:1060
Definition: localObjectManager.h:1122
DtSimObjectListActivityCallbackList myAboutToBeRemovedSimObjectCallbackList
List of DtSimObjectListActivityCallbackFcn*s. Clients register callback functions on this list for no...
Definition: localObjectManager.h:1033
PendingStruct()
Definition: localObjectManager.h:1124
DtSimObjectListActivityCallbackList myAboutToBeLoadedSimObjectCallbackList
List of DtSimObjectListActivityCallbackFcn*s. Clients register callback functions on this list for no...
Definition: localObjectManager.h:1018
void(* DtSimObjectListActivityCallbackFcn)(const DtLocalObject *simObject, void *usr)
Callback function definition.
Definition: simObjectListActivityCallbackInfo.h:17
double myTimeToPublishNextStateUpdate
Definition: localObjectManager.h:1064
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:1145
DtLocalObject * myDynamicTerrainServer
Definition: localObjectManager.h:1066
std::map< DtUUID, boost::signals2::connection > PostInitParamsConnections
Definition: localObjectManager.h:1141
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:1004
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:1148
bool(* DtVrfObjectUserInitFcn)(DtLocalObject *vrfObject, void *usr)
User action function definition for createAndInitVrfObject()
Definition: localObjectCreateInformation.h:25
makVrf::DtStateDataManager * myStateDataManager
Definition: localObjectManager.h:1102
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:1106
PendingSuperiorsToSet myPendingSuperiorsToSet
Definition: localObjectManager.h:1137
tbb::spin_mutex myPostInitParamsConnectionsMutex
Definition: localObjectManager.h:1143
DtObjectQueuedForRemovalCallbackList myObjectQueuedForRemovalCallbackList
Definition: localObjectManager.h:1072
DtVrfObjectUUIDChangedCallbackInfo()
Definition: localObjectManager.h:121
Arguments passed by the DtLocalObjectManager::addUUIDChangedCallback callbacks.
Definition: localObjectManager.h:119
std::list< DtModifyQueueEntryPtr > DtVrfObjectModifyQueue
Definition: localObjectManager.h:1059
class DtIfModifyVrfObject:
Definition: ifModifyVrfObject.h:50
const std::vector< DtEntityType > & stealthTypes() const
Definition: localObjectManager.h:832
std::set< DtLocalObject * > myCompleteObjectAddition
Definition: localObjectManager.h:1095
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:30
int myAppIdRangeMax
Definition: localObjectManager.h:1097
Definition: ownershipTransferManager.h:26
DtNameChangedCallbackList myObjectNameChangedCallbackList
Definition: localObjectManager.h:1069
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:1054
std::set< DtString > myObjectsDeletedThisTick
Definition: localObjectManager.h:1107
bool myInitialTimeSetThisFrame
Definition: localObjectManager.h:1091
static const DtUUID & nullUUID()
DtCallbackList< const DtVrfObjectNameChangedCallbackInfo & > DtNameChangedCallbackList
Definition: localObjectManager.h:1068
Definition: coordSystem.h:54
Definition: event.h:13
bool myRunFullyThreaded
Definition: localObjectManager.h:1093
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:1010
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:1126
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:90
std::vector< DtEntityType > myStealthTypes
Definition: localObjectManager.h:1087
A utility class for use with DtConsoleCommandManager. This class takes ownership of an arbitrary numb...
Definition: consoleCommandManager.h:168
const DtSimObject * myVrfObject
Definition: localObjectManager.h:115
tbb::spin_rw_mutex mySimObjectListMutex
Hashlist of all DtLocalObject*s, keyed on DtUUID.
Definition: localObjectManager.h:1009
DtCommunicationManager * communicationManager() const
Definition: localObjectManager.h:281
DtVrfNameGenerator * vrfNameGenerator() const
Definition: localObjectManager.h:836
bool myWasValid
Definition: localObjectManager.h:1085
bool removingAllObjects() const
Whether ot not all objects are being removed.
Definition: localObjectManager.h:298
PostInitParamsConnections myPostInitParamsConnections
Definition: localObjectManager.h:1142
DtCommunicationManager * myCommunicationManager
Definition: localObjectManager.h:1103
Definition: echelonId.h:13
DtSimObjectListActivityCallbackList mySimObjectConvertedToRemoteCallbacks
List of DtSimObjectListActivityCallbackFcn*s for objects that have been converted to a remote object...
Definition: localObjectManager.h:1039
DtUUIDChangedCallbackList myObjectUUIDChangedCallbackList
Definition: localObjectManager.h:1075
tbb::spin_mutex myCompleteObjectAdditionMutex
Definition: localObjectManager.h:1094
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:1028
std::map< DtString, DtRwStringAttributeList * > VisualMarkings
Definition: localObjectManager.h:1147
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:95
DtConsoleCommandOwner * myConsoleCommands
Definition: localObjectManager.h:1077
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:88
PendingSetSuperior myPendingSetSuperior
Definition: localObjectManager.h:1134
class DtCreateQueueEntry:
Definition: createQueueEntry.h:25
DtSimObjectListActivityCallbackList myAboutToBeAddedSimObjectCallbackList
List of DtSimObjectListActivityCallbackFcn*s. Clients register callback functions on this list for no...
Definition: localObjectManager.h:1023
DtManagedObjectListConstPtr myForceLevelNodes
Definition: localObjectManager.h:1120
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:1062
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
DtCallbackList< const DtVrfObjectUUIDChangedCallbackInfo & > DtUUIDChangedCallbackList
Definition: localObjectManager.h:1074
bool myCanSimulate
Definition: localObjectManager.h:1084
std::map< DtUUID, PendingStruct > PendingSetSuperior
Definition: localObjectManager.h:1133
tbb::spin_mutex myObjectsCreatedThisTickMutex
Definition: localObjectManager.h:1110
DtCallbackList< const DtLocalObject * > DtObjectQueuedForRemovalCallbackList
Definition: localObjectManager.h:1071
DtRemoteComponentAttachmentManager * remoteComponentAttachmentManager()
Returns the remote component attachment manager.
Definition: localObjectManager.h:1169
bool myCreatedCharacterManager
Definition: localObjectManager.h:1082
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:1116
tbb::spin_mutex myRemovalQueueMutex
Definition: localObjectManager.h:1100
std::map< DtUUID, std::set< DtUUID > > PendingSuperiorsToSet
Definition: localObjectManager.h:1136
std::vector< DtLocalObject * > myVrfObjectsToDelete
Definition: localObjectManager.h:1089
const DtLocalObject * myVrfObject
Definition: localObjectManager.h:125
Definition: simInterfaceContent.h:45
PendingStruct(const DtUUID &sup, int des)
Definition: localObjectManager.h:1125
int designator
Definition: localObjectManager.h:1130
tbb::spin_rw_mutex myObjectWasRemovedThisTickMutex
Definition: localObjectManager.h:1113
std::set< DtUUID > myObjectWasRemovedThisTick
Definition: localObjectManager.h:1114
boost::signals2::scoped_connection myPlaceObjectEventConnection
Definition: localObjectManager.h:1139
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:1013
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:1036
tbb::atomic< int > myNumLocalPublished
Entity Identifier to be consistent with current DtIfVrfObjectDeleted message.
Definition: localObjectManager.h:1109
DtCallbackList< bool > DtValidStateChangedCallbackList
Definition: localObjectManager.h:1079
#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:1099
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
DtUUID myOldUUID
Definition: localObjectManager.h:121
std::map< DtUUID, bool > myObjectsToRemoveQueue
Objects queued for removal; processed each tick by removeObjectsQueuedForRemoval. ...
Definition: localObjectManager.h:1050
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:1118
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:1111
This class holds the state data that represents each simulation object in the system.
Definition: stateDataManager.h:73

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)