ASTNodeFactory

class ASTNodeFactory

Manages a set of ASTNodes.

This class provides a createASTNode which creates a new ASTNode, but it retains a reference to it. When this class is destroyed, all the nodes that it created are destroyed as well.

TODO: There might be a standard way of doing this, look it up and replace if there exists such a thing.

Public Functions

ASTNodeFactory()
~ASTNodeFactory()
libsbml::ASTNode *create(libsbml::ASTNodeType_t type = libsbml::AST_UNKNOWN)

Creates and returns a new ASTNode.

Unless the argument type is given, the returned node will by default have a type of AST_UNKNOWN. If the type isn’t supplied when caling this constructor, the caller should set the node type to something else as soon as possible using ASTNode::setType(int).

Parameters:

type – an optional type code indicating the type of node to create.

libsbml::ASTNode *create(libsbml::Token_t *token)

Creates a new ASTNode from the given Token.

The resulting ASTNode will contain the same data as the Token.

Parameters:

token – the Token to add.

libsbml::ASTNode *create(const libsbml::ASTNode &orig)

Copy constructor; creates a deep copy of the given ASTNode.

Parameters:

orig – the ASTNode to be copied.

Private Functions

inline ASTNodeFactory(const ASTNodeFactory&)

no copy or asigment

inline ASTNodeFactory &operator=(const ASTNodeFactory &rhs)

Private Members

std::list<libsbml::ASTNode*> nodes

the list of nodes this factory created.