VR-Forces 4.10 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 
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 
34 #include "vrfplan/vrfplanDefines.h"
36 {
37 public:
38  friend class DtStmtIndex;
39 
42 
45  DtSimStatement(const DtString& name,
46  DtReaderWriterRegistry* parentRegistry = NULL);
47 
49  DtSimStatement(const DtSimStatement& orig,
50  DtReaderWriterRegistry* parentRegistry = NULL);
51 
53  virtual ~DtSimStatement();
54 
57  virtual bool init();
58 
61 
65  virtual DtSimStatement* clone(
66  DtReaderWriterRegistry* parentRegistry = NULL) const = 0;
67 
69  virtual int type() const = 0;
70 
74  virtual bool validate();
75 
81  virtual void execute(DtPlan& planContext) = 0;
82 
89  virtual void step(DtPlan& planContext, bool forceStep = false);
90 
96  DtSimStatement* nextStmt() const;
97  DtSimStatement* prevStmt() const;
98 
100  virtual DtStmtIdType statementId() const;
101  virtual void setStatementId(DtStmtIdType arg);
102 
105  virtual DtSimBlock* parentBlock() const;
106  virtual void setParentBlock(DtSimBlock* arg);
107 
109  virtual int subBlockCount() const;
110 
113  virtual DtSimBlock* subBlock(int index);
114 
115 #ifndef WIN32
116  static const int DtSR_STMT = -1;
118 #else
119  enum
121  {
123  DtSR_STMT = -1
124  };
125 #endif
126 
130  virtual DtRecursiveSimStatementIterator* spawnRecursiveIterator() const;
131 
134  virtual DtSimStatement* lookupStatement(DtStmtIdType statementId);
135 
137  virtual void setStatementDescription(const DtString&);
138  virtual const DtString& statementDescription() const;
139 
148  virtual DtString stringRep(int subBlockIndex = DtSR_STMT) const = 0;
149 
150  virtual char* netRep();
151 
156  virtual int netRepSize() const;
157 
161  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize);
162 
167  virtual bool setToNet();
168 
169  static DtStmtIdType generateNewStmtId();
170 
174 
183  static DtSimStatement * createStatement(DtlObjPtr mtlStream,
184  DtReaderWriterRegistry* parentRegistry = NULL);
185  static DtSimStatement * createStatement(int statementType,
186  DtReaderWriterRegistry* parentRegistry = NULL);
187 
192 
194  static void addStatementCreatorFcn(const DtString & type, int intType,
196 
197  static void setFactory(DtStatementFactory * factory);
198  static DtStatementFactory * factory();
199 
200 
201  static bool getStatementNameFromStatementType(int statementType, DtString& statementName);
202  static bool getStatementTypeFromStatementName(const DtString& statementName,
203  int& statementType);
204 
205  static bool addStatementTypeMapping(const DtString& statementName, int taskType);
206  static bool removeStatementTypeMapping(const DtString& statementName,
207  int statementType);
208 
210  virtual bool isSameStatement(DtSimStatement*);
211 
213  virtual void upgradeTriggerUUID(const boost::unordered_map<DtUUID, DtUUID>&);
214 
216  virtual void reset();
217 
218 protected:
219  virtual char* createNetworkBuffer();
220 
223  virtual bool compare(DtSimStatement*);
224 
225 protected:
226 
230 
233 
236 
237  char* myNetRep;
238 
240 
242 };
243 
248 {
249  return (DtSimStatement*) next();
250 }
252 {
253  return (DtSimStatement*) prev();
254 }
255 
256 namespace DtBufferSerialize
257 {
258  DT_DLL_vrfplan char *encode(const DtSimStatement* val, char *buffer);
259  DT_DLL_vrfplan const char *decode(DtSimStatement*& val, const char *buffer);
261 }
DT_DLL_readerWriter int getSize(const DtString &val)
The number of bytes required to encode the value.
DtSimStatement * prevStmt() const
Definition: simStatement.h:251
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:239
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:232
DtStmtIdType myStatementId
A semi-unique Id value that helps trace the original identity of this statement if/when it gets copie...
Definition: simStatement.h:229
DtSimStatement * nextStmt() const
Return next (previous) statements in the block, or NULL if hit the end (beginning) of the list...
Definition: simStatement.h:247
Description: Maps string constants to integer constants and vice versa.
Definition: stringIntMapper.h:74
DtRwString myStatementDescription
Definition: simStatement.h:241
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:237
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:91
! This is a base class from which elements of a DtRwIntrusiveList must be derived.
Definition: rwIntrusiveList.h:173
class DtSimStatement:
Definition: simStatement.h:35
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:235
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 Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)