MAK Data Logger API Documentation for HLA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
lgrCommand.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 1992-2024 MAK Technologies, Inc
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <lgrCmds/lgrCmds.h>
13 
14 #include <lgrUtil/runtimeValue.h>
16 #include <vlutil/vlString.h>
17 #include <vlutil/vlSmartPointers.h>
18 #include <map>
19 
20 namespace MAKLogger
21 {
22 
23  typedef unsigned char DtLgrDomainId;
24  typedef unsigned char DtLgrProtocolId;
25  typedef short DtLgrCommandId;
26 
30  {
31  public:
32 
34 
35  static const DtLgrDomainId Domain_Invalid = 0;
36  static const DtLgrDomainId Domain_System = 1;
37  static const DtLgrDomainId Domain_Player = 2;
38  static const DtLgrDomainId Domain_Recorder = 3;
39  static const DtLgrDomainId Domain_Editor = 4;
40  static const DtLgrDomainId Domain_Simulation = 5;
41  static const DtLgrDomainId Domain_Shared = 6;
42  static const DtLgrDomainId Domain_UserStart = 20;
44 
45  static const int theLgrDomainStringsCount;
46  static const char * const theLgrDomainStrings[];
47 
48  static DtLgrDomainId lookupDomain(const DtString& name);
49 
51 
52  static const DtLgrProtocolId Protocol_Invalid = 0;
53  static const DtLgrProtocolId Protocol_None = 1;
54  static const DtLgrProtocolId Protocol_DIS = 2;
55  static const DtLgrProtocolId Protocol_HLA_13 = 3;
56  static const DtLgrProtocolId Protocol_HLA_1516 = 4;
57  static const DtLgrProtocolId Protocol_HLA_1516E = 5;
58  static const DtLgrProtocolId Protocol_TENA = 6;
59  static const DtLgrProtocolId Protocol_Undefined = 7;
60  //@]
61 
62 
63  static const int theLgrProtocolsStringsCount;
64  static const char* theLgrProtocolsStrings[];
65 
66  static DtLgrProtocolId lookupProtocol(const DtString& name);
67 
68  static DtString lookupProtocolName(DtLgrProtocolId protocolId);
69 
71 
73 
75 
76  DtLgrDomainId domain();
77  DtLgrProtocolId protocol();
78 
79  bool operator==(const DtLgrCommandType& secondType) const;
80 
81  bool operator!=(const DtLgrCommandType& secondType) const;
82 
83  bool operator<(const DtLgrCommandType& secondType) const;
84 
85  bool operator>(const DtLgrCommandType& secondType) const;
86 
87  DtString toString();
88 
89  public:
90  static const char* domainToString(int domainValue);
91  static const char* protocolToString(int protocolValue);
92 
93  protected:
96  };
97 
99  template<>
101 
102 
103  typedef DtBoost::shared_ptr<DtAnyValue> DtAnyValueSP;
104  typedef std::map<DtString,DtAnyValueSP> DtCommandParams;
105  typedef DtBoost::shared_ptr<DtCommandParams> DtCommandParamsSP;
106 
110  {
111  public:
112 
114  DtCommand(DtLgrDomainId domain,DtLgrProtocolId protocol,DtLgrCommandId command,
115  const char* parametersBuffer=0);
116 
118  DtCommand(DtLgrDomainId domain,DtLgrProtocolId protocol,const DtString& commandName);
119 
121  DtCommand(const DtLgrCommandType& type,DtLgrCommandId command);
122 
124  DtCommand(const DtCommand& type);
125 
127  ~DtCommand();
128 
130  DtLgrCommandType type() const;
131 
133  DtLgrCommandId id() const;
134 
136  void setId(DtLgrCommandId id);
137 
139  const DtString* name() const;
140 
142  void setParameter(const DtString& name,DtAnyValue*);
143 
145  const DtAnyValue* parameter(const DtString& name) const;
146 
148  void serializeParameters(DtString& parameterBuffer) const;
149 
151  void deserializeParameters(const char* parameterBuffer);
152 
154  static const DtLgrCommandId theUnknownCommand = 0;
155 
159  bool operator==(const DtCommand&) const;
160  bool operator!=(const DtCommand&) const;
161  bool operator<(const DtCommand&) const;
162  bool operator>(const DtCommand&) const;
163 
164  protected:
169  };
170 
172  typedef DtBoost::shared_ptr<DtCommand> DtCommandSP;
173  //typedef const DtCommand DtCommandConst;
174  typedef DtBoost::shared_ptr<const DtCommand> DtResponse;
175 
177  #define DT_FACTORY_COMMAND(commandName,createParams,decodeParams)\
178  static DtCommandDefinition define##commandName##Command();\
179  static DtCommand create##commandName##Command createParams;\
180  static void decode##commandName##Command decodeParams;
181 
183  #define DT_FACTORY_COMMAND_EXT(commandId,commandName,createParams,decodeParams)\
184  static const DtLgrCommandId Command_##commandName = commandId;\
185  static DtCommandDefinition define##commandName##Command();\
186  static DtCommand create##commandName##Command createParams;\
187  static void decode##commandName##Command decodeParams;
188 
189 
191  #define DT_FACTORY_RESPONSE(responseName,createParams,decodeParams)\
192  static DtResponse create##responseName##Response createParams;\
193  static void decode##responseName##Response decodeParams;
194 
195 
196 
198  #define DT_FACTORY_RESPONSE_EXT(responseId,responseName,createParams,decodeParams)\
199  static const DtLgrCommandId Response_##responseName = responseId;\
200  static DtResponse create##responseName##Response createParams;\
201  static void decode##responseName##Response decodeParams;
202 
203 
205  template <typename ValueType>
206  void DtGetCommandParameter(const DtCommand& command,const DtString& name,ValueType& value);
207 
209  template <typename ValueType>
210  void DtGetResponseParameter(const DtResponse response,const DtString& name,ValueType& value);
211 
212  #define lgrCommand_INC_
213  #include "lgrCommand.inl"
214  #undef lgrCommand_INC_
215 }
The logger command which contains the command type and its parameters.
Definition: lgrCommand.h:109
The command type structure.
Definition: lgrCommand.h:29
void DtGetResponseParameter(const DtResponse response, const DtString &name, ValueType &value)
Template utility functions for getting the type.
Definition: lgrCommand.h:40
static const int theLgrDomainStringsCount
Definition: lgrCommand.h:45
Contains MAKLogger::DtAnyValue and MAKLogger::DtValue and MAKLogger::DtValueList classes.
DtLgrCommandId myCommand
Definition: lgrCommand.h:166
DtBoost::shared_ptr< DtAnyValue > DtAnyValueSP
Definition: lgrCommand.h:103
#define DT_DLL_LGR_CMDS
Definition: lgrCmds.h:18
Contains Logger exceptions.
unsigned char DtLgrDomainId
Definition: lgrCommand.h:23
static int theTypeId()
Static function which defines the type.
DtBoost::shared_ptr< const DtCommand > DtResponse
Definition: lgrCommand.h:174
DtBoost::shared_ptr< DtCommandParams > DtCommandParamsSP
Definition: lgrCommand.h:105
void DtGetCommandParameter(const DtCommand &command, const DtString &name, ValueType &value)
Template utility functions for getting the type.
Definition: lgrCommand.h:15
DtAnyValue is a base class for Any Value type.
Definition: runtimeValue.h:30
DtCommandParamsSP myParameters
Definition: lgrCommand.h:167
DtLgrCommandType myType
Definition: lgrCommand.h:165
Contains lgrCmds library definitions.
std::map< DtString, DtAnyValueSP > DtCommandParams
Definition: lgrCommand.h:104
unsigned char DtLgrProtocolId
Definition: lgrCommand.h:24
static const int theLgrProtocolsStringsCount
Definition: lgrCommand.h:63
short DtLgrCommandId
Definition: lgrCommand.h:25
DtLgrDomainId myDomain
Definition: lgrCommand.h:94
DtBoost::shared_ptr< DtCommand > DtCommandSP
Makes it much easier with additional typedefs in other classes.
Definition: lgrCommand.h:172
DtString * myUnknownCommandName
Definition: lgrCommand.h:168
DtLgrProtocolId myProtocol
Definition: lgrCommand.h:95

Document ID: Generated on Fri May 31 15:45:35 EDT 2024 from SVN revision 266500
Copyright © 2024 MAK Technologies. All Rights Reserved (www.mak.com)