VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
managedObjectList.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2005 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
15 #include <vrfutil/rwUUID.h>
16 
17 #include <vlutil/vlConfig.h>
18 #include <list>
19 #include <vlutil/vlSmartPointers.h>
20 #include <vlutil/vlTime.h>
21 
22 #include <tbb/spin_mutex.h>
23 
27 
29 
32 typedef DtBoost::shared_ptr<DtManagedObjectList> DtManagedObjectListPtr;
35 typedef DtBoost::shared_ptr<const DtManagedObjectList> DtManagedObjectListConstPtr;
36 
46 {
47 private:
51  DtManagedObjectList& operator=(DtManagedObjectList& orig);
53 
54 protected:
58 
60  virtual void init();
61 
62  virtual void init(const std::vector<DtSimObjectReference>&);
63 
64 public:
65  DtManagedObjectList(const DtSimulationServices* simServices,
66  const DtVrfObjectPredicate& predicate =
68  bool reevaluateFlag = false, DtTime evaluationPeriod = 0);
69 
71  DtManagedObjectList(const std::vector<DtSimObjectReference>& subordinates,
72  const DtVrfObjectPredicate& predicate);
73 
76  static DtManagedObjectListPtr create(
77  const DtSimulationServices* objectManager,
78  const DtVrfObjectPredicate& predicate =
80  bool reevaluatePeriodically = false, DtTime evaluationPeriod = 0.0);
81 
83  virtual ~DtManagedObjectList();
84 
86  virtual const DtVrfObjectPredicate& predicate() const;
87 
89  virtual void tick();
90 
92  virtual bool reevaluateFlag() const ;
93 
95  virtual DtTime evaluationPeriod() const;
96 
97  typedef std::set<DtSimObjectReference>::iterator iterator;
98  typedef std::set<DtSimObjectReference>::const_iterator const_iterator;
99 
100  static DtManagedObjectListPtr nullList();
101 
105  virtual iterator begin();
106  virtual const_iterator begin() const;
107  virtual iterator end();
108  virtual const_iterator end() const;
109  virtual size_t size() const;
111 
114  virtual const DtSimObject* find(const DtUUID& entityId) const;
117  virtual bool contains(const DtSimObjectReference& simObj) const;
118 
124  virtual void invalidate();
125 
127  double lastTimeModified() const
128  {
129  return myLastTimeModified;
130  }
131 
132 protected:
133  //add & remove using correct hash key type
134  virtual void add(DtSimObjectReference obj);
135  virtual void remove(const DtSimObject* obj);
136 
138  virtual void populateList();
139 
140  virtual void simObjectAdded(DtSimObjectReference ref);
141 
143  static void predicateCallback(DtSimObjectReference vrfObject,
144  DtVrfObjectPredicateEvaluator* predicateEval, void* userData);
145  virtual void processPredicateCallback(DtSimObjectReference vrfObject,
146  DtVrfObjectPredicateEvaluator* predicateEval);
147 
149  virtual bool shouldAdd(DtSimObjectReference ref) const;
150 
151 protected:
158  std::set<DtSimObjectReference> myFilteredObjectList;
159  tbb::spin_mutex myMutex;
160 
162  {
163  boost::signals2::connection removalConnection;
165  };
166 
167  typedef std::map<unsigned long long, ConnectionInformation > ConnectionMap;
169 
170  boost::signals2::scoped_connection mySimObjectAddedConnection;
171 
173 };
174 
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
DtTime myEvaluationPeriod
Definition: managedObjectList.h:156
double myLastTimeModified
Definition: managedObjectList.h:172
boost::signals2::connection removalConnection
Definition: managedObjectList.h:163
std::map< unsigned long long, ConnectionInformation > ConnectionMap
Definition: managedObjectList.h:167
tbb::spin_mutex myMutex
Definition: managedObjectList.h:159
bool myReevaluateFlag
Definition: managedObjectList.h:155
voidpf void uLong size
Definition: ioapi.h:39
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
Simple asynchronous callback queue.
Definition: vrfCallbackQueue.h:32
Contains the DtUUID class declaration.
std::set< DtSimObjectReference > myFilteredObjectList
Definition: managedObjectList.h:158
const DtSimulationServices * mySimulationServices
Definition: managedObjectList.h:152
Definition: managedObjectList.h:161
std::set< DtSimObjectReference >::iterator iterator
Definition: managedObjectList.h:97
DtVrfObjectPredicate * myNegatedPredicate
Definition: managedObjectList.h:154
Contains the DtVrfObjectPredicate class declaration.
Definition: vrfObjectPredicate.h:20
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
DtBoost::shared_ptr< DtManagedObjectList > DtManagedObjectListPtr
Evaluation period of -1 means to keep around but never evaluate beyond what the list already has...
Definition: managedObjectList.h:26
The predicate callback manager allows for registration of callbacks by sim object for predicates...
Definition: predicateCallbackManager.h:19
DtVrfObjectPredicate * myPredicate
Definition: managedObjectList.h:153
ConnectionMap myConnectionMap
Definition: managedObjectList.h:168
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:90
Definition: vrfObjectPredicateEvaluator.h:17
std::set< DtSimObjectReference >::const_iterator const_iterator
Definition: managedObjectList.h:98
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
static const DtVrfObjectPredicate & nullPredicate()
Returns an instance of a DtNullVrfObjectPredicate.
double lastTimeModified() const
The last wall clock time this list was modified (object added or removed)
Definition: managedObjectList.h:127
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
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
Instances of DtManagedObjectList are created and maintained by a DtManagedObjectListManager. The lists contains a subset of the objects in DtSimObjectManager that meet the specified predicate. If specified at creation time, the list automatically updates itself periodically. The lists should be handled though shared pointers.
Definition: managedObjectList.h:45
DtPredicateCallbackManager myPredicateCallbackManager
Definition: managedObjectList.h:157
DtSimObjectReference simObjectReference
Definition: managedObjectList.h:164
boost::signals2::scoped_connection mySimObjectAddedConnection
Definition: managedObjectList.h:170

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)