LRAUV  revA
ScriptNode Class Referenceabstract

Abstract base class for nodes in tree-like scripts. More...

#include <ScriptNode.h>

Inheritance diagram for ScriptNode:

Public Member Functions

virtual ~ScriptNode ()
 Destructor. More...
 
virtual bool hasChildNodes () const =0
 Returns true if the node contains child nodes. More...
 
virtual ScriptNodegetNamedNode (const Str &nodeName)=0
 Returns the child node, by name, or NULL if none. More...
 
virtual ScriptNodenewChildNode (const Str &nodeName)=0
 Returns a new child node than can contain other nodes. More...
 
virtual ScriptNodenewChildFunction (const Str &functionName, const Str &functionBody, Logger &logger)=0
 Returns a new child node that is a function. More...
 
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. More...
 
virtual ScriptNodegetIndexedNode (unsigned int index)=0
 Returns the indexed (array, or list-like) node at the zero-based index, or NULL if none. More...
 
virtual ScriptNodegetParentNode () const =0
 Returns the parent node, or NULL if this is the root. More...
 
virtual int getIndex () const =0
 Returns the index of the node, -1 if named. More...
 
virtual const StrgetName () const =0
 Returns the name of the node, undefined if indexed. More...
 
virtual bool readBool (bool &readTo) const =0
 Sets readTo to the value of the node, as a boolean Returns true if read success. More...
 
virtual bool readDouble (double &readTo) const =0
 Sets readTo to the value of the node, as a double Returns true if read success. More...
 
virtual bool readString (Str &readTo) const =0
 Sets readTo to the value of the node, unsigned char string Returns true if read success. More...
 
virtual DataValueasNewDataValue ()=0
 If the node contains a dataValue, materialize such a dataValue Use the Unit + value paradigm, if possible. More...
 
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. More...
 
virtual bool execute (FlexArray< DataReader * > &inputs, FlexArray< SettingReader * > &settings, bool &boolOutput, Logger &logger)=0
 Attempt to execute the function contained in this node, returning only a single boolean value. More...
 
virtual bool execute (Logger &logger)=0
 Attempt to execute the function contained in this node, with no inputs and no return value. More...
 
virtual Str toString () const =0
 Returns a string representation of this node, with its ancestors, separated by "." characters. More...
 

Protected Member Functions

 ScriptNode ()
 Protected constructor for abstract base class. More...
 

Private Member Functions

 ScriptNode (const ScriptNode &old)
 

Detailed Description

Abstract base class for nodes in tree-like scripts.

Intended to allow missions to be scripted in a variety of formats.

Constructor & Destructor Documentation

virtual ScriptNode::~ScriptNode ( )
inlinevirtual

Destructor.

ScriptNode::ScriptNode ( )
inlineprotected

Protected constructor for abstract base class.

ScriptNode::ScriptNode ( const ScriptNode old)
private

Member Function Documentation

virtual DataValue* ScriptNode::asNewDataValue ( )
pure virtual

If the node contains a dataValue, materialize such a dataValue Use the Unit + value paradigm, if possible.

Implemented in LuaNode.

virtual bool ScriptNode::execute ( FlexArray< DataReader * > &  inputs,
FlexArray< SettingReader * > &  settings,
FlexArray< DataWriter * > &  outputs,
FlexArray< const Unit * > &  outUnits,
Logger logger 
)
pure virtual

Attempt to execute the function contained in this node.

Implemented in LuaNode.

Referenced by Method::execute(), Method::executeBool(), and Method::executeVoid().

virtual bool ScriptNode::execute ( FlexArray< DataReader * > &  inputs,
FlexArray< SettingReader * > &  settings,
bool &  boolOutput,
Logger logger 
)
pure virtual

Attempt to execute the function contained in this node, returning only a single boolean value.

Implemented in LuaNode.

virtual bool ScriptNode::execute ( Logger logger)
pure virtual

Attempt to execute the function contained in this node, with no inputs and no return value.

Implemented in LuaNode.

virtual int ScriptNode::getIndex ( ) const
pure virtual

Returns the index of the node, -1 if named.

Implemented in LuaNode.

virtual ScriptNode* ScriptNode::getIndexedNode ( unsigned int  index)
pure virtual

Returns the indexed (array, or list-like) node at the zero-based index, or NULL if none.

Implemented in LuaNode.

virtual const Str& ScriptNode::getName ( ) const
pure virtual

Returns the name of the node, undefined if indexed.

Implemented in LuaNode.

virtual ScriptNode* ScriptNode::getNamedNode ( const Str nodeName)
pure virtual

Returns the child node, by name, or NULL if none.

Implemented in LuaNode.

virtual int ScriptNode::getNodeCount ( const Str nodeName) const
pure virtual

Returns the number of indexed (array, or list-like) nodes Returns 0 is this is not a table.

Implemented in LuaNode.

virtual ScriptNode* ScriptNode::getParentNode ( ) const
pure virtual

Returns the parent node, or NULL if this is the root.

Implemented in LuaNode.

virtual bool ScriptNode::hasChildNodes ( ) const
pure virtual

Returns true if the node contains child nodes.

Implemented in LuaNode.

virtual ScriptNode* ScriptNode::newChildFunction ( const Str functionName,
const Str functionBody,
Logger logger 
)
pure virtual

Returns a new child node that is a function.

Implemented in LuaNode.

virtual ScriptNode* ScriptNode::newChildNode ( const Str nodeName)
pure virtual

Returns a new child node than can contain other nodes.

Implemented in LuaNode.

virtual bool ScriptNode::readBool ( bool &  readTo) const
pure virtual

Sets readTo to the value of the node, as a boolean Returns true if read success.

Implemented in LuaNode.

virtual bool ScriptNode::readDouble ( double &  readTo) const
pure virtual

Sets readTo to the value of the node, as a double Returns true if read success.

Implemented in LuaNode.

Referenced by LuaNode::asNewDataValue().

virtual bool ScriptNode::readString ( Str readTo) const
pure virtual

Sets readTo to the value of the node, unsigned char string Returns true if read success.

Implemented in LuaNode.

virtual Str ScriptNode::toString ( ) const
pure virtual

Returns a string representation of this node, with its ancestors, separated by "." characters.

Implemented in LuaNode.


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