VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
triggerStmt.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 <readerWriter/rwString.h>
12 #include <readerWriter/rwBoolean.h>
13 #include "vrfutil/simCondExpr.h"
14 #include "vrfutil/rwUUID.h"
15 #include "vrfplan/rwCondExpr.h"
17 #include <tbb/spin_mutex.h>
18 
19 #include <boost/unordered_map.hpp>
20 #include <set>
21 
22 const char DtWhenStmtTypeName[] = "When";
23 
24 class DtRwCondExpr;
25 class DtTriggerBlock;
26 
36 #include "vrfplan/vrfplanDefines.h"
37 
38 class DtTriggerStmt;
39 
41 {
42 public:
46 
47  void addTriggerStatement(DtTriggerStmt*);
48  void removeTriggerStatement(DtTriggerStmt*);
49  bool hasTriggerStatements() const { return (myTriggerStatements.size() != 0); };
50 
51  virtual DtString markingText();
52  virtual DtUUIDMarkingTextProvider* clone() const;
53 
54 protected:
55  std::set<DtTriggerStmt*> myTriggerStatements;
57  tbb::spin_mutex myMutex;
58 };
59 
61 {
62 public:
63 
65  DtTriggerStmt(DtReaderWriterRegistry* parentRegistry = NULL);
66 
68  DtTriggerStmt(const DtTriggerStmt& orig,
69  DtReaderWriterRegistry* parentRegistry = NULL);
70 
72  virtual ~DtTriggerStmt();
73 
76 
78 
79  virtual DtSimStatement* clone(
80  DtReaderWriterRegistry* parentRegistry = NULL) const;
81 
83  virtual int type() const;
84 
87  virtual void execute(DtPlan& planContext);
88 
90  virtual int subBlockCount() const;
92  virtual DtSimBlock* subBlock(int index);
93 
103  virtual DtString stringRep(int subBlockIndex = DtSR_STMT) const;
104 
108  virtual void exitFromTrigger(DtPlan& planContext);
109 
110  virtual const DtUUID& triggerUUID() const;
111  virtual void setTriggerUUID(const DtUUID&);
112 
114  virtual DtString triggerName() const;
115 
116  virtual const DtSimCondExpr* condExpr() const;
117  virtual void setCondExpr(const DtSimCondExpr* arg);
118 
124  virtual const DtString& option() const;
126  virtual void setOption(const DtString& arg);
127 
128  virtual DtTriggerBlock* triggerBlock() const;
129  virtual void setTriggerBlock(DtTriggerBlock* arg);
130 
132  virtual void setReregisterTrigger(bool);
133  virtual bool reregisterTrigger() const;
134 
141  virtual int netRepSize() const;
142 
144  virtual bool setFromNet(const char* contentBuffer,
145  unsigned contentSize);
146 
158  virtual bool setToNet();
159 
161  virtual void upgradeTriggerUUID(const boost::unordered_map<DtUUID, DtUUID>&);
162 
164  virtual void reset();
165 
166 protected:
169  static void addTriggerMarkingTextMapping(DtTriggerStmt*);
170  static void removeTriggerMarkingTextMapping(DtTriggerStmt*);
171 
172  virtual void getSelf(DtlObjPtr args, const DtReaderWriter::SearchPaths& searchPaths,
173  const DtVariableBindingsList& variableBindings);
174 
176  static DtString nextDefaultTriggerMarkingText();
177 
178 public:
179 
180  static DtSimStatement * creator(DtReaderWriterRegistry* parentRegistry = NULL);
181 
182 protected:
183 
184  virtual bool compare(DtSimStatement*);
185 
186 protected:
192 
193  typedef boost::unordered_map<DtUUID, DtTriggerStatementUUIDMarkingTextProvider*> NamedTriggers;
194 
196 };
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
virtual void setCondExpr(const DtSimCondExpr *arg)=0
Sets the conditional expression used to evaluate the wait until.
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.
bool hasTriggerStatements() const
Definition: triggerStmt.h:49
DtString myDefaultMarkingText
Definition: triggerStmt.h:56
static NamedTriggers theNamedTriggers
Definition: triggerStmt.h:195
Definition: triggerStmt.h:40
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”.
Description: Readable, Writable DtString Variable substitutions are done on this object when it is re...
Definition: rwString.h:20
DtRwBoolean myReregisterTrigger
Definition: triggerStmt.h:191
Definition: readerWriterRegistry.h:39
Contains the DtUUID class declaration.
Description: Readable, Writable uuid string. Use this class in order to convert from object marking t...
Definition: rwUUID.h:431
class DtSimBlock:
Definition: simBlock.h:27
tbb::spin_mutex myMutex
Definition: triggerStmt.h:57
std::set< DtTriggerStmt * > myTriggerStatements
Definition: triggerStmt.h:55
virtual void reset()
Called when the plan is reset, will iterate over all statements to reset as well. ...
std::list< const DtRwVariableBindings * > DtVariableBindingsList
Definition: readerWriterRegistry.h:29
class DtSimConditionalStatement:
Definition: simConditionalStatement.h:25
DtTriggerBlock * myBlock
Definition: triggerStmt.h:190
virtual DtSimBlock * subBlock(int index)
Get a pointer to any particular block nested inside this statement. Sub-blocks are indexed as C array...
DtRwCondExpr myCondExpr
Definition: triggerStmt.h:188
std::vector< DtFilename > SearchPaths
Definition: readerWriter.h:92
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.
virtual void getSelf(DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &variableBindings=nullVariableReference())
Top level to read itself from an input stream. searchPath is passed down to all DtReaderWriter member...
class DtTriggerBlock:
Definition: triggerBlock.h:26
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
DtRwUUID myTriggerUUID
Definition: triggerStmt.h:187
Description: Readable, Writable bool.
Definition: rwBoolean.h:26
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 ...
virtual DtString markingText()=0
#define DT_DLL_vrfplan
This file is used to determine how to build.
Definition: vrfplanDefines.h:28
const char DtWhenStmtTypeName[]
Definition: triggerStmt.h:22
virtual DtUUIDMarkingTextProvider * clone() const =0
Definition: triggerStmt.h:60
virtual void upgradeTriggerUUID(const boost::unordered_map< DtUUID, DtUUID > &)
For those statements that need to, map from the old to new trigger UUID.
boost::unordered_map< DtUUID, DtTriggerStatementUUIDMarkingTextProvider * > NamedTriggers
Definition: triggerStmt.h:193
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).
To allow for faster marking text lookups, the DtUUIDMarkingTextProvider class wraps an object that wi...
Definition: rwUUID.h:40
DtRwString myOption
Definition: triggerStmt.h:189
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 Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)