VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtAgentManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
16 
17 #include <boost/smart_ptr/detail/atomic_count.hpp>
18 #include <boost/thread/condition.hpp>
19 #include <boost/thread/mutex.hpp>
20 #include <boost/signals.hpp>
21 #include <boost/unordered_map.hpp>
22 
23 #include <list>
24 #include <map>
25 #include <vector>
26 
27 namespace makVrv
28 {
29  class DtAsynchronousAgentManager;
30  class DtCoordinateSystem;
31  class DtDe;
32  class DtMessage;
33  class DtSceneProctor;
34  class DtAgentUpdateResolverInterface;
35  class DtAgent;
36 
42  {
43  public:
44 
46 
49 
51  virtual ~DtAgentManager();
52 
56  virtual void cleanup();
57 
61  virtual void tick();
62 
64  virtual void updateScene(DtMessage& message);
65 
68  virtual DtAgentUpdateResolverInterface* findUpdater(DtUniqueID id);
69 
71  DtElementID findElementId(DtUniqueID id);
72 
76  virtual bool sceneObjectIsVisible(DtElementID id) const;
77 
78  //@name DtAsynchronousAgentManagerInterfaces related functions.
80 
87  virtual DtAsynchronousAgentManager* createAsynchronousManager(const std::string& ownerName);
88 
91  void checkForIgLock(bool forceLock = false);
92 
98  virtual DtDe& acquireLockedIg();
99 
105  virtual void releaseLockedIg();
106 
108 
110  inline DtDe& de()
111  {
112  return myDe;
113  }
114 
118  void clear();
119 
122  boost::signal<void (DtUniqueID id)> signal_objectCreated;
123 
124  protected:
125 
133  virtual unsigned char acquireNamespaceId(
134  DtAsynchronousAgentManager* sceneManagerInterface,
135  const std::string& ownerName);
136 
139  virtual void releaseNamespaceId(unsigned char nsId);
140 
144  {
145 
146  public:
147 
149  : message(0)
150  , distribute(false)
151  {
152  }
153 
156 
157  };
158 
159  typedef std::vector<MessageParcel> MessageParcelVector;
160 
166  virtual void addAsynchronousUpdateMessages(MessageParcelVector& messages);
167 
168  typedef std::vector<DtMessage*> MessageList;
169 
172  void distributeAndUpdate( MessageList& masterMessages, MessageList& distributedMessages );
173 
177  virtual void localEncodeAndUpdateScene();
178 
180  virtual void createObject(const std::string& className, DtUniqueID id);
181 
183  virtual void updateObject(DtUniqueID id,DtMessage& msg, unsigned int updatesize);
184 
186  virtual void destroyObject(DtUniqueID id);
187 
188  protected:
189 
190  typedef boost::function< void (DtAgentManagerInterface*) >
192 
196  {
197  //Local copy.
198  std::string name;
199  //Used to pass functions to be executed on the asynchronous interface.
201  };
202 
203  typedef boost::unordered_map<DtUniqueID,AsynchronousInterfaceEntry> NamespaceMap;
204  typedef boost::unordered_map<DtUniqueID,DtAgentUpdateResolverInterface*> UpdaterMap;
205  typedef std::vector<DtAgent*> DriverVector;
206 
207 
209 
211  std::pair<DtUniqueID,DtAgentUpdateResolverInterface*> myLastObjectCache;
216 
217  boost::detail::atomic_count myAtomicWaitingCount;
218  boost::condition myRequestIgCondition;
219  boost::condition myReleaseIgCondition;
220  boost::mutex myMonitor;
221 
222  //Force checking the asynchronous messages.
224 
225  };
226 
230  {
231 
232  public:
234  static DtSceneManagerCreator& instance(DtDe& theIG);
235 
237  static void registerInstance(DtDe& theIG,DtSceneManagerCreator* anInstance);
238 
240  virtual DtAgentManager* create(DtDe&);
241  };
242 
243 }

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)