VR-Forces 4.6 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) 2016 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>
15 #include "vrfutil/readerWriter.h"
18 #include "vrfutil/rwUUID.h"
19 #include "vrfutil/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 
123  static const int DtSR_STMT = -1;
124 #else
125 
126  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 
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 }

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)