MAK Data Logger API Documentation for DIS
 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-2025 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_HLA_4 = 7;
60  static const DtLgrProtocolId Protocol_Undefined = 8;
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 std::shared_ptr<DtAnyValue> DtAnyValueSP;
105  typedef std::map<DtString,DtAnyValueSP> DtCommandParams;
106  typedef std::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 std::shared_ptr<DtCommand> DtCommandSP;
174  //typedef const DtCommand DtCommandConst;
175  typedef std::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 }
The logger command which contains the command type and its parameters.
Definition: lgrCommand.h:110
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:167
#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.
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:168
std::shared_ptr< DtAnyValue > DtAnyValueSP
Definition: lgrCommand.h:104
DtLgrCommandType myType
Definition: lgrCommand.h:166
std::shared_ptr< DtCommandParams > DtCommandParamsSP
Definition: lgrCommand.h:106
Contains lgrCmds library definitions.
std::map< DtString, DtAnyValueSP > DtCommandParams
Definition: lgrCommand.h:105
unsigned char DtLgrProtocolId
Definition: lgrCommand.h:24
std::shared_ptr< const DtCommand > DtResponse
Definition: lgrCommand.h:175
static const int theLgrProtocolsStringsCount
Definition: lgrCommand.h:64
short DtLgrCommandId
Definition: lgrCommand.h:25
DtLgrDomainId myDomain
Definition: lgrCommand.h:95
DtString * myUnknownCommandName
Definition: lgrCommand.h:169
std::shared_ptr< DtCommand > DtCommandSP
Makes it much easier with additional typedefs in other classes.
Definition: lgrCommand.h:173
DtLgrProtocolId myProtocol
Definition: lgrCommand.h:96

Document ID: Generated on Thu Dec 18 15:35:09 EST 2025 from SVN revision 282494
Copyright © 2024 MAK Technologies. All Rights Reserved (www.mak.com)