Archon::X3D::NodeType Struct Reference

Runtime representation of an X3D node type. More...

#include <archon/x3d/server/type.H>

Collaboration diagram for Archon::X3D::NodeType:

Collaboration graph
[legend]
List of all members.

Public Types

typedef vector< const NodeType
* >::const_iterator 
iterator
 Must be called with a scenegraph read lock.

Public Member Functions

unsigned long getIndex () const
Ref< NodeBaseinstantiate (BackRef< ExecutionContext > context) const
 Instantiate a new node of this type.
string getName () const
 Get the name of this node type.
string getContainerField () const
 Name of default container field for use in the XML parser.
bool isAbstract () const
bool isVirtualBase () const
bool isInternalUseOnly () const
bool isDerivedFrom (const NodeType *baseType) const
bool isUserInstantiable () const
 May this node be instantiated through the X3D parser and the SAI?
unsigned long getNumberOfImmediateFields () const
 Get the number fields defined by this node type excluding those fields inherited from other node types.
const FieldBasegetImmediateField (unsigned long fieldIndex) const
 Get an immediate field by index.
const FieldBaselookupImmediateField (string name) const
 Like NodeType::lookupField except that this method does not include the fields of the base node types from which this one is derived.
const FieldBaselookupField (string name) const
 Search for a field of the specified name in this node type.
const NodeFieldBaselookupNodeField (const NodeType *) const
 Seach for a private or exposed node field whos type is a base type of the argument type.
void setFields (const vector< const FieldBase * > *fields)
 You may use this method to assign a set of fields to a NodeType.
bool changedSince (const NodeBase *, const Time &) const
 Must be called with a scenegraph read lock.
void describe (Logger *) const
iterator derivedFromBegin () const
iterator derivedFromEnd () const

Static Public Member Functions

static unsigned long getTotalNumber ()
static const NodeTypeget (unsigned long index)
 Fetch an X3D node type by index.
static const NodeTypelookup (const string &nodeTypeName)
 Lookup an X3D node type by name.
static const NodeTypenewAbstract (string name, bool virtualBase, const vector< const FieldBase * > *fields)
static const NodeTypenewAbstract (string name, bool virtualBase, const vector< const FieldBase * > *fields, const NodeType *derivedFrom1)
static const NodeTypenewAbstract (string name, bool virtualBase, const vector< const FieldBase * > *fields, const NodeType *derivedFrom1, const NodeType *derivedFrom2)
static const NodeTypenewConcrete (string name, string conatinerField, Ref< NodeBase >(*instanceMaker)(BackRef< ExecutionContext >), const vector< const FieldBase * > *fields, const NodeType *derivedFrom1)
static const NodeTypenewConcrete (string name, string conatinerField, Ref< NodeBase >(*instanceMaker)(BackRef< ExecutionContext >), const vector< const FieldBase * > *fields, const NodeType *derivedFrom1, const NodeType *derivedFrom2)
static void describeAll (Logger *)

Static Public Attributes

static const int maxIndexBits = 7

Detailed Description

Runtime representation of an X3D node type.

Examples of field types are: Group, Transform...

Node types may inherit fields from other node type through multiple iheritance. There are two restrictions though: The inheritance graph may not by cyclic (of cause), and the names of all local and inherited fields must be individually unique in every node type. This includes all set_* and *_changed variants.

There is a last restriction relating to the way XML encoded X3D documents are parsed: Among all local and inherited fields which are private or exposed and of node type (SFNode and MFNode), no two may have the same node type associated with them. Neither may the node type of one node field be derived in one or more steps from the node type of another such node field. This enables the XML parser to uniquely determine into which field a sub node must be placed.

Definition at line 288 of file type.H.


Member Function Documentation

string Archon::X3D::NodeType::getContainerField  )  const [inline]
 

Name of default container field for use in the XML parser.

Is always the empty string for abstract node types.

Definition at line 326 of file type.H.

Referenced by Archon::X3D::XML::Parser::parseStartElement().

const FieldBase* Archon::X3D::NodeType::getImmediateField unsigned long  fieldIndex  )  const [inline]
 

Get an immediate field by index.

The immediate fields are those defined directly by this type. Fields inherited from other node types are not included. The order in force is that given by the node type specifications in ISO/IEC 19775-1 section 7 - 30.

Definition at line 358 of file type.H.

Referenced by Archon::X3D::FieldBase::fetch().

unsigned long Archon::X3D::NodeType::getTotalNumber  )  [static]
 

Returns:
the total number of X3D node types.

Definition at line 127 of file type.C.

Referenced by Archon::X3D::SAI::Session::createNode().

Ref< NodeBase > Archon::X3D::NodeType::instantiate BackRef< ExecutionContext context  )  const
 

Instantiate a new node of this type.

The new node will be linked ti the specified ExecutionContext.

Definition at line 145 of file type.C.

Referenced by Archon::X3D::SAI::Session::createNode(), Archon::Raytracer::main(), Archon::X3D::XML::Parser::parseStartElement(), and Archon::X3D::VRML::Parser::Context::pushNodeInstance().

const NodeType * Archon::X3D::NodeType::lookup const string &  nodeTypeName  )  [static]
 

Lookup an X3D node type by name.

Parameters:
nodeTypeName Is UTF8 encoded.

Definition at line 139 of file type.C.

Referenced by Archon::X3D::SAI::Session::createNode(), Archon::X3D::XML::Parser::parseStartElement(), and Archon::X3D::VRML::Parser::Context::pushNodeInstance().

const FieldBase * Archon::X3D::NodeType::lookupField string  name  )  const
 

Search for a field of the specified name in this node type.

'set_*' and '*_changed' variants are tryed automatically.

Returns:
0 if not found.
Note:
This method obviously cannot find custom fields. If you need to search among both static and custom fields then use NodeBase::lookupField instead.

Definition at line 183 of file type.C.

Referenced by Archon::X3D::UrlObject::addUri(), Archon::X3D::NodeBase::lookupField(), Archon::X3D::XML::Parser::parseStartElement(), and Archon::X3D::Viewer::ShapeCache::ShapeCache().

const FieldBase * Archon::X3D::NodeType::lookupImmediateField string  name  )  const
 

Like NodeType::lookupField except that this method does not include the fields of the base node types from which this one is derived.

Also, this method does not detect the 'set_*' and '*_changed' variants of the field names, only the base names are included in the search.

Definition at line 190 of file type.C.

References Archon::X3D::FieldBase::getName().

const NodeFieldBase * Archon::X3D::NodeType::lookupNodeField const NodeType  )  const
 

Seach for a private or exposed node field whos type is a base type of the argument type.

If more than one such field exists, the first one will be returned.

Currently used only through the XML parser.

Returns:
0 if not found.

Definition at line 200 of file type.C.

References Archon::X3D::FieldBase::getIsEventSource(), Archon::X3D::FieldBase::getIsEventTarget(), Archon::X3D::NodeFieldBase::getNodeType(), and isDerivedFrom().

Referenced by Archon::X3D::XML::Parser::parseStartElement().

void Archon::X3D::NodeType::setFields const vector< const FieldBase * > *  fields  ) 
 

You may use this method to assign a set of fields to a NodeType.

Doing this will erase all previously specified fields for this NodeType.

IMPORTANT: If this method is called on a NodeType after that same NodeType was specified as a base type for another NodeType, then this method has to be called on the derived NodeType afterwards, and this applies recursivly.

Definition at line 106 of file type.C.

References maxIndexBits.


The documentation for this struct was generated from the following files:
Generated on Sun Jul 30 23:01:25 2006 for Archon by  doxygen 1.4.4