VR-Forces 5.0.1 Developer's Guide
 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) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
13 #include <vrvCore/DtUniqueID.h>
14 #include <vrvUtil/DtMessage.h>
15 
16 #include <vrvUtil/signalslib.h>
17 
18 #include <list>
19 #include <map>
20 #include <string>
21 #include <vector>
22 
23 #include <tbb/tbb_allocator.h>
24 
25 namespace makVrv
26 {
27  class DtMessage;
28  class DtAgent;
29  class DtAgentFactory;
30 
34  {
35  public:
36  //The scene manager (typically will need to interact directly with
38  friend class DtAgentManager;
39 
40  //Allow base Driver access to Master Scene, used to call protected functions.
41  friend class DtAgent;
42 
45  static const double IgnoreSimulationTime;
46 
49  unsigned char myNamespaceId);
50 
52  virtual ~DtAgentManagerInterface();
53 
56  {
57  ++myFreeID;
58  //Clear most significant byte and place namespace id there.
59  return (myFreeID & 0x00FFFFFFFFFFFFFFULL) | (myNamespaceId << 56);
60  }
61 
63  static inline unsigned char namespaceFromUniqueId(DtUniqueID id)
64  {
65  return (unsigned char) (id >> 56);
66  }
67 
68  unsigned char namespaceId() const;
69 
71  inline bool uniqueIdFromAgentManagerInterface(const DtUniqueID& id) const
72  {
73  return namespaceId() == DtAgentManagerInterface::namespaceFromUniqueId(id);
74  }
75 
78  inline unsigned int createNewCallID()
79  {
80  return ++myUpdateCallIndex;
81  }
82 
85  virtual DtAgent* createNewObject(const std::string& objectClass, bool bDistribute);
86 
90  virtual void recreateObject(DtAgent* proxy);
91 
93  bool encodeUpdate( DtMessage& masterMsg, DtMessage& distributedMsg, double simulationTime );
94 
98  virtual void tick() = 0;
99 
100  protected:
101 
104  void deleteObject(DtAgent*);
105 
107  void queueObjectForUpdate(DtAgent* object);
108 
109  protected:
110 
112  {
113  unsigned int index;
116 
117  static inline bool sortCriteria(const IndexedMessage& a, const IndexedMessage& b)
118  {
119  return a.index < b.index;
120  }
121  };
122 
123  typedef std::list<IndexedMessage, tbb::tbb_allocator<IndexedMessage> > OrderedCallList;
124 
125 
127  typedef std::list<DtAgent*> AgentList;
128 
131  unsigned int myUpdateCallIndex;
134  //Pointer to constant Driver Factory.
137  };
138 }
OrderedCallList myMasterList
Definition: DtAgentManagerInterface.h:136
unsigned int index
Definition: DtAgentManagerInterface.h:113
static unsigned char namespaceFromUniqueId(DtUniqueID id)
Get the namespace id from a unique id.
Definition: DtAgentManagerInterface.h:63
The IGI Message. Is easily encoded and decoding using stream operators. It also provides validation d...
Definition: DtMessage.h:30
bool uniqueIdFromAgentManagerInterface(const DtUniqueID &id) const
Check to.
Definition: DtAgentManagerInterface.h:71
static const double IgnoreSimulationTime
Special time value used to encode messages where the sim time provided is ignored.
Definition: DtAgentManagerInterface.h:45
A distributed object agent base class.
Definition: DtAgent.h:54
Definition: DtAgentManagerInterface.h:111
AgentList myToBeDeletedObjects
Definition: DtAgentManagerInterface.h:133
DtUniqueID myFreeID
Definition: DtAgentManagerInterface.h:130
std::list< DtAgent * > AgentList
Type of drivers.
Definition: DtAgentManagerInterface.h:127
DtUniqueID createNewUniqueId()
Generate a new id.
Definition: DtAgentManagerInterface.h:55
AgentList myUpdatedObjects
Definition: DtAgentManagerInterface.h:132
unsigned int createNewCallID()
Create a new call id. Call ids are internal ids for function calls made onto objects.
Definition: DtAgentManagerInterface.h:78
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
bool distributeMessage
Definition: DtAgentManagerInterface.h:115
const DtAgentFactory * myDriverFactory
Definition: DtAgentManagerInterface.h:135
DtUniqueID myNamespaceId
Definition: DtAgentManagerInterface.h:129
DtMessage message
Definition: DtAgentManagerInterface.h:114
The DtAgentManager manages the distributed scene object framework. This includes the objects and upda...
Definition: DtAgentManager.h:38
std::list< IndexedMessage, tbb::tbb_allocator< IndexedMessage > > OrderedCallList
Definition: DtAgentManagerInterface.h:123
unsigned int myUpdateCallIndex
Definition: DtAgentManagerInterface.h:131
static bool sortCriteria(const IndexedMessage &a, const IndexedMessage &b)
Definition: DtAgentManagerInterface.h:117
Contains makVrv::DtUniqueID type.
The abstract interface necessary for agents.
Definition: DtAgentManagerInterface.h:33
The scene object creators are registered with the scene object factory for accessing DtSceneObjectCre...
Definition: DtAgentFactory.h:33
Contains DLL export macros.

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)