VR-Vantage 3.1 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtAgent.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>
14 #include <vrvCore/DtAgentManager.h>
15 #include <vrvUtil/templateUtil.h>
16 
17 #include <vlutil/vlThread.h>
18 
19 #include <boost/type_traits.hpp>
20 #include <map>
21 #include <string>
22 #include <list>
23 
24 namespace makVrv
25 {
26  template <typename T,bool>
27  struct ArgOverrideAsId;
28 
29  template <typename T>
30  struct ArgOverrideAsId<T,false>
31  {
32  typedef T Type;
33  };
34 
35  template <typename T>
36  struct ArgOverrideAsId<T,true>
37  {
38  typedef DtUniqueID Type;
39  };
40 
43  template <typename T>
44  struct Arg
45  {
48  };
49 
50 
51 
55  {
56  public:
57 
60  friend class DtAgentManager;
61 
63  virtual ~DtAgent();
64 
67  inline DtAgentManagerInterface& sceneInterface();
68 
70  inline void setSceneInterface(DtAgentManagerInterface* iface);
71 
74  void init(DtAgentManagerInterface& sceneInterface, bool bDistribute);
75 
77  inline const std::string& className() const;
78 
79  //Makes the object clean, it will not generate an update.
80  inline void clean();
81 
82  //Makes the object dirty, indicating that it will be checked for an update
83  inline void dirty();
84 
86  inline DtUniqueID uniqueId() const;
87 
90  inline bool distributeMessages() const;
91 
92  protected:
93 
95  inline DtMessage& startNewCall(unsigned int function);
96 
98  void addCreateObjectCall();
99 
101  void addDeleteObjectCall();
102 
104  inline unsigned int callCount() const;
105 
106  //This declares a template function for queuing a single operation call with N arguments
109  #define DT_DECLARE_QUEUE_OPERATION_FUNCTION(argCount)\
110  template <typename C, MAKE_LIST(typename T,argCount) >\
111  inline void queueOperationCall(unsigned int state_function,\
112  void (C::*m)( MAKE_LIST(T,argCount) ),\
113  MAKE_MULTILIST(typename Arg<T,>::Type t,argCount));
114 
115  //No arguments are a special case
116  template <typename C>
117  inline void queueOperationCall(unsigned int state_function, void (C::*m)());
118 
131  protected:
132 
134  DtAgent(/* Do not add parameters here. Add them to init(). */);
135 
137  DtAgent(DtAgent&);
138 
140  inline DtAgentManagerInterface::OrderedCallList& callList();
141 
142  protected:
143 
144  DtAgentManagerInterface* mySceneInterface;
145  DtUniqueID myUniqueId;
146  std::string myClassName;
147  bool myUpdateFlag;
148  DtAgentManagerInterface::OrderedCallList myCalls;
149  bool myDistributeObjectFlag;
150  DtThreadId myThreadId;
151  };
152 
153 }
154 
155 #define DtAgent_INL_
156 #include "DtAgent.inl"
157 #undef DtAgent_INL_


Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)