MAK Data Logger API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
lgrRuntimeCommandFactory.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 #include <lgrCmds/lgrCommand.h>
14 
15 #include <lgrUtil/collectors.h>
16 
17 #include <map>
18 #include <list>
19 
20 class DtString;
21 
22 namespace MAKLogger
23 {
24 
26  typedef std::pair<DtString,DtString> DtNamedTypedParameter;
27 
29  typedef std::list<DtNamedTypedParameter> DtParameterList;
30 
31  //Define a command Unique Id as its type and id
32  typedef std::pair<DtLgrCommandType,DtLgrCommandId> DtLgrCommandUniqueId;
33 
35  typedef std::pair<DtString,DtParameterList> DtCommandAttributes;
36  typedef std::pair<DtLgrCommandUniqueId,DtCommandAttributes> DtCommandDefinitionPair;
37 
41  {
42  public:
44  bool commandLine = true);
45 
46  DtLgrCommandType type() const;
47  DtLgrCommandId id() const;
48 
49  void setUniqueId(DtLgrCommandType,DtLgrCommandId);
50  DtLgrCommandUniqueId uniqueId() const;
51 
52  void setName(const DtString&);
53  DtString name() const;
54 
55  DtParameterList& parameters();
56  const DtParameterList& parameters() const;
57 
58  bool accessViaCommandLine() const;
59 
60  protected:
63  };
64 
68  {
69  public:
73 
75  virtual ~DtRuntimeCommandFactory();
76 
78  virtual void commandNames(DtCollector<DtString> names);
79 
81  virtual void commandParams(DtLgrCommandType,DtLgrCommandId,
82  DtParameterList& outParams);
83 
85  virtual DtString* commandName(DtLgrCommandType,DtLgrCommandId);
86 
88  DtLgrCommandType commandType(const DtString& name);
89 
91  virtual DtLgrCommandId commandId(const DtString&);
92 
102  virtual DtCommand generateCommand(DtLgrCommandType type,
103  DtLgrCommandId id,const DtParameterList& nameValuePairs);
104 
105  DtAnyValue* deserializeParameter(const DtString& type,const DtString& value) const;
106 
107  DtAnyValue* deserializeParameterList(const DtString& type,const std::vector<DtString>& values) const;
108 
110  void registerCommand(const DtCommandDefinition&);
111 
113  void unregisterCommand(const DtCommandDefinition&);
114 
116  static bool isListType(const DtString&);
117 
119  static DtString listItemType(const DtString listType);
120 
124  static DtString baseType(const DtString typeAlias);
125 
126  static DtString stringType();
127  static DtString intType();
128  static DtString int64Type();
129  static DtString floatType();
130  static DtString doubleType();
131  static DtString boolType();
132  static DtString timeType();
133  static DtString relativeTimeType();
134  static DtString stringListType();
135  static DtString voidPtrType();
136  static DtString base64Type();
137 
138  protected:
139 
140  virtual bool isStringType(const DtString& type) const;
141  virtual bool isIntType(const DtString& type) const;
142  virtual bool isInt64Type(const DtString& type) const;
143  virtual bool isFloatType(const DtString& type) const;
144  virtual bool isDoubleType(const DtString& type) const;
145  virtual bool isBoolType(const DtString& type) const;
146  virtual bool isTimeType(const DtString& type) const;
147  virtual bool isRelativeTimeType(const DtString& type) const;
148  virtual bool isStringListType(const DtString& type) const;
149  virtual bool isVoidPtrType(const DtString& type) const;
150  virtual bool isBase64Type(const DtString& type) const;
151 
152  typedef std::map<DtLgrCommandUniqueId,DtParameterList> DtCommandParamMap;
153  typedef std::map<DtLgrCommandUniqueId,DtString> DtCommandIdMap;
154  typedef std::map<DtString,DtLgrCommandUniqueId> DtCommandNameMap;
155 
158 
161 
164 
165  };
166 
167 }
The logger command which contains the command type and its parameters.
Definition: lgrCommand.h:109
The command type structure.
Definition: lgrCommand.h:29
std::list< DtNamedTypedParameter > DtParameterList
Define a parameter list as a list of named typed parameters.
Definition: lgrRuntimeCommandFactory.h:29
std::pair< DtString, DtParameterList > DtCommandAttributes
Define CommandAttributes as its name and its parameters.
Definition: lgrRuntimeCommandFactory.h:35
std::map< DtString, DtLgrCommandUniqueId > DtCommandNameMap
Definition: lgrRuntimeCommandFactory.h:154
DtCommandIdMap myCommandIdMap
A map of command ids to names.
Definition: lgrRuntimeCommandFactory.h:160
#define DT_DLL_LGR_CMDS
Definition: lgrCmds.h:18
std::pair< DtLgrCommandType, DtLgrCommandId > DtLgrCommandUniqueId
Definition: lgrRuntimeCommandFactory.h:32
DtCommandDefinitionPair myDefinition
Definition: lgrRuntimeCommandFactory.h:62
DtCommandParamMap myCommandParamMap
A map of command ids to a list of parameters.
Definition: lgrRuntimeCommandFactory.h:163
std::map< DtLgrCommandUniqueId, DtString > DtCommandIdMap
Definition: lgrRuntimeCommandFactory.h:153
std::map< DtLgrCommandUniqueId, DtParameterList > DtCommandParamMap
Definition: lgrRuntimeCommandFactory.h:152
DtAnyValue is a base class for Any Value type.
Definition: runtimeValue.h:30
std::pair< DtString, DtString > DtNamedTypedParameter
Define a named typed parameter as a name and a type.
Definition: lgrRuntimeCommandFactory.h:26
The factory for decoding text commands.
Definition: lgrRuntimeCommandFactory.h:67
bool myAccessViaCommandLine
Definition: lgrRuntimeCommandFactory.h:61
DtCommandNameMap myCommandNameMap
A map of command names to ids.
Definition: lgrRuntimeCommandFactory.h:157
The definition of a command and it&#39;s parameters.
Definition: lgrRuntimeCommandFactory.h:40
Contains MAKLogger::DtLgrCommandType and MAKLogger::DtCommand classes.
std::pair< DtLgrCommandUniqueId, DtCommandAttributes > DtCommandDefinitionPair
Definition: lgrRuntimeCommandFactory.h:36
Contains lgrCmds library definitions.
short DtLgrCommandId
Definition: lgrCommand.h:25
Contains classes used for abstract collection of data Contails DtCollector interface and implementati...
Definition: lgrConfigLoader.h:22

Document ID: Generated on Thu Oct 3 15:35:11 EDT 2024 from SVN revision 270037
Copyright © 2024 MAK Technologies. All Rights Reserved (www.mak.com)