VR-Forces 5.0.3 Developer's Guide
 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 
13 
15 #include "vrfutil/rwUUID.h"
16 #include <readerWriter/rwString.h>
18 
19 #include <boost/unordered_map.hpp>
20 
21 typedef int DtStmtIdType;
22 
23 class DtPlan;
24 class DtSimBlock;
25 class DtStmtIndex;
27 
37 #include "vrfplan/vrfplanDefines.h"
39 {
40 public:
41  friend class DtStmtIndex;
42 
45 
48  DtSimStatement(const DtString& name,
49  DtReaderWriterRegistry* parentRegistry = NULL);
50 
52  DtSimStatement(const DtSimStatement& orig,
53  DtReaderWriterRegistry* parentRegistry = NULL);
54 
56  virtual ~DtSimStatement();
57 
60  virtual bool init();
61 
64 
68  virtual DtSimStatement* clone(
69  DtReaderWriterRegistry* parentRegistry = NULL) const = 0;
70 
72  virtual int type() const = 0;
73 
77  virtual bool validate();
78 
84  virtual void execute(DtPlan& planContext) = 0;
85 
92  virtual void step(DtPlan& planContext, bool forceStep = false);
93 
99  DtSimStatement* nextStmt() const;
100  DtSimStatement* prevStmt() const;
101 
103  virtual DtStmtIdType statementId() const;
104  virtual void setStatementId(DtStmtIdType arg);
105 
108  virtual DtSimBlock* parentBlock() const;
109  virtual void setParentBlock(DtSimBlock* arg);
110 
112  virtual int subBlockCount() const;
113 
116  virtual DtSimBlock* subBlock(int index);
117 
118 #ifndef WIN32
119  static const int DtSR_STMT = -1;
121 #else
122  enum
124  {
126  DtSR_STMT = -1
127  };
128 #endif
129 
133  virtual DtRecursiveSimStatementIterator* spawnRecursiveIterator() const;
134 
137  virtual DtSimStatement* lookupStatement(DtStmtIdType statementId);
138 
140  virtual void setStatementDescription(const DtString&);
141  virtual const DtString& statementDescription() const;
142 
151  virtual DtString stringRep(int subBlockIndex = DtSR_STMT) const = 0;
152 
153  virtual char* netRep();
154 
159  virtual int netRepSize() const;
160 
164  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize);
165 
170  virtual bool setToNet();
171 
172  static DtStmtIdType generateNewStmtId();
173 
177 
186  static DtSimStatement * createStatement(DtlObjPtr mtlStream,
187  DtReaderWriterRegistry* parentRegistry = NULL);
188  static DtSimStatement * createStatement(int statementType,
189  DtReaderWriterRegistry* parentRegistry = NULL);
190 
195 
197  static void addStatementCreatorFcn(const DtString & type, int intType,
199 
200  static void setFactory(DtStatementFactory * factory);
201  static DtStatementFactory * factory();
202 
203 
204  static bool getStatementNameFromStatementType(int statementType, DtString& statementName);
205  static bool getStatementTypeFromStatementName(const DtString& statementName,
206  int& statementType);
207 
208  static bool addStatementTypeMapping(const DtString& statementName, int taskType);
209  static bool removeStatementTypeMapping(const DtString& statementName,
210  int statementType);
211 
213  virtual bool isSameStatement(DtSimStatement*);
214 
216  virtual void upgradeTriggerUUID(const boost::unordered_map<DtUUID, DtUUID>&);
217 
219  virtual void reset();
220 
221 protected:
222  virtual char* createNetworkBuffer();
223 
226  virtual bool compare(DtSimStatement*);
227 
228 protected:
229 
233 
236 
239 
240  char* myNetRep;
241 
243 
245 };
246 
251 {
252  return (DtSimStatement*) next();
253 }
255 {
256  return (DtSimStatement*) prev();
257 }
258 
259 namespace DtBufferSerialize
260 {
261  DT_DLL_vrfplan char *encode(const DtSimStatement* val, char *buffer);
262  DT_DLL_vrfplan const char *decode(DtSimStatement*& val, const char *buffer);
264 }
DT_DLL_readerWriter int getSize(const DtString &val)
The number of bytes required to encode the value.
DtSimStatement * prevStmt() const
Definition: simStatement.h:254
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:242
Contains the DtUUID class declaration.
int DtStmtIdType
Definition: simStatement.h:21
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:27
DtSimBlock * myParentBlock
The containing DtSimBlock object (if any).
Definition: simStatement.h:235
DtStmtIdType myStatementId
A semi-unique Id value that helps trace the original identity of this statement if/when it gets copie...
Definition: simStatement.h:232
DtSimStatement * nextStmt() const
Return next (previous) statements in the block, or NULL if hit the end (beginning) of the list...
Definition: simStatement.h:250
Description: Maps string constants to integer constants and vice versa. String / integer pairs are re...
Definition: stringIntMapper.h:74
DtRwString myStatementDescription
Definition: simStatement.h:244
class DtStatementFactory:
Definition: statementFactory.h:35
DT_DLL_readerWriter char * encode(const DtFilename &val, char *buffer)
Serializes the provided value val into buffer. buffer must have at least the number of bytes returned...
DtRwListedObj & operator=(const DtRwListedObj &orig)
Assignment operator.
char * myNetRep
Definition: simStatement.h:240
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:92
! ! This is a base class from which elements of a DtRwIntrusiveList must be ! derived. Previous and next pointers can be obtained directly from the ! DtRwListedObj, without going through the DtRwIntrusiveList to which it has ! been added. !
Definition: rwIntrusiveList.h:173
class DtSimStatement:
Definition: simStatement.h:38
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:238
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 Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)