![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2004 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: conditionalExpression.h,v $ $Revision: 1.6 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00009 #ifndef DtMyConditionalExpression_H_ 00010 #define DtMyConditionalExpression_H_ 00011 00012 #include "vrfutil/condExpr.h" 00013 #include "vrfutil/condExprTypes.h" 00014 #include "vrfutil/rdrWritr.h" 00015 #include "vrfutil/rwString.h" 00016 00017 00018 namespace vrfAddConditionalExample 00019 { 00020 //This is the integer type which represents MyConditionalExpression on 00021 //the network. By starting conditional expression types from 00022 //MIN_USER_CONDITIONAL_EXPRESSION_TYPE, defined in condExprTypes.h, conflicts 00023 //with existing VR-Forces types can be avoided. 00024 const int DtCondExprFacingNorthType = MIN_USER_CONDITIONAL_EXPRESSION_TYPE + 1; 00025 00026 //This is the string type which represents MyConditionalExpression in 00027 //plan files. It must not contain any spaces. 00028 const char DtCeFacingNorthTypeName[] = "FacingNorth"; 00029 00030 00031 //This struct is the fixed portion of the network representation of a 00032 //facing north conditional expression. 00033 struct DtNetCeFacingNorth 00034 { 00035 DtNetU8 myEntityNameStringLength; //1 byte 00036 DtNetU8 myModifierStringLength; //1 byte 00037 //padding to insure the structure is aligned on an 8 byte boundary 00038 DtNetU8 myPadding; //1 byte 00039 DtNetU8 myPadding1; //1 byte 00040 DtNetU8 myPadding2; //1 byte 00041 DtNetU8 myPadding3; //1 byte 00042 DtNetU8 myPadding4; //1 byte 00043 DtNetU8 myPadding5; //1 byte 00044 }; 00045 00046 class MyConditionalExpression : public DtSimCondExpr 00047 { 00048 public: 00049 00050 //default constructor 00051 MyConditionalExpression(); 00052 00053 //real constructor 00054 MyConditionalExpression(DtReaderWriterRegistry* parentRegistry); 00055 00056 //copy constructor 00057 MyConditionalExpression(const MyConditionalExpression& orig, 00058 DtReaderWriterRegistry* parentRegistry = NULL); 00059 00060 //destructor 00061 virtual ~MyConditionalExpression(); 00062 00063 //assignment operator 00064 MyConditionalExpression& operator=(const MyConditionalExpression& orig); 00065 00066 //clone operator 00067 virtual DtSimCondExpr* clone(DtReaderWriterRegistry* parentRegistry = NULL); 00068 00069 //Returns DtNetCeFacingNorthType (defined above). 00070 virtual int type() const; 00071 00072 //Set the entity name 00073 virtual void setEntityName(const DtString& name); 00074 //Returns the entity name 00075 virtual const DtString& entityName() const; 00076 00077 //Set the test modifier. 00078 // If it is an empty string, checks only the specified entity. 00079 // If it is the string "ANY", checks all subordinate entities to see if 00080 // any of them match the test, 00081 // If it is neither of the above, it requires that all specified entities 00082 // match. 00083 virtual void setModifier(const DtString& arg); 00084 //Returns the modifier 00085 virtual const DtString& modifier() const; 00086 00087 //Get a readable string representation of this level of this expression. 00088 // 00089 //The subExprIndex argument indicates which stringRep to get if this 00090 //expression can have sub-expressions. Since the facing north test has 00091 //no sub-expressions, it only returns a string representation if passed an 00092 //index of DtSimCondExpr::DtSR_EXPR. 00093 // 00094 //See the documentation for DtSimCondExpr::stringRep for more 00095 //information. 00096 virtual DtString stringRep(int subExprIndex = DtSR_EXPR) const; 00097 00098 //returns the size of the full network representation 00099 //padded to an 8-byte boundary. 00100 virtual int netRepSize() const; 00101 00102 //Fills in the expression from the network buffer 00103 virtual bool setFromNet(const char* contentBuffer, 00104 unsigned contentSize); 00105 00106 //Fills in the network buffer (created by base class conditional 00107 //expression) with the conditional expression contents. 00108 virtual bool setToNet(); 00109 00110 //Returns a new MyConditionalExpression 00111 static DtSimCondExpr * creator(); 00112 00113 protected: 00114 //The name of the entity to evaluate 00115 DtRwString myEntityName; 00116 00117 //The modifier (set via the "Any" checkbox in the GUI) 00118 DtRwString myModifier; 00119 }; 00120 00121 #endif 00122 00123 }