VR-Forces 4.8 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 
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 }
OrderedCallList myMasterList
Definition: DtAgentManagerInterface.h:139
unsigned int index
Definition: DtAgentManagerInterface.h:116
static unsigned char namespaceFromUniqueId(DtUniqueID id)
Get the namespace id from a unique id.
Definition: DtAgentManagerInterface.h:66
The IGI Message.
Definition: DtMessage.h:33
bool uniqueIdFromAgentManagerInterface(const DtUniqueID &id) const
Check to.
Definition: DtAgentManagerInterface.h:74
static const double IgnoreSimulationTime
Special time value used to encode messages where the sim time provided is ignored.
Definition: DtAgentManagerInterface.h:48
A distributed object agent base class.
Definition: DtAgent.h:54
Definition: DtAgentManagerInterface.h:114
AgentList myToBeDeletedObjects
Definition: DtAgentManagerInterface.h:136
DtUniqueID myFreeID
Definition: DtAgentManagerInterface.h:133
std::list< DtAgent * > AgentList
Type of drivers.
Definition: DtAgentManagerInterface.h:130
DtUniqueID createNewUniqueId()
Generate a new id.
Definition: DtAgentManagerInterface.h:58
AgentList myUpdatedObjects
Definition: DtAgentManagerInterface.h:135
unsigned int createNewCallID()
Create a new call id.
Definition: DtAgentManagerInterface.h:81
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
bool distributeMessage
Definition: DtAgentManagerInterface.h:118
const DtAgentFactory * myDriverFactory
Definition: DtAgentManagerInterface.h:138
DtUniqueID myNamespaceId
Definition: DtAgentManagerInterface.h:132
DtMessage message
Definition: DtAgentManagerInterface.h:117
The DtAgentManager manages the distributed scene object framework.
Definition: DtAgentManager.h:38
unsigned long long DtUniqueID
Definition: DtUniqueID.h:22
std::list< IndexedMessage, tbb::tbb_allocator< IndexedMessage > > OrderedCallList
Definition: DtAgentManagerInterface.h:126
unsigned int myUpdateCallIndex
Definition: DtAgentManagerInterface.h:134
static bool sortCriteria(const IndexedMessage &a, const IndexedMessage &b)
Definition: DtAgentManagerInterface.h:120
Contains makVrv::DtUniqueID type.
The abstract interface necessary for agents.
Definition: DtAgentManagerInterface.h:36
The scene object creators are registered with the scene object factory for accessing DtSceneObjectCre...
Definition: DtAgentFactory.h:36
Contains DLL export macros.

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)