VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtIfStmt Class Reference

8 bytes total More...

Inheritance diagram for DtIfStmt:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtIfStmt (DtReaderWriterRegistry *parentRegistry=NULL)
 default constructor DtIfStmt();
 DtIfStmt (const DtIfStmt &orig, DtReaderWriterRegistry *parentRegistry=NULL)
 copy constructor
virtual ~DtIfStmt ()
 destructor
DtIfStmtoperator= (const DtIfStmt &orig)
 assignment operator
virtual DtSimStatementclone (DtReaderWriterRegistry *parentRegistry=NULL) const
 virtual copy constructor
virtual int type () const
 Returns DtIfStatementType (defined in simStmtTypes.h)
virtual void execute (DtPlan &planContext)
 Execute the current statement and make any changes to the Plan state as appropriate.
virtual void step (DtPlan &planContext)
 Steps to the next statement by setting the plan context’s current statement, based on the result of the test.
virtual int subBlockCount () const
 Get the number of blocks nested inside this statement.
virtual DtSimBlocksubBlock (int index)
 Get the a pointer to each particular block nested inside this statement.
virtual DtString stringRep (int subBlockIndex=DtSR_STMT) const
 Get a readable string representation of this If statement.
virtual void exitFromIf (DtPlan &planContext)
 The exitFromIf function is called when one of the the "If" blocks is complete, it just steps to the next statement after the If.
virtual const DtSimCondExprcondExpr () const
 Get/set the conditional expression.
virtual void setCondExpr (DtSimCondExpr *arg)
virtual DtIfBlockthenBlock () const
 Get/set the then block.
virtual void setThenBlock (DtIfBlock *arg)
virtual DtIfBlockelseBlock () const
 Get/set the else block.
virtual void setElseBlock (DtIfBlock *arg)
virtual int netRepSize () const
 Returns the size of the full network representation padded to an 8-byte boundary.
virtual bool setFromNet (const char *contentBuffer, unsigned contentSize)
 Fills in the request from the network buffer.
virtual bool setToNet ()
 Fills in the network buffer (created by base class sim statement) with the if statement contents.

Static Public Member Functions

static DtSimStatementcreator (DtReaderWriterRegistry *parentRegistry=NULL)

Protected Member Functions

virtual bool compare (DtSimStatement *rhs)
 Called from isSameStatement.

Protected Attributes

DtRwCondExpr myCondExpr
bool myResult
 myResult temporarily holds the results of an evaluation of myCondExpr between the "execute" call and the "step" call.
DtIfBlockmyThenBlock
DtIfBlockmyElseBlock

Detailed Description

8 bytes total

class DtIfStmt:

Instances of DtIfStmt represent a conditional ("If" statement). Currently, they can only have one condition, and one or two sub-Blocks ("Then" and "Else"), but in the future they might be extended to support multiple "ElseIf" conditions and sub-blocks as well.


Constructor & Destructor Documentation

DtIfStmt::DtIfStmt ( DtReaderWriterRegistry parentRegistry = NULL)

default constructor DtIfStmt();

Usual constructor

DtIfStmt::DtIfStmt ( const DtIfStmt orig,
DtReaderWriterRegistry parentRegistry = NULL 
)

copy constructor

virtual DtIfStmt::~DtIfStmt ( ) [virtual]

destructor


Member Function Documentation

DtIfStmt& DtIfStmt::operator= ( const DtIfStmt orig)

assignment operator

virtual DtSimStatement* DtIfStmt::clone ( DtReaderWriterRegistry parentRegistry = NULL) const [virtual]

virtual copy constructor

Implements DtSimStatement.

virtual int DtIfStmt::type ( ) const [virtual]

Returns DtIfStatementType (defined in simStmtTypes.h)

Implements DtSimStatement.

virtual void DtIfStmt::execute ( DtPlan planContext) [virtual]

Execute the current statement and make any changes to the Plan state as appropriate.

Implements DtSimStatement.

virtual void DtIfStmt::step ( DtPlan planContext) [virtual]

Steps to the next statement by setting the plan context’s current statement, based on the result of the test.

Reimplemented from DtSimStatement.

virtual int DtIfStmt::subBlockCount ( ) const [virtual]

Get the number of blocks nested inside this statement.

Reimplemented from DtSimStatement.

virtual DtSimBlock* DtIfStmt::subBlock ( int  index) [virtual]

Get the a pointer to each particular block nested inside this statement.

Reimplemented from DtSimStatement.

virtual DtString DtIfStmt::stringRep ( int  subBlockIndex = DtSR_STMT) const [virtual]

Get a readable string representation of this If statement.

The subBlockIndex argument indicates which stringRep to get as a prefix for a given sub-block. For an If statement, the first (0) sub-block's prefix is the "if (...) then" part, if a second sub-block exists, its prefix is the "else" part, and if a subBlockIndex value of DtSimStatement::DtSR_STMT is given, the "endif" part is returned.

See the documentation for DtSimStatement::stringRep for more information.

Implements DtSimStatement.

virtual void DtIfStmt::exitFromIf ( DtPlan planContext) [virtual]

The exitFromIf function is called when one of the the "If" blocks is complete, it just steps to the next statement after the If.

virtual const DtSimCondExpr* DtIfStmt::condExpr ( ) const [virtual]

Get/set the conditional expression.

virtual void DtIfStmt::setCondExpr ( DtSimCondExpr arg) [virtual]
virtual DtIfBlock* DtIfStmt::thenBlock ( ) const [virtual]

Get/set the then block.

virtual void DtIfStmt::setThenBlock ( DtIfBlock arg) [virtual]
virtual DtIfBlock* DtIfStmt::elseBlock ( ) const [virtual]

Get/set the else block.

virtual void DtIfStmt::setElseBlock ( DtIfBlock arg) [virtual]
virtual int DtIfStmt::netRepSize ( ) const [virtual]

Returns the size of the full network representation padded to an 8-byte boundary.

Size is computed from the following:

sizeof(DtNetSimStatement) + sizeof(DtNetIfStatement) + <myThenBlock->firstStmt()->netRepSize()> . . . <myThenBlock->lastStmt()->netRepSize()> <myElseBlock->firstStmt()->netRepSize()> . . . <myElseBlock->lastStmt()->netRepSize()>

Reimplemented from DtSimStatement.

virtual bool DtIfStmt::setFromNet ( const char *  contentBuffer,
unsigned  contentSize 
) [virtual]

Fills in the request from the network buffer.

Reimplemented from DtSimStatement.

virtual bool DtIfStmt::setToNet ( ) [virtual]

Fills in the network buffer (created by base class sim statement) with the if statement contents.

Network buffer is filled in as follows:

DtNetSimStatement DtNetIfStatment <myThenBlock->firstStmt()->netRep()> . . . <myThenBlock->lastStmt()->netRep()> <myElseBlock->firstStmt()->netRep()> . . . <myElseBlock->lastStmt()->netRep()>

Reimplemented from DtSimStatement.

static DtSimStatement* DtIfStmt::creator ( DtReaderWriterRegistry parentRegistry = NULL) [static]
virtual bool DtIfStmt::compare ( DtSimStatement ) [protected, virtual]

Called from isSameStatement.

Compares net reps to see if they are the same. Override to do different comparrison

Reimplemented from DtSimStatement.


Member Data Documentation

bool DtIfStmt::myResult [protected]

myResult temporarily holds the results of an evaluation of myCondExpr between the "execute" call and the "step" call.


The documentation for this class was generated from the following file:

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)