VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtAgentManagerInterface.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2010 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtAgentManagerInterface.h,v $ $Revision: 1.23 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #pragma once
14 
15 #include <vrvCore/vrvCore.h>
16 #include <vrvCore/DtUniqueID.h>
17 #include <vrvUtil/DtMessage.h>
18 
19 #include <boost/signal.hpp>
20 
21 #include <list>
22 #include <map>
23 #include <string>
24 #include <vector>
25 
26 #include <tbb/tbb_allocator.h>
27 
28 namespace makVrv
29 {
30  class DtMessage;
31  class DtAgent;
32  class DtAgentFactory;
33 
37  {
38  public:
39  //The scene manager (typically will need to interact directly with
41  friend class DtAgentManager;
42 
43  //Allow base Driver access to Master Scene, used to call protected functions.
44  friend class DtAgent;
45 
48  static const double IgnoreSimulationTime;
49 
52  unsigned char myNamespaceId);
53 
55  virtual ~DtAgentManagerInterface();
56 
58  inline DtUniqueID createNewUniqueId()
59  {
60  ++myFreeID;
61  //Clear most significant byte and place namespace id there.
62  return (myFreeID & 0x00FFFFFFFFFFFFFFULL) | (myNamespaceId << 56);
63  }
64 
66  static inline unsigned char namespaceFromUniqueId(DtUniqueID id)
67  {
68  return (unsigned char) (id >> 56);
69  }
70 
71  unsigned char namespaceId() const;
72 
74  inline bool uniqueIdFromAgentManagerInterface(const DtUniqueID& id) const
75  {
76  return namespaceId() == DtAgentManagerInterface::namespaceFromUniqueId(id);
77  }
78 
81  inline unsigned int createNewCallID()
82  {
83  return ++myUpdateCallIndex;
84  }
85 
88  virtual DtAgent* createNewObject(const std::string& objectClass, bool bDistribute);
89 
93  virtual void recreateObject(DtAgent* proxy);
94 
96  bool encodeUpdate( DtMessage& masterMsg, DtMessage& distributedMsg, double simulationTime );
97 
101  virtual void tick() = 0;
102 
103  protected:
104 
107  void deleteObject(DtAgent*);
108 
110  void queueObjectForUpdate(DtAgent* object);
111 
112  protected:
113 
115  {
116  unsigned int index;
119 
120  static inline bool sortCriteria(const IndexedMessage& a, const IndexedMessage& b)
121  {
122  return a.index < b.index;
123  }
124  };
125 
126  typedef std::list<IndexedMessage, tbb::tbb_allocator<IndexedMessage> > OrderedCallList;
127 
128 
130  typedef std::list<DtAgent*> AgentList;
131 
134  unsigned int myUpdateCallIndex;
137  //Pointer to constant Driver Factory.
140  };
141 }

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)