VR-Vantage
Loading...
Searching...
No Matches
DtAgent.inl
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2020 MAK Technologies, Inc.
3** All rights reserved.
4******************************************************************************/
5
9
10#ifndef DtAgent_INL_
11#error This file may only be included by DtAgent.h
12#endif
13
14namespace makVrv
15{
22
24 {
25 mySceneInterface = iface;
26 }
27
29 inline const std::string& DtAgent::className() const
30 {
31 return myClassName;
32 }
33
34 //Makes the object clean, it will not generate an update.
35 inline void DtAgent::clean()
36 {
37 if(myUpdateFlag)
38 {
39 myCalls.clear();
40 myUpdateFlag = false;
41 }
42 }
43
44 //Makes the object dirty, indicating that it will be checked for an update
45 inline void DtAgent::dirty()
46 {
47 if(!myUpdateFlag)
48 {
49 mySceneInterface->queueObjectForUpdate(this);
50 myUpdateFlag = true;
51 }
52 }
53
56 {
57 return myUniqueId;
58 }
59
60
62 inline DtMessage& DtAgent::startNewCall(unsigned int function)
63 {
64 if (myThreadId != DtThread::GetCurrentThreadHandle())
65 {
66 DtTHROW_NEW(DtCorruptedState, "Agent used from wrong thread.");
67 }
68
69 myCalls.resize(myCalls.size() + 1);
70 myCalls.back().index = mySceneInterface->createNewCallID();
71 myCalls.back().message << myUniqueId << function;
72 myCalls.back().distributeMessage = myDistributeObjectFlag;
73 return myCalls.back().message;
74 }
75
76 inline unsigned int DtAgent::callCount() const
77 {
78 return myCalls.size();
79 }
80
81
86
88 inline bool DtAgent::distributeMessages() const
89 {
91 }
92
93 //The implementation of the operation function call. It encodes the state function
94 //Id and then each argument into a Message, and signals the object driver
95 //as dirty which makes the message get delivered.
96#define DT_DEFINE_QUEUE_OPERATION_FUNCTION(argCount)\
97 template <typename C, MAKE_LIST(typename T,argCount)>\
98 void DtAgent::queueOperationCall(unsigned int state_function,\
99 void (C::*m)(MAKE_LIST(T,argCount)),\
100 MAKE_MULTILIST(typename Arg<T,>::Type t,argCount))\
101 {\
102 DtMessage& msg = startNewCall(state_function);\
103 msg << MAKE_STREAM(t,argCount);\
104 dirty();\
105 }
106
107 //Special case for zero arguments
108 template <typename C>
109 void DtAgent::queueOperationCall(unsigned int state_function, void (C::*m)())
110 {
111 startNewCall(state_function);
112 dirty();
113 }
114
125}
#define DT_DEFINE_QUEUE_OPERATION_FUNCTION(argCount)
Definition DtAgent.inl:96
void setSceneInterface(DtAgentManagerInterface *iface)
Set the internal scene interface pointer.
Definition DtAgent.inl:23
void dirty()
Definition DtAgent.inl:45
void queueOperationCall(unsigned int state_function, void(C::*m)())
Definition DtAgent.inl:109
bool distributeMessages() const
Accessor for myDistributeMessageFlag. Returns true if messages are going to be distributed to each sl...
Definition DtAgent.inl:88
const std::string & className() const
Get the class name.
Definition DtAgent.inl:29
std::string myClassName
Definition DtAgent.h:146
DtMessage & startNewCall(unsigned int function)
Inline get arguments for a operation call operation.
Definition DtAgent.inl:62
DtUniqueID myUniqueId
Definition DtAgent.h:145
DtAgentManagerInterface::OrderedCallList & callList()
Get a pointer to the call list.
Definition DtAgent.inl:82
DtAgentManagerInterface * mySceneInterface
Definition DtAgent.h:144
unsigned int callCount() const
Get the number of calls.
Definition DtAgent.inl:76
DtAgentManagerInterface::OrderedCallList myCalls
Definition DtAgent.h:148
bool myDistributeObjectFlag
Definition DtAgent.h:149
void clean()
Definition DtAgent.inl:35
DtUniqueID uniqueId() const
inline accessor
Definition DtAgent.inl:55
friend class DtAgentManagerInterface
Allow the scene manager interface access the processed functions.
Definition DtAgent.h:59
DtAgentManagerInterface & sceneInterface()
Definition DtAgent.inl:18
bool myUpdateFlag
Definition DtAgent.h:147
DtThreadId myThreadId
Definition DtAgent.h:150
std::list< IndexedMessage, tbb::tbb_allocator< IndexedMessage > > OrderedCallList
Definition DtAgentManagerInterface.h:123
The IGI Message. Is easily encoded and decoding using stream operators. It also provides validation d...
Definition DtMessage.h:31
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16
unsigned long long DtUniqueID
Definition DtUniqueID.h:19