Archon::X3D::NodeBase Struct Reference

The common virtual base for all abstract and concrete X3D nodes. More...

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

Inheritance diagram for Archon::X3D::NodeBase:

Inheritance graph
[legend]
Collaboration diagram for Archon::X3D::NodeBase:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual const NodeTypegetType () const =0
void realize ()
 If this node is not already realized, then realize it now.
bool isRealized () const
virtual void onRealized ()
 Will never be called with a scenegraph lock or a lock on this node.
string getName () const
void setName (string name) throw (NodeNameInUseException)
virtual const FieldBaselookupField (string name) const
 Search for a field of the specified name in this node.
Ref< ValueBaseget (const FieldBase *) const throw (AccessException, UnexpectedException)
 Must not be called with a scenegraph lock.
unsigned getSize (const SequenceFieldBase *) const throw (AccessException, UnexpectedException)
 Must not be called with a scenegraph lock.
Ref< ValueBasegetAt (const SequenceFieldBase *, unsigned index) const throw (AccessException, RangeException, UnexpectedException)
 Must not be called with a scenegraph lock.
void set (const FieldBase *, const Event *) throw (AccessException, UnexpectedException)
void setAt (const SequenceFieldBase *, Ref< const ValueBase >, unsigned index, Time) throw (AccessException, RangeException, UnexpectedException)
void add (const SequenceFieldBase *, Ref< const ValueBase >, Time) throw (AccessException, UnexpectedException)
void remove (const SequenceFieldBase *, Ref< const ValueBase >, Time) throw (AccessException, UnexpectedException)
void add (const NodeSequenceFieldBase *, Ref< NodeBase >, Time) throw (AccessException, UnexpectedException)
 Convenience wrapper for add(const SequenceFieldBase *, Ref<ValueBase>, Time).
void remove (const NodeSequenceFieldBase *, Ref< NodeBase >, Time) throw (AccessException, UnexpectedException)
 Convenience wrapper for remove(const SequenceFieldBase *, Ref<ValueBase>, Time).
bool inject (const NodeFieldBase *, Ref< NodeBase > childNode, Time stamp) throw (AccessException, UnexpectedException)
 Must not be called with a scenegraph lock.
virtual bool changedSince (const Time &t) const
 Is any field of this node changed?

Public Attributes

const BackRef< ExecutionContextcontext
 The executionContext that this node bolongs to.

Protected Member Functions

 NodeBase (BackRef< ExecutionContext > context)
 NodeBase ()
 This constructor must never be called, and if it does, it throws.
virtual ~NodeBase ()
virtual void refForwardDestroy ()
bool isRealizedNoLock () const

Protected Attributes

const Mutex mutex

Classes

struct  AccessException
 Should be thrown when the combination of the phase of the nodes lifecycle and the input/output capabilities of the field is not compatible with the requested operation. More...
struct  RangeException
 Should be thrown when a field of sequence type is shorter that a specified index. More...
struct  RealizedException
 Should be thrown by methods that are illegal on realized nodes. More...

Detailed Description

The common virtual base for all abstract and concrete X3D nodes.

Note:
This class needs to be a virtual base.

Definition at line 58 of file node.H.


Constructor & Destructor Documentation

Archon::X3D::NodeBase::NodeBase BackRef< ExecutionContext context  )  [protected]
 

Parameters:
context The ExecutionContext that this node belongs to. Must not be null.

Definition at line 36 of file node.C.

Archon::X3D::NodeBase::NodeBase  )  [protected]
 

This constructor must never be called, and if it does, it throws.

It is here because of notational convenience. That is, if it wasn't here, then NodeBase would not have a default constructor. This in turn means that every abstract sub-class such as ChildNode must include an explicit construction of NodeBase with a executionContext argument. This is completely redundant ans therefore inconvenient since NodeBase is required to be a virtual base class of all node types, and therefor an abstract node type will never get to call any NodeBase constructor itself.

Definition at line 44 of file node.C.


Member Function Documentation

void Archon::X3D::NodeBase::add const SequenceFieldBase ,
Ref< const ValueBase ,
Time 
throw (AccessException, UnexpectedException)
 

Todo:
Verify asyclic property

Definition at line 271 of file node.C.

References Archon::SaiTestApps::Filebrowser::mutex, and Archon::X3D::NodeValue::value.

bool Archon::X3D::NodeBase::changedSince const Time t  )  const [virtual]
 

Is any field of this node changed?

Must be called with a scenegraph read lock.

Definition at line 389 of file node.C.

References Archon::X3D::NodeType::changedSince().

bool Archon::X3D::NodeBase::inject const NodeFieldBase ,
Ref< NodeBase childNode,
Time  stamp
throw (AccessException, UnexpectedException)
 

Must not be called with a scenegraph lock.

Todo:
Verify asyclic property

Definition at line 357 of file node.C.

References Archon::Utilities::Ref< T >::get(), Archon::SaiTestApps::Filebrowser::mutex, and n.

const FieldBase * Archon::X3D::NodeBase::lookupField string  name  )  const [virtual]
 

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

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

Note that the default is just to consult the associated node type. This may be overwritten by nodes that can contain custom fields such as Script nodes. BUT BE SURE TO MAKE IT REENTRANT.

Returns:
0 if not found.
See also:
NodeType::lookupField

Script::lookupField

Definition at line 92 of file node.C.

References Archon::X3D::NodeType::lookupField().

void Archon::X3D::NodeBase::realize  ) 
 

If this node is not already realized, then realize it now.

A node must be realized when it is added as a child of some other node and or when it becomes the target of a route whichever comes first. It should not be realized in any other case.

This allows us to assume that any node accessed in the rendering step as well as any node accessed in the event cascading step are always realized.

Must not be called with a scenegraph lock.

Definition at line 62 of file node.C.

References mutex, and onRealized().

void Archon::X3D::NodeBase::remove const SequenceFieldBase ,
Ref< const ValueBase ,
Time 
throw (AccessException, UnexpectedException)
 

Todo:
Verify asyclic property

Definition at line 309 of file node.C.

References Archon::SaiTestApps::Filebrowser::mutex, and Archon::X3D::NodeValue::value.

void Archon::X3D::NodeBase::set const FieldBase ,
const Event
throw (AccessException, UnexpectedException)
 

Must not be called with a scenegraph lock.

Todo:
Verify asyclic property

Definition at line 175 of file node.C.

References Archon::X3D::NodeSequenceValue::begin(), Archon::X3D::NodeSequenceValue::end(), Archon::SaiTestApps::Filebrowser::mutex, and Archon::X3D::NodeValue::value.

Referenced by Archon::X3D::XML::Parser::SequenceValueParser< T >::parse(), and Archon::X3D::XML::Parser::SingleValueParser< T >::parse().

void Archon::X3D::NodeBase::setAt const SequenceFieldBase ,
Ref< const ValueBase ,
unsigned  index,
Time 
throw (AccessException, RangeException, UnexpectedException)
 

Todo:
Verify asyclic property

Definition at line 229 of file node.C.

References Archon::SaiTestApps::Filebrowser::mutex, and Archon::X3D::NodeValue::value.


Member Data Documentation

const BackRef<ExecutionContext> Archon::X3D::NodeBase::context
 

The executionContext that this node bolongs to.

Note: It is importatnt that this association can never change, since this anables safe locking on the scene mutex throug a node. In case you want to transfer a node from one scene to another, you have to clone it and then delete the old one.

Definition at line 239 of file node.H.

Referenced by Archon::X3D::UrlObject::addUri(), Archon::X3D::SubSceneNode::getSubScene(), Archon::X3D::FrameDrivenNode::onRealized(), Archon::X3D::SubSceneNode::setSubScene(), Archon::X3D::UrlObject::startLoading(), Archon::X3D::TimeSensor::tick(), Archon::X3D::FrameDrivenNode::~FrameDrivenNode(), and ~NodeBase().


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