MAK Data Logger API Documentation for HLA
lgrCommand.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #ifndef lgrCommand_H_
11 #define lgrCommand_H_
12 
13 #include "lgrCore.h"
14 
15 #include <runtimeValue.h>
16 #include <lgrExceptions.h>
17 #include <vlutil/vlString.h>
18 #include <vlutil/vlSmartPointers.h>
19 #include <map>
20 
21 namespace MAKLogger
22 {
23 
24  typedef unsigned char DtLgrDomainId;
25  typedef unsigned char DtLgrProtocolId;
26  typedef short DtLgrCommandId;
27 
31  {
32  public:
33 
35 
36  static const DtLgrDomainId Domain_Invalid = 0;
37  static const DtLgrDomainId Domain_System = 1;
38  static const DtLgrDomainId Domain_Player = 2;
39  static const DtLgrDomainId Domain_Recorder = 3;
40  static const DtLgrDomainId Domain_Editor = 4;
41  static const DtLgrDomainId Domain_Simulation = 5;
42  static const DtLgrDomainId Domain_Shared = 6;
43  static const DtLgrDomainId Domain_UserStart = 20;
45 
46  static const int theLgrDomainStringsCount;
47  static const char * const theLgrDomainStrings[];
48 
49  static DtLgrDomainId lookupDomain(const DtString& name);
50 
52 
53  static const DtLgrProtocolId Protocol_Invalid = 0;
54  static const DtLgrProtocolId Protocol_None = 1;
55  static const DtLgrProtocolId Protocol_DIS = 2;
56  static const DtLgrProtocolId Protocol_HLA_13 = 3;
57  static const DtLgrProtocolId Protocol_HLA_1516 = 4;
58  static const DtLgrProtocolId Protocol_HLA_1516E = 5;
59  static const DtLgrProtocolId Protocol_TENA = 6;
60  static const DtLgrProtocolId Protocol_Undefined = 7;
61  //@]
62 
63 
64  static const int theLgrProtocolsStringsCount;
65  static const char* theLgrProtocolsStrings[];
66 
67  static DtLgrProtocolId lookupProtocol(const DtString& name);
68 
69  static DtString lookupProtocolName(DtLgrProtocolId protocolId);
70 
72 
74 
76 
77  DtLgrDomainId domain();
78  DtLgrProtocolId protocol();
79 
80  bool operator==(const DtLgrCommandType& secondType) const;
81 
82  bool operator!=(const DtLgrCommandType& secondType) const;
83 
84  bool operator<(const DtLgrCommandType& secondType) const;
85 
86  bool operator>(const DtLgrCommandType& secondType) const;
87 
88  DtString toString();
89 
90  public:
91  static const char* domainToString(int domainValue);
92  static const char* protocolToString(int protocolValue);
93 
94  protected:
97  };
98 
100  template<>
102 
103 
104  typedef DtBoost::shared_ptr<DtAnyValue> DtAnyValueSP;
105  typedef std::map<DtString,DtAnyValueSP> DtCommandParams;
106  typedef DtBoost::shared_ptr<DtCommandParams> DtCommandParamsSP;
107 
111  {
112  public:
113 
115  DtCommand(DtLgrDomainId domain,DtLgrProtocolId protocol,DtLgrCommandId command,
116  const char* parametersBuffer=0);
117 
119  DtCommand(DtLgrDomainId domain,DtLgrProtocolId protocol,const DtString& commandName);
120 
122  DtCommand(const DtLgrCommandType& type,DtLgrCommandId command);
123 
125  DtCommand(const DtCommand& type);
126 
128  ~DtCommand();
129 
131  DtLgrCommandType type() const;
132 
134  DtLgrCommandId id() const;
135 
137  void setId(DtLgrCommandId id);
138 
140  const DtString* name() const;
141 
143  void setParameter(const DtString& name,DtAnyValue*);
144 
146  const DtAnyValue* parameter(const DtString& name) const;
147 
149  void serializeParameters(DtString& parameterBuffer) const;
150 
152  void deserializeParameters(const char* parameterBuffer);
153 
155  static const DtLgrCommandId theUnknownCommand = 0;
156 
160  bool operator==(const DtCommand&) const;
161  bool operator!=(const DtCommand&) const;
162  bool operator<(const DtCommand&) const;
163  bool operator>(const DtCommand&) const;
164 
165  protected:
170  };
171 
173  typedef DtBoost::shared_ptr<DtCommand> DtCommandSP;
174  //typedef const DtCommand DtCommandConst;
175  typedef DtBoost::shared_ptr<const DtCommand> DtResponse;
176 
178  #define DT_FACTORY_COMMAND(commandName,createParams,decodeParams)\
179  static DtCommandDefinition define##commandName##Command();\
180  static DtCommand create##commandName##Command createParams;\
181  static void decode##commandName##Command decodeParams;
182 
184  #define DT_FACTORY_COMMAND_EXT(commandId,commandName,createParams,decodeParams)\
185  static const DtLgrCommandId Command_##commandName = commandId;\
186  static DtCommandDefinition define##commandName##Command();\
187  static DtCommand create##commandName##Command createParams;\
188  static void decode##commandName##Command decodeParams;
189 
190 
192  #define DT_FACTORY_RESPONSE(responseName,createParams,decodeParams)\
193  static DtResponse create##responseName##Response createParams;\
194  static void decode##responseName##Response decodeParams;
195 
196 
197 
199  #define DT_FACTORY_RESPONSE_EXT(responseId,responseName,createParams,decodeParams)\
200  static const DtLgrCommandId Response_##responseName = responseId;\
201  static DtResponse create##responseName##Response createParams;\
202  static void decode##responseName##Response decodeParams;
203 
204 
206  template <typename ValueType>
207  void DtGetCommandParameter(const DtCommand& command,const DtString& name,ValueType& value);
208 
210  template <typename ValueType>
211  void DtGetResponseParameter(const DtResponse response,const DtString& name,ValueType& value);
212 
213  #define lgrCommand_INC_
214  #include "lgrCommand.inl"
215  #undef lgrCommand_INC_
216 }
217 
218 #endif

Document ID: Generated on Thu Apr 11 12:13:00 EDT 2013 from SVN revision 126011
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)