class OmNode

Base class for OpenMath nodes. More...

Contains pure virtuals
Definition#include <OmNode.h>
Inherited byOmApplicationNode, OmBindingNode, OmDocumentNode, OmErrorNode, OmFinalNode, OmBigIntegerNode, OmByteArrayNode, OmFloatNode, OmIntegerNode, OmStringNode, OmWStringNode, OmSymbolNode, OmVariableNode, OmPInstructionNode, OmObjectNode
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Members

Protected Members


Detailed Description

Base class for OpenMath nodes.

This class provides an attributed and ordered hierarchical structure to represent any OpenMath formal object. As an unbound tree node structure, it specifies some storage managment facilities (OpenMath externalized format), and also it does an automatic memory managment based on the principle of adoption (all attributes and children are adopted and are freed with the parent node). Because of this principle however, you should always allocate your nodes by using the 'new' operator.

Iterator (class)

This class provides a basic linear iteration process on the children of an OmNode.

ConstIterator (class)

This class provides a basic linear iteration process on the children of a constant OmNode.

OmType type ()
[const virtual]

Get the concrete type.

OmNode * clone ()
[const virtual]

Clone deeply the entire node structure, including the attributes and the adopted subtree. All the copy constructors should be called from the class hierarchy up to this class.

unsigned int count ()
[const virtual]

Count the number of children.

Iterator iterate ()
[virtual]

Create an iterator on this node.

ConstIterator iterate ()
[const virtual]

Create a constant iterator on this constant node.

OmNode * append (OmNode * adoption_in)
[virtual]

Append a new child node at the end of the list of children. The child is adopted. The current (this) node is returned.

OmNode * insert (Iterator it_in, OmNode * adoption_in)
[virtual]

Insert a new child node in the list of children. The position is determined by the given iterator (which can be done). The current (this) node is returned.

OmNode * extract (Iterator it_in, OmNode *& desadoption_out)
[virtual]

Extract a child node from the list of children. The position is determined by the given active iterator. The extracted node is returned as an out parameter, and no memory destruction occurs. The current (this) node is returned.

OmNode * kill (Iterator it_in)
[virtual]

Kill a child node in the list of children. The position is determined by the given active iterator. The killed node, its attributes, and its adopted subtree are all definitively destroyed from the memory. The current (this) node is returned.

unsigned int countAttributes ()
[const virtual]

Count the number of attributes.

OmNode * consultAttribute (unsigned int index_in, OmSymbolNode *& symbol_out, OmNode *& node_out)
[virtual]

Consult an attribute. The position is determined by the given index. The consulted attribute is returned as two out parameters. The current (this) node is returned.

OmNode * appendAttribute (OmSymbolNode * symbolAdoption_in, OmNode * nodeAdoption_in)
[virtual]

Append a new attribute at the end of the list of attributes. The attribute is adopted. The current (this) node is returned.

OmNode * insertAttribute (unsigned int index_in, OmSymbolNode * symbolAdoption_in, OmNode * nodeAdoption_in)
[virtual]

Insert a new attribute in the list of attributes. The position is determined by the given index (which can be equal to the number of attributes). The current (this) node is returned.

OmNode * extractAttribute (unsigned int index_in, OmSymbolNode *& symbolDesadoption_out, OmNode *& nodeDesadoption_out)
[virtual]

Extract an attribute from the list of attributes. The position is determined by the given index. The extracted attribute is returned as two out parameters, and no memory destruction occurs. The current (this) node is returned.

OmNode * killAttribute (unsigned int index_in)
[virtual]

Kill an attribute in the list of attributes. The position is determined by the given index. The killed attribute is definitively destroyed from the memory. The current (this) node is returned.

unsigned int countComments ()
[const virtual]

Count the number of comments.

OmNode * consultComment (unsigned int index_in, OmComment *& comment_out)
[virtual]

Consult a comment. The position is determined by the given index. The consulted comment is returned as an out parameters. The current (this) node is returned.

OmNode * appendComment (OmComment * adoption_in)
[virtual]

Append a new comment at the end of the list of comments. The comment is adopted. The current (this) node is returned.

OmNode * insertComment (unsigned int index_in, OmComment * adoption_in)
[virtual]

Insert a new comment in the list of comment. The position is determined by the given index (which can be equal to the number of comments). The current (this) node is returned.

OmNode * extractComment (unsigned int index_in, OmComment *& desadoption_out)
[virtual]

Extract a comment from the list of comments. The position is determined by the given index. The extracted comment is returned as an out parameters, and no memory destruction occurs. The current (this) node is returned.

OmNode * killComment (unsigned int index_in)
[virtual]

Kill a comment in the list of comments. The position is determined by the given index. The killed comment is definitively destroyed from the memory. The current (this) node is returned.

void hibernate (OmOutputDevice & output_in, const OmNode * node_in)
[static]

Hibernate a node to an OpenMath output device. The writing follows a Standard OpenMath protocol, so that the node, its attributes and its adopted subtree are all stored into the device. The attached comments are all written just before the object (prefix position).

OmNode * resurrect (OmInputDevice & input_in)
[static]

Resurrect the node from an OpenMath input device. The reading follows a Standard OpenMath protocol, so that the node, its attributes and its adopted subtree are all restored from the device. Note comments cannot be read using this method (they do not inherit from OmNode), a comment collector must be called for this.

OmNode * create (OmType type_in)
[static]

Dynamically create a new node given its type. However, this virtual constructor here breaks the OCP principle for OmNode, but on a relatively strong stabilized hierarchy (based on formal specifications).

OmNode ()
[protected]

Default constructor for OmNode. Every inherited class should provide a default constructor to keep the mechanism, so that instances conforming to OmNode can be virtually created by calling create().

OmNode (const OmNode & other_in)
[protected]

Copy constructor for OmNode. Every inherited class should provide a copy constructor to keep the mechanism, so that instances conforming to OmNode can be cloned deeply by calling clone().

~OmNode ()
[protected virtual]

Hidden destructor for dynamic memory allocation only. Every inherited class should provide an hidden destructor to respect the philosophy.

OmType typeImp ()
[protected const pure virtual]

Implement this to return the concrete type of the node. This can be useful to access dynamic type identification when needed. For compound objects, only the corresponding begin tag should be returned.

OmNode * cloneImp ()
[protected const pure virtual]

Implement this to clone deeply a node. The work generally consists in creating a new concrete node by calling the concrete copy constructor.

void writeImp (OmOutputDevice & output_in)
[protected const pure virtual]

Implement this to write a node to an output device. Not the attributes nor comments have to be written. The aim is to execute a minimal polymorphic parsing, so that the specific 'tags' (between < and >) are written using OmOutputDevice::writeX() and subnodes are written by simply calling hibernate().

void readImp (OmInputDevice & input_in)
[protected pure virtual]

Implement this to read a node from an input device. The attributes have not to be read. However reading comments inside the node is required (not before nor after however). The aim is to execute a minimal polymorphic parsing, so that the specific 'tags' (between < and >) are read using OmInputDevice::readX() and subnodes are read by simply calling resurrect(). Comments inside the object must be read using a comment collector.


Generated by: root@localhost.localdomain on Tue Oct 12 21:02:30 199.