VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ifStmt.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2018 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 
8 
9 #pragma once
10 
11 #include "vrfutil/simCondExpr.h"
12 #include "vrfplan/rwCondExpr.h"
14 #include <vlutil/vlNetTypes.h>
15 
16 const char DtIfStmtTypeName[] = "If";
17 
18 class DtRwCondExpr;
19 class DtIfBlock;
20 
30 #include "vrfplan/vrfplanDefines.h"
32 {
33 public:
34 
37 
39  DtIfStmt(DtReaderWriterRegistry* parentRegistry = NULL);
40 
42  DtIfStmt(const DtIfStmt& orig,
43  DtReaderWriterRegistry* parentRegistry = NULL);
44 
46  virtual ~DtIfStmt() override;
47 
49  DtIfStmt& operator=(const DtIfStmt& orig);
50 
52 
53  virtual DtSimStatement* clone(DtReaderWriterRegistry* parentRegistry = NULL) const override;
54 
56  virtual int type() const override;
57 
60  virtual void execute(DtPlan& planContext) override;
61 
64  virtual void step(DtPlan& planContext, bool forceStep = false) override;
65 
67  virtual int subBlockCount() const override;
69  virtual DtSimBlock* subBlock(int index) override;
70 
81  virtual DtString stringRep(int subBlockIndex = DtSR_STMT) const override;
82 
85  virtual void exitFromIf(DtPlan& planContext);
86 
88  virtual const DtSimCondExpr* condExpr() const override;
89  virtual void setCondExpr(const DtSimCondExpr* arg) override;
90 
92  virtual DtIfBlock* thenBlock() const;
93  virtual void setThenBlock(DtIfBlock* arg);
94 
96  virtual DtIfBlock* elseBlock() const;
97  virtual void setElseBlock(DtIfBlock* arg);
98 
110  virtual int netRepSize() const override;
111 
113  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
114 
126  virtual bool setToNet() override;
127 
129  virtual void upgradeTriggerUUID(const boost::unordered_map<DtUUID, DtUUID>&) override;
130 
132  virtual void reset() override;
133 
134 public:
135 
136  static DtSimStatement * creator(DtReaderWriterRegistry* parentRegistry = NULL);
137 
138 protected:
139  virtual bool compare(DtSimStatement* rhs) override;
140 
141 protected:
142 
144 
147  bool myResult;
148 
151 };
virtual void setCondExpr(const DtSimCondExpr *arg)=0
Sets the conditional expression used to evaluate the wait until.
const char DtIfStmtTypeName[]
Definition: ifStmt.h:16
virtual DtSimStatement * clone(DtReaderWriterRegistry *parentRegistry=NULL) const =0
virtual copy constructor A typical clone function. It must be overridden by derived classes to return...
virtual int subBlockCount() const
Get the number of blocks nested inside this statement.
class DtIfBlock:
Definition: ifBlock.h:29
DtIfBlock * myElseBlock
Definition: ifStmt.h:150
virtual void step(DtPlan &planContext, bool forceStep=false)
Asks the statement to step the context DtPlan to the next statement. The default implementation steps...
virtual void execute(DtPlan &planContext)=0
Execute the current statement and make any changes to the Plan state as appropriate. Tells the statement to activate its own behavior. Each kind of statement implements this function differently. It is passed a reference to the executing DtPlan object as a “context of execution”.
virtual void reset() override
Called when the plan is reset, will iterate over all statements to reset as well. ...
Definition: readerWriterRegistry.h:39
class DtSimBlock:
Definition: simBlock.h:27
class DtSimConditionalStatement:
Definition: simConditionalStatement.h:25
virtual DtSimBlock * subBlock(int index)
Get a pointer to any particular block nested inside this statement. Sub-blocks are indexed as C array...
class DtIfStmt:
Definition: ifStmt.h:31
DtRwCondExpr myCondExpr
Definition: ifStmt.h:143
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize)
Extracts statement Id from buffer. First 16 bytes are a DtNetSimStatement structure. Derived class data should immediately follow this. Derived classes should call down to this one to make sure statement id gets set.
DtIfBlock * myThenBlock
Definition: ifStmt.h:149
bool myResult
myResult temporarily holds the results of an evaluation of myCondExpr between the &quot;execute&quot; call and ...
Definition: ifStmt.h:147
virtual int netRepSize() const
Returns sizeof(DtNetSimStatement). Derived classes should add this size to the size of their net repr...
class DtPlan:
Definition: plan.h:92
DtSimCondExpr is an abstract base class representing various Conditional Expressions used by the Plan...
Definition: simCondExpr.h:53
class DtRwCondExpr:
Definition: rwCondExpr.h:26
class DtSimStatement:
Definition: simStatement.h:38
virtual bool setToNet()
Casts myNetRep to DtNetSimStatement* and fills in structure. Derived classes should always call down ...
#define DT_DLL_vrfplan
This file is used to determine how to build.
Definition: vrfplanDefines.h:28
virtual void upgradeTriggerUUID(const boost::unordered_map< DtUUID, DtUUID > &)
For those statements that need to, map from the old to new trigger UUID.
virtual const DtSimCondExpr * condExpr() const =0
Returns the conditional expression used to evaluate the wait until.
DtSimStatement & operator=(const DtSimStatement &orig)
Assignment operator (protected because this is an abstract base class).
virtual int type() const =0
Returns the type of statement Type (defined in simStmtTypes.h)
virtual bool compare(DtSimStatement *)
Called from isSameStatement. Compares net reps to see if they are the same. Override to do different ...
virtual DtString stringRep(int subBlockIndex=DtSR_STMT) const =0
Get a readable string representation of this statement.

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)