VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vrfComponentProcessorInterface.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
6 #pragma once
7 
9 #include <tbb/spin_rw_mutex.h>
10 
11 namespace makVrv
12 {
13  class DtSimEntryObjectAgent;
14  class DtSimStateObjectAgent;
15  class DtBaseConnection;
16 }
17 
18 namespace makVrf
19 {
20  class DtSimDataProcessorManager;
21  class DtStateComponent;
22 
24  {
25  public:
26  virtual void createAndSendState(const std::set<const DtFrameStateInterface*>&, makVrv::DtSimStateObjectAgent&,
27  bool force = false) = 0;
28  };
29 
30  template <typename T_Agent, typename T_Component>
32  {
33  public:
34 
37 
39  virtual ~DtVrfComponentProcessor();
40 
41 
45 
48  virtual void queueStateComponentRemoved(const DtStateComponent*);
49 
51  virtual void queueFunction(const boost::function<void ()>& function);
52 
54  virtual bool componentDiscovered(const DtFrameStateInterface*);
56 
58  virtual void stateComponentDiscovered(const DtStateComponent*, UInt64);
59 
60  protected:
61  void setupComponentData();
62 
63  virtual void slot_frameAdvanced();
64  virtual bool shouldForceObjectUpdate(const DtFrameStateInterface*) const;
65  virtual void componentUpdated(const DtFrameStateInterface*);
66 
69 
71 
73 
74  //A Listener and a driver which will be updated with it.
76  {
77  public:
78 
79  ComponentUpdater(const std::set<const DtFrameStateInterface*>& listener,
80  makVrv::DtSimStateObjectAgent& driver,
82  : myFrameStateInterfaces(listener)
83  , myObjectAgent(&driver)
84  , myDataProcessorInterface(&iface)
85  {
86  }
87 
92  {
93  }
94 
96  {
100 
101  return *this;
102  }
103 
104  //Are the updaters equal
105  bool operator==(const ComponentUpdater& orig) const
106  {
107  return (myObjectAgent == orig.myObjectAgent);
108  }
109 
110  void update(double)
111  {
112  if (myFrameStateInterfaces.size() &&
113  (myDataProcessorInterface->vantageIdFromLegionId((*myFrameStateInterfaces.begin())->legionGlobalId()) != 0))
114  {
116  }
117  }
118 
119  protected:
120  std::set<const DtFrameStateInterface*> myFrameStateInterfaces;
121  makVrv::DtSimStateObjectAgent* myObjectAgent;
123  };
124 
125  virtual void dataDiscoveredByLegionId(Legion::UInt64 lid);
126 
127  protected:
131 
133  makVrv::DtSimEntryObjectAgent* mySimEntryAgent;
134 
136  typedef std::map<makVrv::DtSimEntryUpdater::UpdateRate, UpdaterGroup> UpdateGroupMap;
137 
139 
140  typedef std::set<makVrv::DtUniqueID> EntityIdList;
142 
147  {
148  std::set<const DtFrameStateInterface*> myFrameStateInterfaces;
149  makVrv::DtSimStateObjectAgent* myAgent;
151  };
152 
153  typedef std::map<makVrv::DtUniqueID, ComponentInstance> AgentMap;
155 
156  boost::signals2::connection myVantageToLegionIdMapperConnection;
157 
158  std::set<makVrv::DtUniqueID> myAwaitingValidId;
160  tbb::spin_rw_mutex myMutex;
161  };
162 }
makVrv::DtBalancedUpdater< ComponentUpdater > UpdaterGroup
Definition: vrfComponentProcessorInterface.h:135
DtSimDataProcessorManager * mySimDataProcessorManager
Definition: vrfComponentProcessorInterface.h:159
makVrv::DtSimStateObjectAgent * myObjectAgent
Definition: vrfComponentProcessorInterface.h:121
DtSimDataProcessorManager * simDataProcessorManager()
In theory, the state data should have a big blob of data for all components – the state data entries ...
Definition: vrfComponentProcessorInterface.h:146
UpdateRate
Definition: DtSimEntryUpdater.h:31
makVrv::DtBaseConnection & mySimulation
Definition: vrfComponentProcessorInterface.h:130
virtual void queueStateComponentRemoved(const DtStateComponent *)
virtual makVrv::DtUniqueID vantageIdFromLegionId(Legion::UInt64) const
This class will manage the data processors. It will be the spot that the data processors can post mes...
Definition: simDataProcessorManager.h:25
DtStateDataManager * myStateDataManager
Definition: vrfComponentProcessorInterface.h:128
std::set< const DtFrameStateInterface * > myFrameStateInterfaces
Definition: vrfComponentProcessorInterface.h:148
std::set< makVrv::DtUniqueID > myAwaitingValidId
Definition: vrfComponentProcessorInterface.h:158
virtual makVrv::DtUniqueID idForStateComponent(const DtFrameStateInterface *)
makVrv::DtSimEntryObjectAgent * mySimEntryAgent
Definition: vrfComponentProcessorInterface.h:133
makVrv::DtSignalConnectionManager myConnectionManager
Definition: vrfComponentProcessorInterface.h:129
Definition: vrfDataProcessorInterface.h:35
virtual void forceObjectUpdate(makVrv::DtUniqueID)
The DtBaseConnection is an abstract class.
Definition: DtBaseConnection.h:38
bool operator==(const ComponentUpdater &orig) const
Definition: vrfComponentProcessorInterface.h:105
virtual bool componentDiscovered(const DtFrameStateInterface *)
Creates/removes agents for data.
makVrv::DtSimEntryUpdater::UpdateRate myRate
Definition: vrfComponentProcessorInterface.h:150
tbb::spin_rw_mutex myMutex
Definition: vrfComponentProcessorInterface.h:160
std::set< const DtFrameStateInterface * > myFrameStateInterfaces
Definition: vrfComponentProcessorInterface.h:120
virtual ~DtVrfComponentProcessor()
DTOR.
virtual void queueFunction(const boost::function< void()> &function)
Put a function in the sim function queue, for threadsafe calling.
ComponentUpdater(const ComponentUpdater &orig)
Definition: vrfComponentProcessorInterface.h:88
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
unsigned long long UInt64
Definition: stateDataTypes.h:17
DtBalanacedUpdater updates updatee classes at a desired rate in a fair (each instance gets the same n...
Definition: DtBalancedUpdater.h:26
virtual bool shouldForceObjectUpdate(const DtFrameStateInterface *) const
void update(double)
Definition: vrfComponentProcessorInterface.h:110
DtTimedSection myTimer
Definition: vrfComponentProcessorInterface.h:132
ComponentUpdater(const std::set< const DtFrameStateInterface * > &listener, makVrv::DtSimStateObjectAgent &driver, DtComponentProcessorInterface &iface)
Definition: vrfComponentProcessorInterface.h:79
Definition: stateComponent.h:51
virtual void dataDiscoveredByLegionId(Legion::UInt64 lid)
#define DT_DLL_vrfGuiNetworkCommon
This file is used to determine how to build.
Definition: vrfGuiNetworkCommonDefines.h:24
UpdateGroupMap myRefreshRateGroups
Definition: vrfComponentProcessorInterface.h:138
makVrv::DtSimStateObjectAgent * myAgent
Definition: vrfComponentProcessorInterface.h:149
virtual void vantageIdMapped(makVrv::DtUniqueID, Legion::UInt64)
virtual void componentRemoved(UInt64, makVrv::DtUniqueID, const DtFrameStateInterface *)
virtual void componentUpdated(const DtFrameStateInterface *)
virtual void setObjectUpdateRate(makVrv::DtUniqueID uniqueId, makVrv::DtSimEntryUpdater::UpdateRate rate)
Set a particular object update.
virtual void createAndSendState(const std::set< const DtFrameStateInterface * > &, makVrv::DtSimStateObjectAgent &, bool force=false)=0
EntityIdList myForceUpdateList
Definition: vrfComponentProcessorInterface.h:141
std::map< makVrv::DtSimEntryUpdater::UpdateRate, UpdaterGroup > UpdateGroupMap
Definition: vrfComponentProcessorInterface.h:136
boost::signals2::connection myVantageToLegionIdMapperConnection
Definition: vrfComponentProcessorInterface.h:156
AgentMap myAgents
Definition: vrfComponentProcessorInterface.h:154
std::map< makVrv::DtUniqueID, ComponentInstance > AgentMap
Definition: vrfComponentProcessorInterface.h:153
virtual void queueStateComponentDiscovered(const DtStateComponent *)
Call this method to queue a state component discovered or removed.
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:282
DtVrfComponentProcessor(DtStateDataManager *, makVrv::DtBaseConnection &)
CTOR.
Definition: vrfComponentProcessorInterface.h:75
virtual void stateComponentDiscovered(const DtStateComponent *, UInt64)
Calls DtFrameStateInterface versions.
virtual makVrv::DtUniqueID vantageIdFromLegionId(Legion::UInt64 lid) const =0
Definition: vrfComponentProcessorInterface.h:23
ComponentUpdater & operator=(const ComponentUpdater &orig)
Definition: vrfComponentProcessorInterface.h:95
DtComponentProcessorInterface * myDataProcessorInterface
Definition: vrfComponentProcessorInterface.h:122
Definition: vrfComponentProcessorInterface.h:31
This class holds the state data that represents each simulation object in the system.
Definition: stateDataManager.h:71
std::set< makVrv::DtUniqueID > EntityIdList
Definition: vrfComponentProcessorInterface.h:140

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)