![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 1999 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: simStmt.h,v $ $Revision: 1.29 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00011 00012 #ifndef DtSimStatement_H_ 00013 #define DtSimStatement_H_ 00014 00015 class DtSimStatement; 00016 00017 #include <vlutil/vlString.h> 00018 #include <vlutil/vlList.h> 00019 #include "vrfutil/rdrWritr.h" 00020 #include "vrfutil/rwIntList.h" 00021 #include "vrfplan/stmtFactory.h" 00022 #include "vrfutil/strIntMapper.h" 00023 #include <vlutil/vlNetTypes.h> 00024 #include "tdbutil/translation.h" 00025 #include "tdbutil/tdbUnits.h" 00026 00027 typedef int DtStmtIdType; 00028 00029 class DtPlan; 00030 class DtSimBlock; 00031 class DtStmtIndex; 00032 class DtRecursiveSimStatementIterator; 00033 00037 struct DtNetSimStatement 00038 { 00039 DtNetU16 myStatementSize; 00040 DtNetU16 myStatementId; 00041 DtNetU8 myStatementType; 00042 DtNetU8 myPadding1; 00043 DtNetU16 myPadding2; 00044 }; 00046 00053 #include "vrfplan/vrfplanDefines.h" 00054 class DT_DLL_vrfplan DtSimStatement : public DtRwListedObj 00055 { 00056 public: 00057 friend class DtStmtIndex; 00058 00060 DtSimStatement(); 00061 00064 DtSimStatement(const DtString& name, 00065 DtReaderWriterRegistry* parentRegistry = NULL); 00066 00068 DtSimStatement(const DtSimStatement& orig, 00069 DtReaderWriterRegistry* parentRegistry = NULL); 00070 00072 virtual ~DtSimStatement(); 00073 00076 virtual bool init(); 00077 00079 DtSimStatement& operator=(const DtSimStatement& orig); 00080 00084 virtual DtSimStatement* clone( 00085 DtReaderWriterRegistry* parentRegistry = NULL) const = 0; 00086 00088 virtual int type() const = 0; 00089 00093 virtual bool validate(); 00094 00100 virtual void execute(DtPlan& planContext) = 0; 00101 00106 virtual void step(DtPlan& planContext); 00107 00115 virtual bool translateIndex(DtStmtIndex& index); 00116 00119 virtual void translateIndices(const DtList& indices); 00120 00126 DtSimStatement* nextStmt() const; 00127 DtSimStatement* prevStmt() const; 00128 00130 virtual DtStmtIdType statementId() const; 00131 virtual void setStatementId(DtStmtIdType arg); 00132 00135 virtual DtSimBlock* parentBlock() const; 00136 virtual void setParentBlock(DtSimBlock* arg); 00137 00139 virtual int subBlockCount() const; 00140 00143 virtual DtSimBlock* subBlock(int index); 00144 00145 #ifndef WIN32 00146 00147 static const int DtSR_STMT = -1; 00148 #else 00149 00150 enum 00151 { 00153 DtSR_STMT = -1 00154 }; 00155 #endif 00156 00160 virtual DtRecursiveSimStatementIterator* spawnRecursiveIterator() const; 00161 00164 virtual DtSimStatement* lookupStatement(DtStmtIdType statementId); 00165 00174 virtual DtString stringRep(int subBlockIndex = DtSR_STMT) const = 0; 00175 00176 virtual char* netRep(); 00177 00182 virtual int netRepSize() const; 00183 00187 virtual bool setFromNet(const char* contentBuffer, unsigned contentSize); 00188 00193 virtual bool setToNet(); 00194 00195 static DtStmtIdType generateNewStmtId(); 00196 00200 00209 static DtSimStatement * createStatement(DtlObjPtr mtlStream, 00210 DtReaderWriterRegistry* parentRegistry = NULL); 00211 static DtSimStatement * createStatement(int statementType, 00212 DtReaderWriterRegistry* parentRegistry = NULL); 00213 00216 static DtSimStatement* createLegacyStealthStatement(DtlObjPtr mtlStream, 00217 DtReaderWriterRegistry* parentRegistry = NULL); 00218 00220 static void addStatementCreatorFcn(const DtString & type, int intType, 00221 DtStatementCreatorFcn fcn); 00222 00223 static void setFactory(DtStatementFactory * factory); 00224 static DtStatementFactory * factory(); 00225 00226 00227 static bool getStatementNameFromStatementType(int statementType, DtString& statementName); 00228 static bool getStatementTypeFromStatementName(const DtString& statementName, 00229 int& statementType); 00230 00231 static bool addStatementTypeMapping(const DtString& statementName, int taskType); 00232 static bool removeStatementTypeMapping(const DtString& statementName, 00233 int statementType); 00234 00236 virtual bool isSameStatement(DtSimStatement*); 00237 00238 protected: 00239 virtual char* createNetworkBuffer(); 00240 00243 virtual bool compare(DtSimStatement*); 00244 00245 protected: 00246 00249 DtStmtIdType myStatementId; 00250 00252 DtSimBlock* myParentBlock; 00253 00255 static DtStatementFactory * myFactory; 00256 00257 char* myNetRep; 00258 00259 static DtStringIntMapper theStatementNameMapper; 00260 }; 00261 00265 inline DtSimStatement* DtSimStatement::nextStmt() const 00266 { 00267 return (DtSimStatement*) next(); 00268 } 00269 inline DtSimStatement* DtSimStatement::prevStmt() const 00270 { 00271 return (DtSimStatement*) prev(); 00272 } 00273 00274 #endif 00275