VR-Forces 4.2 Class Documentation
conditionalExpression.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2004 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: conditionalExpression.h,v $ $Revision: 1.6 $ $State: Exp $
7 *******************************************************************************/
8 
9 #ifndef DtMyConditionalExpression_H_
10 #define DtMyConditionalExpression_H_
11 
12 #include "vrfutil/condExpr.h"
13 #include "vrfutil/condExprTypes.h"
14 #include "vrfutil/rdrWritr.h"
15 #include "vrfutil/rwString.h"
16 
17 
18 namespace vrfAddConditionalExample
19 {
20  //This is the integer type which represents MyConditionalExpression on
21  //the network. By starting conditional expression types from
22  //MIN_USER_CONDITIONAL_EXPRESSION_TYPE, defined in condExprTypes.h, conflicts
23  //with existing VR-Forces types can be avoided.
25 
26  //This is the string type which represents MyConditionalExpression in
27  //plan files. It must not contain any spaces.
28  const char DtCeFacingNorthTypeName[] = "FacingNorth";
29 
30 
31  //This struct is the fixed portion of the network representation of a
32  //facing north conditional expression.
34  {
35  DtNetU8 myEntityNameStringLength; //1 byte
36  DtNetU8 myModifierStringLength; //1 byte
37  //padding to insure the structure is aligned on an 8 byte boundary
38  DtNetU8 myPadding; //1 byte
39  DtNetU8 myPadding1; //1 byte
40  DtNetU8 myPadding2; //1 byte
41  DtNetU8 myPadding3; //1 byte
42  DtNetU8 myPadding4; //1 byte
43  DtNetU8 myPadding5; //1 byte
44  };
45 
47  {
48  public:
49 
50  //default constructor
52 
53  //real constructor
55 
56  //copy constructor
58  DtReaderWriterRegistry* parentRegistry = NULL);
59 
60  //destructor
61  virtual ~MyConditionalExpression();
62 
63  //assignment operator
65 
66  //clone operator
67  virtual DtSimCondExpr* clone(DtReaderWriterRegistry* parentRegistry = NULL);
68 
69  //Returns DtNetCeFacingNorthType (defined above).
70  virtual int type() const;
71 
72  //Set the entity name
73  virtual void setEntityName(const DtString& name);
74  //Returns the entity name
75  virtual const DtString& entityName() const;
76 
77  //Set the test modifier.
78  // If it is an empty string, checks only the specified entity.
79  // If it is the string "ANY", checks all subordinate entities to see if
80  // any of them match the test,
81  // If it is neither of the above, it requires that all specified entities
82  // match.
83  virtual void setModifier(const DtString& arg);
84  //Returns the modifier
85  virtual const DtString& modifier() const;
86 
87  //Get a readable string representation of this level of this expression.
88  //
89  //The subExprIndex argument indicates which stringRep to get if this
90  //expression can have sub-expressions. Since the facing north test has
91  //no sub-expressions, it only returns a string representation if passed an
92  //index of DtSimCondExpr::DtSR_EXPR.
93  //
94  //See the documentation for DtSimCondExpr::stringRep for more
95  //information.
96  virtual DtString stringRep(int subExprIndex = DtSR_EXPR) const;
97 
98  //returns the size of the full network representation
99  //padded to an 8-byte boundary.
100  virtual int netRepSize() const;
101 
102  //Fills in the expression from the network buffer
103  virtual bool setFromNet(const char* contentBuffer,
104  unsigned contentSize);
105 
106  //Fills in the network buffer (created by base class conditional
107  //expression) with the conditional expression contents.
108  virtual bool setToNet();
109 
110  //Returns a new MyConditionalExpression
111  static DtSimCondExpr * creator();
112 
113  protected:
114  //The name of the entity to evaluate
116 
117  //The modifier (set via the "Any" checkbox in the GUI)
119  };
120 
121 #endif
122 
123 }

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)