![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2006 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: simCommand.h,v $ $Revision: 1.10 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00011 00012 00013 #ifndef DtSimCommand_H_ 00014 #define DtSimCommand_H_ 00015 00016 #include "vrfutil/rdrWritr.h" 00017 #include "vrfplan/simCommandFactory.h" 00018 #include "vrfutil/strIntMapper.h" 00019 #include "vrfutil/rwBoolean.h" 00020 #include <vlutil/vlNetTypes.h> 00021 #include "tdbutil/translation.h" 00022 #include "tdbutil/tdbUnits.h" 00023 #include "vrfplan/vrfplanDefines.h" 00024 00025 class DtRwString; 00026 class DtSimCommandFactory; 00027 00035 00036 class DT_DLL_vrfplan DtSimCommand : public DtReaderWriter 00037 { 00038 protected: 00041 00043 DtSimCommand(); 00044 00047 DtSimCommand(const DtString & writeName, 00048 DtReaderWriterRegistry * parentRegistry = 0); 00049 00051 DtSimCommand(const DtString & writeName, const DtSimCommand & orig, 00052 DtReaderWriterRegistry * parentRegistry = 0); 00053 00055 const DtSimCommand & operator=(const DtSimCommand & orig); 00056 00057 public: 00058 00060 virtual ~DtSimCommand(); 00061 00064 virtual bool init(); 00065 00070 virtual int type() const = 0; 00071 00076 virtual DtSimCommand * clone(const DtString & name, DtReaderWriterRegistry * 00077 parentRegistry = 0) const = 0; 00078 00081 virtual DtSimCommand* clone() const; 00082 00088 virtual DtString stringRep() const = 0; 00089 00092 virtual void putData(FILE *fp, int indentLevel = 0); 00093 00096 virtual DtlObjPtr getData(DtlObjPtr args, const DtFilename& searchPath, 00097 const DtVariableBindingsList& variableBindings); 00098 00099 virtual char* netRep(); 00100 00106 virtual int netRepSize() const; 00107 00112 virtual bool setFromNet(const char* contentBuffer, 00113 unsigned contentSize); 00114 00122 virtual bool setToNet(); 00123 00124 00135 static DtSimCommand * createSimCommand(DtlObjPtr mtlStream); 00136 static DtSimCommand * createSimCommand(int simCommandType); 00137 00139 static void addSimCommandCreatorFcn(const DtString & simCommandName, int simCommandType, 00140 DtSimCommandCreatorFcn fcn); 00141 00142 static void setFactory(DtSimCommandFactory * factory); 00143 static DtSimCommandFactory* factory(); 00144 00145 static bool getSimCommandNameFromSimCommandType(int simCommandType, DtString& simCommandName); 00146 static bool getSimCommandTypeFromSimCommandName(const DtString& simCommandName, 00147 int& simCommandType); 00148 00149 static bool addSimCommandTypeMapping(const DtString& simCommandName, int simCommandType); 00150 static bool removeSimCommandTypeMapping(const DtString& simCommandName, 00151 int simCommandType); 00152 00153 protected: 00154 virtual char* createNetworkBuffer(); 00155 00156 protected: 00157 char* myNetRep; 00158 00159 static DtSimCommandFactory* myFactory; 00160 static DtStringIntMapper theSimCommandNameMapper; 00161 }; 00162 00163 namespace DtBufferSerialize 00164 { 00167 DT_DLL_vrfplan int getSize(const DtSimCommand* const& commandPtr); 00168 00173 DT_DLL_vrfplan char *encode(const DtSimCommand* const& commandPtr, char *buffer); 00174 00183 DT_DLL_vrfplan const char *decode(DtSimCommand*& commandPtr, const char *buffer); 00184 } 00185 00186 #endif 00187 00188