Keeps meta information about Nodes. More...
#include <InstantIO/NodeType.h>
Public Types | |
typedef Node *(* | CreateNodeMethod )() |
Defines the method used to create new Nodes. | |
typedef std::vector< NodeType * > | NodeTypeVector |
Defines a vector of NodeTypes. | |
Public Member Functions | |
NodeType (const std::string &name, CreateNodeMethod createMethod, const char *shortDescription=0, const char *longDescription=0, const char *author=0, Field *fields=0, unsigned int numFields=0) | |
Creates a new NodeType object. | |
~NodeType () | |
Destroys the NodeType object. | |
const std::string & | getName () const |
Returns the name of the NodeType. | |
const std::string & | getShortDescription () const |
Returns a short description of the Node. | |
const std::string & | getLongDescription () const |
Returns a detailed description of the Node. | |
const std::string & | getAuthor () const |
Returns the name of the person that wrote the Node. | |
const Field * | getFields () const |
Returns all meta information about the fields of the Node. | |
const Field * | getField (const std::string &name) const |
Returns meta information about a specific field of the Node. | |
unsigned int | numFields () const |
Returns the number of fields for the NodeType. | |
std::auto_ptr< Node > | newInstance () const |
Creates a new Node. | |
Static Public Member Functions | |
static void | getTypes (NodeTypeVector &types) |
Fills a vector with all types of nodes currently available. | |
static const NodeType * | findType (std::string name) |
Tries to find a NodeType for the given name. | |
static std::auto_ptr< Node > | newInstance (const std::string &type) |
Creates a new Node. |
Keeps meta information about Nodes.
When you implement a new Node, you also have to create an instance of the NodeType object that contains meta information about the Node. This information consists of:
The following piece of code demonstrates how to create a NodeType object that keeps meta information about a Node "MyNode":
static NodeType myNodeType( "MyNode", &MyNode::create, "Short description", "Detailed description", "Patrick D&auml;hne", fields, sizeof(fields) / sizeof(Field));
InstantIO::NodeType::NodeType | ( | const std::string & | name, | |
CreateNodeMethod | createMethod, | |||
const char * | shortDescription = 0 , |
|||
const char * | longDescription = 0 , |
|||
const char * | author = 0 , |
|||
Field * | fields = 0 , |
|||
unsigned int | numFields = 0 | |||
) |
Creates a new NodeType object.
name | The name of the NodeType. This name is used to identify the NodeType. | |
createMethod | Method used to create new nodes of this type | |
shortDescription | A short description of the Node. This information if not used by the InstantIO system in any way, it is simply a human-readable string that serves documentation purposes. | |
longDescription | A detailed description of the Node. This information is not used by the InstantIO system in any way, it is simply a human-readable string that serves documentation purposes. | |
author | The name of the person that wrote the node. This information is not used by the InstantIO system in any way, it simply serves documentation purposes. | |
fields | An array that contains meta-information about the fields of the Node. | |
numFields | The number of fields |
static void InstantIO::NodeType::getTypes | ( | NodeTypeVector & | types | ) | [static] |
Fills a vector with all types of nodes currently available.
types | The vector that gets filled with the NodeTypes |
static const NodeType* InstantIO::NodeType::findType | ( | std::string | name | ) | [static] |
Tries to find a NodeType for the given name.
name | The name of the NodeType. Case does not matter. |
const std::string& InstantIO::NodeType::getName | ( | ) | const [inline] |
Returns the name of the NodeType.
The name is used to identify the NodeType. Case does not matter.
const std::string& InstantIO::NodeType::getShortDescription | ( | ) | const [inline] |
Returns a short description of the Node.
This information is not used by the InstantIO system in any way, it is simply a human-readable string that serves documentation purposes.
const std::string& InstantIO::NodeType::getLongDescription | ( | ) | const [inline] |
Returns a detailed description of the Node.
This information is not used by the InstantIO system in any way, it is simply a human-readable string that serves documentation purposes.
const std::string& InstantIO::NodeType::getAuthor | ( | ) | const [inline] |
Returns the name of the person that wrote the Node.
This information is not used by the InstantIO system, it simply serves documentation purposes.
const Field* InstantIO::NodeType::getFields | ( | ) | const [inline] |
Returns all meta information about the fields of the Node.
Fields contain parameters of Nodes.
const Field* InstantIO::NodeType::getField | ( | const std::string & | name | ) | const |
Returns meta information about a specific field of the Node.
name | The name of the field. Case does not matter. |
unsigned int InstantIO::NodeType::numFields | ( | ) | const [inline] |
Returns the number of fields for the NodeType.
static std::auto_ptr<Node> InstantIO::NodeType::newInstance | ( | const std::string & | type | ) | [static] |
std::auto_ptr<Node> InstantIO::NodeType::newInstance | ( | ) | const [inline] |