VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
simStatement.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
12 
13 #include <vlutil/vlString.h>
14 #include <vlutil/vlList.h>
18 #include "vrfutil/rwUUID.h"
19 #include <readerWriter/rwString.h>
21 #include <vlutil/vlNetTypes.h>
22 #include "tdbutil/unitFormatter.h"
23 #include "tdbutil/tdbUnits.h"
24 
25 #include <boost/unordered_map.hpp>
26 
27 typedef int DtStmtIdType;
28 
29 class DtPlan;
30 class DtSimBlock;
31 class DtStmtIndex;
33 
40 #include "vrfplan/vrfplanDefines.h"
42 {
43 public:
44  friend class DtStmtIndex;
45 
48 
51  DtSimStatement(const DtString& name,
52  DtReaderWriterRegistry* parentRegistry = NULL);
53 
55  DtSimStatement(const DtSimStatement& orig,
56  DtReaderWriterRegistry* parentRegistry = NULL);
57 
59  virtual ~DtSimStatement();
60 
63  virtual bool init();
64 
67 
71  virtual DtSimStatement* clone(
72  DtReaderWriterRegistry* parentRegistry = NULL) const = 0;
73 
75  virtual int type() const = 0;
76 
80  virtual bool validate();
81 
87  virtual void execute(DtPlan& planContext) = 0;
88 
95  virtual void step(DtPlan& planContext, bool forceStep = false);
96 
102  DtSimStatement* nextStmt() const;
103  DtSimStatement* prevStmt() const;
104 
106  virtual DtStmtIdType statementId() const;
107  virtual void setStatementId(DtStmtIdType arg);
108 
111  virtual DtSimBlock* parentBlock() const;
112  virtual void setParentBlock(DtSimBlock* arg);
113 
115  virtual int subBlockCount() const;
116 
119  virtual DtSimBlock* subBlock(int index);
120 
121 #ifndef WIN32
122  static const int DtSR_STMT = -1;
124 #else
125  enum
127  {
129  DtSR_STMT = -1
130  };
131 #endif
132 
136  virtual DtRecursiveSimStatementIterator* spawnRecursiveIterator() const;
137 
140  virtual DtSimStatement* lookupStatement(DtStmtIdType statementId);
141 
143  virtual void setStatementDescription(const DtString&);
144  virtual const DtString& statementDescription() const;
145 
154  virtual DtString stringRep(int subBlockIndex = DtSR_STMT) const = 0;
155 
156  virtual char* netRep();
157 
162  virtual int netRepSize() const;
163 
167  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize);
168 
173  virtual bool setToNet();
174 
175  static DtStmtIdType generateNewStmtId();
176 
180 
189  static DtSimStatement * createStatement(DtlObjPtr mtlStream,
190  DtReaderWriterRegistry* parentRegistry = NULL);
191  static DtSimStatement * createStatement(int statementType,
192  DtReaderWriterRegistry* parentRegistry = NULL);
193 
198 
200  static void addStatementCreatorFcn(const DtString & type, int intType,
202 
203  static void setFactory(DtStatementFactory * factory);
204  static DtStatementFactory * factory();
205 
206 
207  static bool getStatementNameFromStatementType(int statementType, DtString& statementName);
208  static bool getStatementTypeFromStatementName(const DtString& statementName,
209  int& statementType);
210 
211  static bool addStatementTypeMapping(const DtString& statementName, int taskType);
212  static bool removeStatementTypeMapping(const DtString& statementName,
213  int statementType);
214 
216  virtual bool isSameStatement(DtSimStatement*);
217 
219  virtual void upgradeTriggerUUID(const boost::unordered_map<DtUUID, DtUUID>&);
220 
222  virtual void reset();
223 
224 protected:
225  virtual char* createNetworkBuffer();
226 
229  virtual bool compare(DtSimStatement*);
230 
231 protected:
232 
236 
239 
242 
243  char* myNetRep;
244 
246 
248 };
249 
254 {
255  return (DtSimStatement*) next();
256 }
258 {
259  return (DtSimStatement*) prev();
260 }
261 
262 namespace DtBufferSerialize
263 {
264  DT_DLL_vrfplan char *encode(const DtSimStatement* val, char *buffer);
265  DT_DLL_vrfplan const char *decode(DtSimStatement*& val, const char *buffer);
267 }
DT_DLL_readerWriter int getSize(const DtString &val)
The number of bytes required to encode the value.
DtSimStatement * prevStmt() const
Definition: simStatement.h:257
Description: Readable, Writable DtString Variable substitutions are done on this object when it is re...
Definition: rwString.h:20
virtual DtStmtIdType statementId() const
class DtStmtIndex:
Definition: stmtIndex.h:24
Definition: readerWriterRegistry.h:39
static DtStringIntMapper theStatementNameMapper
Definition: simStatement.h:245
int DtStmtIdType
Definition: simStatement.h:11
Iterator for iterating over a DtList of DtSimBlock subblocks and all its descendants (each DtSimBlock...
Definition: recursiveSimStatementIterator.h:34
virtual void reset()
For those reader/writer items that support it, resets the reader/writer value to original state Defau...
static DtReaderWriterFactory * factory()
class DtSimBlock:
Definition: simBlock.h:29
DtSimBlock * myParentBlock
The containing DtSimBlock object (if any).
Definition: simStatement.h:238
DtStmtIdType myStatementId
A semi-unique Id value that helps trace the original identity of this statement if/when it gets copie...
Definition: simStatement.h:235
DtSimStatement * nextStmt() const
Return next (previous) statements in the block, or NULL if hit the end (beginning) of the list...
Definition: simStatement.h:253
Description: Maps string constants to integer constants and vice versa.
Definition: stringIntMapper.h:74
DtRwString myStatementDescription
Definition: simStatement.h:247
class DtStatementFactory:
Definition: statementFactory.h:35
DT_DLL_readerWriter char * encode(const DtFilename &val, char *buffer)
Serializes the provided value val into buffer.
DtRwListedObj & operator=(const DtRwListedObj &orig)
Assignment operator.
char * myNetRep
Definition: simStatement.h:243
DtRwListedObj * next() const
Return next (previous) elements on the list, or NULL if hit the end (beginning) of the list...
Definition: rwIntrusiveList.h:277
class DtPlan:
Definition: plan.h:90
! This is a base class from which elements of a DtRwIntrusiveList must be derived.
Definition: rwIntrusiveList.h:173
class DtSimStatement:
Definition: simStatement.h:41
File: strIntMapper.h.
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
static DtStatementFactory * myFactory
Factory for this class.
Definition: simStatement.h:241
DtSimStatement *(* DtStatementCreatorFcn)(DtReaderWriterRegistry *parentRegistry)
Definition: statementFactory.h:25
#define DT_DLL_vrfplan
This file is used to determine how to build.
Definition: vrfplanDefines.h:28
DtRwListedObj * prev() const
Definition: rwIntrusiveList.h:284
DT_DLL_readerWriter const char * decode(DtString &val, const char *buffer)
Decodes a value from buffer and places the result in val of the type specified by val...

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)