LRAUV  revA
ScriptNode.h
Go to the documentation of this file.
1 
10 #ifndef SCRIPTNODE_H_
11 #define SCRIPTNODE_H_
12 
13 class DataValue;
14 
21 {
22 public:
23 
25  virtual ~ScriptNode() {};
26 
28  virtual bool hasChildNodes() const = 0;
29 
31  virtual ScriptNode* getNamedNode( const Str& nodeName ) = 0;
32 
34  virtual ScriptNode* newChildNode( const Str& nodeName ) = 0;
35 
37  virtual ScriptNode* newChildFunction( const Str& functionName,
38  const Str& functionBody, Logger& logger ) = 0;
39 
42  virtual int getNodeCount( const Str& nodeName ) const = 0;
43 
45  virtual ScriptNode* getIndexedNode( unsigned int index ) = 0;
46 
48  virtual ScriptNode* getParentNode() const = 0;
49 
51  virtual int getIndex() const = 0;
52 
54  virtual const Str& getName() const = 0;
55 
58  virtual bool readBool( bool& readTo ) const = 0;
59 
62  virtual bool readDouble( double& readTo ) const = 0;
63 
66  virtual bool readString( Str& readTo ) const = 0;
67 
70  virtual DataValue* asNewDataValue() = 0;
71 
73  virtual bool execute( FlexArray<DataReader*>& inputs, FlexArray<SettingReader*>& settings,
75  Logger& logger ) = 0;
76 
79  virtual bool execute( FlexArray<DataReader*>& inputs, FlexArray<SettingReader*>& settings,
80  bool& boolOutput, Logger& logger ) = 0;
81 
83  virtual bool execute( Logger& logger ) = 0;
84 
87  virtual Str toString() const = 0;
88 
89 protected:
90 
92  ScriptNode() {};
93 
94 private:
95 
96  // Note that the copy constructor below is private and not given a body.
97  // Any attempt to call it will return a compiler error.
98  ScriptNode( const ScriptNode& old ); // disallow copy constructor
99 
100 };
101 
102 #endif /* SCRIPTNODE_H_ */
Client-side interface for injecting log data into the log queue.
Definition: Logger.h:30
virtual bool execute(FlexArray< DataReader * > &inputs, FlexArray< SettingReader * > &settings, FlexArray< DataWriter * > &outputs, FlexArray< const Unit * > &outUnits, Logger &logger)=0
Attempt to execute the function contained in this node.
virtual bool readBool(bool &readTo) const =0
Sets readTo to the value of the node, as a boolean Returns true if read success.
virtual bool readDouble(double &readTo) const =0
Sets readTo to the value of the node, as a double Returns true if read success.
virtual ~ScriptNode()
Destructor.
Definition: ScriptNode.h:25
virtual int getIndex() const =0
Returns the index of the node, -1 if named.
Abstract base class for nodes in tree-like scripts.
Definition: ScriptNode.h:20
virtual ScriptNode * newChildNode(const Str &nodeName)=0
Returns a new child node than can contain other nodes.
virtual Str toString() const =0
Returns a string representation of this node, with its ancestors, separated by "." characters...
A DataValue is an abstract base class for a data value and associated engineering units of the value...
Definition: DataValue.h:35
virtual ScriptNode * getParentNode() const =0
Returns the parent node, or NULL if this is the root.
virtual ScriptNode * getIndexedNode(unsigned int index)=0
Returns the indexed (array, or list-like) node at the zero-based index, or NULL if none...
Replacement for standard template class string.
Definition: Str.h:12
virtual ScriptNode * getNamedNode(const Str &nodeName)=0
Returns the child node, by name, or NULL if none.
virtual int getNodeCount(const Str &nodeName) const =0
Returns the number of indexed (array, or list-like) nodes Returns 0 is this is not a table...
virtual bool readString(Str &readTo) const =0
Sets readTo to the value of the node, unsigned char string Returns true if read success.
virtual DataValue * asNewDataValue()=0
If the node contains a dataValue, materialize such a dataValue Use the Unit + value paradigm...
ScriptNode()
Protected constructor for abstract base class.
Definition: ScriptNode.h:92
virtual ScriptNode * newChildFunction(const Str &functionName, const Str &functionBody, Logger &logger)=0
Returns a new child node that is a function.
virtual const Str & getName() const =0
Returns the name of the node, undefined if indexed.
virtual bool hasChildNodes() const =0
Returns true if the node contains child nodes.