InstantIO::NodeType Class Reference

Keeps meta information about Nodes. More...

#include <InstantIO/NodeType.h>

List of all members.

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 FieldgetFields () const
 Returns all meta information about the fields of the Node.
const FieldgetField (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< NodenewInstance () 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 NodeTypefindType (std::string name)
 Tries to find a NodeType for the given name.
static std::auto_ptr< NodenewInstance (const std::string &type)
 Creates a new Node.

Detailed Description

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&amp;auml;hne",
   fields,
   sizeof(fields) / sizeof(Field));
 

Author:
Patrick Dähne
See also:
Node Node

Constructor & Destructor Documentation

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.

Parameters:
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

Member Function Documentation

static void InstantIO::NodeType::getTypes ( NodeTypeVector types  )  [static]

Fills a vector with all types of nodes currently available.

Parameters:
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.

Parameters:
name The name of the NodeType. Case does not matter.
Returns:
The NodeType that matches the label, or 0 when no such NodeType exists.
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.

Returns:
The name of the NodeType.
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.

Returns:
The short description.
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.

Returns:
The detailed description.
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.

Returns:
The name of the author
const Field* InstantIO::NodeType::getFields (  )  const [inline]

Returns all meta information about the fields of the Node.

Fields contain parameters of Nodes.

Returns:
An array containing all field information
const Field* InstantIO::NodeType::getField ( const std::string &  name  )  const

Returns meta information about a specific field of the Node.

Parameters:
name The name of the field. Case does not matter.
Returns:
The field that has the given name or 0 when such a field does not exist.
unsigned int InstantIO::NodeType::numFields (  )  const [inline]

Returns the number of fields for the NodeType.

Returns:
The number of fields
static std::auto_ptr<Node> InstantIO::NodeType::newInstance ( const std::string &  type  )  [static]

Creates a new Node.

Returns:
The new Node.
std::auto_ptr<Node> InstantIO::NodeType::newInstance (  )  const [inline]

Creates a new Node.

Returns:
The new Node.

The documentation for this class was generated from the following file:
Generated on Thu Jul 31 17:17:32 2014 by  doxygen 1.6.3