VR-Vantage API Documentation
DtAgent.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2012 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 <boost/type_traits.hpp>
18 #include <map>
19 #include <string>
20 #include <list>
21 
22 namespace makVrv
23 {
24  template <typename T,bool>
25  struct ArgOverrideAsId;
26 
27  template <typename T>
28  struct ArgOverrideAsId<T,false>
29  {
30  typedef T Type;
31  };
32 
33  template <typename T>
34  struct ArgOverrideAsId<T,true>
35  {
36  typedef DtUniqueID Type;
37  };
38 
41  template <typename T>
42  struct Arg
43  {
46  };
47 
48 
49 
53  {
54  public:
55 
58  friend class DtAgentManager;
59 
61  virtual ~DtAgent();
62 
65  inline DtAgentManagerInterface& sceneInterface();
66 
68  inline void setSceneInterface(DtAgentManagerInterface* iface);
69 
72  void init(DtAgentManagerInterface& sceneInterface, bool bDistribute);
73 
75  inline const std::string& className() const;
76 
77  //Makes the object clean, it will not generate an update.
78  inline void clean();
79 
80  //Makes the object dirty, indicating that it will be checked for an update
81  inline void dirty();
82 
84  inline DtUniqueID uniqueId() const;
85 
88  inline bool distributeMessages() const;
89 
90  protected:
91 
93  inline DtMessage& startNewCall(unsigned int function);
94 
96  void addCreateObjectCall();
97 
99  void addDeleteObjectCall();
100 
102  inline unsigned int callCount() const;
103 
104  //This declares a template function for queuing a single operation call with N arguments
107  #define DT_DECLARE_QUEUE_OPERATION_FUNCTION(argCount)\
108  template <typename C, MAKE_LIST(typename T,argCount) >\
109  inline void queueOperationCall(unsigned int state_function,\
110  void (C::*m)( MAKE_LIST(T,argCount) ),\
111  MAKE_MULTILIST(typename Arg<T,>::Type t,argCount));
112 
113  //No arguments are a special case
114  template <typename C>
115  inline void queueOperationCall(unsigned int state_function, void (C::*m)());
116 
128 
129  protected:
130 
132  DtAgent(/* Do not add parameters here. Add them to init(). */);
133 
135  DtAgent(DtAgent&);
136 
138  inline DtAgentManagerInterface::OrderedCallList& callList();
139 
140  protected:
141 
142  DtAgentManagerInterface* mySceneInterface;
143  DtUniqueID myUniqueId;
144  std::string myClassName;
145  bool myUpdateFlag;
146  DtAgentManagerInterface::OrderedCallList myCalls;
147  bool myDistributeObjectFlag;
148  };
149 
150 }
151 
152 #define DtAgent_INL_
153 #include "DtAgent.inl"
154 #undef DtAgent_INL_


Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)