Ocean
Ocean::SceneDescription::Node Class Referenceabstract

This class is the base class for all scene description nodes. More...

Inheritance diagram for Ocean::SceneDescription::Node:

Data Structures

class  NodeSpecification
 This class implements a node specification object. More...
 

Public Types

enum  FieldAccessType {
  ACCESS_NONE = 0 , ACCESS_GET = 1 , ACCESS_SET = 2 , ACCESS_GET_SET = ACCESS_GET | ACCESS_SET ,
  ACCESS_EXPLICIT_NOTIFICATION = 4
}
 Definition of different field access types. More...
 

Public Member Functions

virtual DescriptionType descriptionType () const =0
 Returns the scene description type of this node. More...
 
NodeId id () const
 Returns the unique node id of this node. More...
 
const std::string & name () const
 Returns the name of this node. More...
 
const std::string & type () const
 Returns the type of this node. More...
 
const Fieldfield (const std::string &fieldName) const
 Returns the field base of a specified (standard) field. More...
 
Fieldfield (const std::string &fieldName)
 Returns the field base of a specified (standard) field. More...
 
virtual const FieldanyField (const std::string &fieldName) const
 Returns the field base of a specified standard or dynamic field. More...
 
virtual FieldanyField (const std::string &fieldName)
 Returns the field base of a specified standard or dynamic field. More...
 
template<typename T >
const T & field (const std::string &fieldName) const
 Returns a specified (standard) field. More...
 
template<typename T >
T & field (const std::string &fieldName)
 Returns a specified (standard) field. More...
 
template<typename T >
const T & anyField (const std::string &fieldName) const
 Returns a specified standard or dynamic field. More...
 
template<typename T >
T & anyField (const std::string &fieldName)
 Returns a specified standard or dynamic field. More...
 
FieldAccessType fieldAccessType (const std::string &fieldName) const
 Returns the access type of a specified field. More...
 
virtual void setName (const std::string &name)
 Sets the name of this node. More...
 
bool hasField (const std::string &fieldName) const
 Returns whether this node has a special (standard) field. More...
 
virtual bool hasAnyField (const std::string &fieldName) const
 Returns whether this node has a special standard or dynamic field. More...
 
virtual std::string originalFieldName (const std::string &fieldName) const
 Tries to translate an alias field name to the original field name. More...
 
Field::Type fieldType (const std::string &fieldName) const
 Returns the type of a special field. More...
 
unsigned int fieldDimension (const std::string &fieldName) const
 Return the dimension of a special field. More...
 
virtual bool isDynamic () const
 Returns whether this node can hold dynamic generated field. More...
 

Protected Types

typedef std::map< std::string, Field * > FieldMap
 Definition of a map mapping field names to fields. More...
 

Protected Member Functions

 Node ()
 Creates a new node. More...
 
 Node (const Node &node)=delete
 Disabled copy constructor. More...
 
virtual ~Node ()
 Destructs a node. More...
 
virtual size_t objectAddress () const
 Returns the address of the most derived object. More...
 
void registerField (NodeSpecification &specification, const std::string &fieldName, const Field &field, const FieldAccessType accessType=ACCESS_GET_SET)
 Registers a new field to a specified node type. More...
 
Nodeoperator= (const Node &node)=delete
 Disabled copy operator. More...
 

Static Protected Member Functions

static LocknodeIdCounterLock ()
 Returns the lock for the node id counter. More...
 

Protected Attributes

NodeId nodeId_
 Unique node id. More...
 
std::string name_
 Node name. More...
 
NodeSpecificationspecification_ = nullptr
 Pointer to the node specification, guaranteed to exist as long as the node exist. More...
 

Static Protected Attributes

static NodeId nodeIdCounter_
 Unique node id counter. More...
 

Friends

class Ocean::ObjectRef< Node >
 

Detailed Description

This class is the base class for all scene description nodes.

Member Typedef Documentation

◆ FieldMap

typedef std::map<std::string, Field*> Ocean::SceneDescription::Node::FieldMap
protected

Definition of a map mapping field names to fields.

Member Enumeration Documentation

◆ FieldAccessType

Definition of different field access types.

Enumerator
ACCESS_NONE 

No access possible, which can be a static field.

ACCESS_GET 

Read only field.

ACCESS_SET 

Write only field.

ACCESS_GET_SET 

Read and write field.

ACCESS_EXPLICIT_NOTIFICATION 

Field which will produce an explicit update event if it receives a new value.

Constructor & Destructor Documentation

◆ Node() [1/2]

Ocean::SceneDescription::Node::Node ( )
protected

Creates a new node.

◆ Node() [2/2]

Ocean::SceneDescription::Node::Node ( const Node node)
protecteddelete

Disabled copy constructor.

Parameters
nodeObject which would be copied

◆ ~Node()

virtual Ocean::SceneDescription::Node::~Node ( )
protectedvirtual

Destructs a node.

Member Function Documentation

◆ anyField() [1/4]

virtual Field& Ocean::SceneDescription::Node::anyField ( const std::string &  fieldName)
virtual

Returns the field base of a specified standard or dynamic field.

Beware: Changing a field value using this function will not produce any field changing event functions!

Parameters
fieldNameName of the (standard or dynamic) field to return
Returns
Field base of the specified field
Exceptions
Isthrown if the field does not exist

Reimplemented in Ocean::SceneDescription::DynamicNode.

◆ anyField() [2/4]

template<typename T >
T & Ocean::SceneDescription::Node::anyField ( const std::string &  fieldName)

Returns a specified standard or dynamic field.

Beware: Changing a field value using this function will not produce any field changing event functions!

Parameters
fieldNameName of the field to return
Returns
Specified field
Exceptions
Isthrown if the field does not exist

◆ anyField() [3/4]

virtual const Field& Ocean::SceneDescription::Node::anyField ( const std::string &  fieldName) const
virtual

Returns the field base of a specified standard or dynamic field.

Parameters
fieldNameName of the (standard or dynamic) field to return
Returns
Field base of the specified field
Exceptions
Isthrown if the field does not exist

Reimplemented in Ocean::SceneDescription::DynamicNode.

◆ anyField() [4/4]

template<typename T >
const T & Ocean::SceneDescription::Node::anyField ( const std::string &  fieldName) const

Returns a specified standard or dynamic field.

Parameters
fieldNameName of the field to return
Returns
Specified field
Exceptions
Isthrown if the field does not exist

◆ descriptionType()

virtual DescriptionType Ocean::SceneDescription::Node::descriptionType ( ) const
pure virtual

Returns the scene description type of this node.

Returns
Scene description type

Implemented in Ocean::SceneDescription::SDXNode, and Ocean::SceneDescription::SDLNode.

◆ field() [1/4]

Field& Ocean::SceneDescription::Node::field ( const std::string &  fieldName)

Returns the field base of a specified (standard) field.

Beware: Changing a field value using this function will not produce any field changing event functions!

Parameters
fieldNameName of the field to return
Returns
Field base of the specified field
Exceptions
Isthrown if the field does not exist

◆ field() [2/4]

template<typename T >
T & Ocean::SceneDescription::Node::field ( const std::string &  fieldName)

Returns a specified (standard) field.

Beware: Changing a field value using this function will not produce any field changing event functions!

Parameters
fieldNameName of the field to return
Returns
Specified field
Exceptions
Isthrown if the field does not exist

◆ field() [3/4]

const Field& Ocean::SceneDescription::Node::field ( const std::string &  fieldName) const

Returns the field base of a specified (standard) field.

Parameters
fieldNameName of the field to return
Returns
Field base of the specified field
Exceptions
Isthrown if the field does not exist

◆ field() [4/4]

template<typename T >
const T & Ocean::SceneDescription::Node::field ( const std::string &  fieldName) const

Returns a specified (standard) field.

Parameters
fieldNameName of the field to return
Returns
Specified field
Exceptions
Isthrown if the field does not exist

◆ fieldAccessType()

FieldAccessType Ocean::SceneDescription::Node::fieldAccessType ( const std::string &  fieldName) const

Returns the access type of a specified field.

Parameters
fieldNameName of the field to check
Returns
Field access type
Exceptions
Isthrown if the field does not exist

◆ fieldDimension()

unsigned int Ocean::SceneDescription::Node::fieldDimension ( const std::string &  fieldName) const

Return the dimension of a special field.

Parameters
fieldNameName of the field
Returns
Dimension of the specified field
Exceptions
Isthrown if the field does not exist

◆ fieldType()

Field::Type Ocean::SceneDescription::Node::fieldType ( const std::string &  fieldName) const

Returns the type of a special field.

Parameters
fieldNameName of the field
Returns
Scalar of the specified field type
Exceptions
Isthrown if the field does not exist

◆ hasAnyField()

virtual bool Ocean::SceneDescription::Node::hasAnyField ( const std::string &  fieldName) const
virtual

Returns whether this node has a special standard or dynamic field.

Parameters
fieldNameName of the field
Returns
True, if so

Reimplemented in Ocean::SceneDescription::DynamicNode.

◆ hasField()

bool Ocean::SceneDescription::Node::hasField ( const std::string &  fieldName) const

Returns whether this node has a special (standard) field.

Parameters
fieldNameName of the field
Returns
True, if so

◆ id()

NodeId Ocean::SceneDescription::Node::id ( ) const
inline

Returns the unique node id of this node.

Returns
Unique node id

◆ isDynamic()

virtual bool Ocean::SceneDescription::Node::isDynamic ( ) const
virtual

Returns whether this node can hold dynamic generated field.

Returns
True, if so

Reimplemented in Ocean::SceneDescription::DynamicNode.

◆ name()

const std::string & Ocean::SceneDescription::Node::name ( ) const
inline

Returns the name of this node.

Returns
Node name

◆ nodeIdCounterLock()

static Lock& Ocean::SceneDescription::Node::nodeIdCounterLock ( )
staticprotected

Returns the lock for the node id counter.

Returns
Lock for the node id counter

◆ objectAddress()

virtual size_t Ocean::SceneDescription::Node::objectAddress ( ) const
protectedvirtual

Returns the address of the most derived object.

Each derived (not abstract) class must reimplement this function to guarantee a valid field mapping.

Returns
Address of this object

Reimplemented in Ocean::SceneDescription::SDX::X3D::X3DScene, Ocean::SceneDescription::SDX::X3D::WorldInfo, Ocean::SceneDescription::SDX::X3D::Viewpoint, Ocean::SceneDescription::SDX::X3D::Transform, Ocean::SceneDescription::SDX::X3D::TrackerTransform, Ocean::SceneDescription::SDX::X3D::TouchSensor, Ocean::SceneDescription::SDX::X3D::TimeTrigger, Ocean::SceneDescription::SDX::X3D::TimeSensor, Ocean::SceneDescription::SDX::X3D::TextureTransform, Ocean::SceneDescription::SDX::X3D::TextureProperties, Ocean::SceneDescription::SDX::X3D::TextureCoordinate, Ocean::SceneDescription::SDX::X3D::Text, Ocean::SceneDescription::SDX::X3D::Switch, Ocean::SceneDescription::SDX::X3D::StaticGroup, Ocean::SceneDescription::SDX::X3D::SpotLight, Ocean::SceneDescription::SDX::X3D::Sphere, Ocean::SceneDescription::SDX::X3D::Shape, Ocean::SceneDescription::SDX::X3D::ShaderProgram, Ocean::SceneDescription::SDX::X3D::ShaderPart, Ocean::SceneDescription::SDX::X3D::ScalarInterpolator, Ocean::SceneDescription::SDX::X3D::ProximitySensor, Ocean::SceneDescription::SDX::X3D::PositionInterpolator2D, Ocean::SceneDescription::SDX::X3D::PositionInterpolator, Ocean::SceneDescription::SDX::X3D::PointSet, Ocean::SceneDescription::SDX::X3D::PointLight, Ocean::SceneDescription::SDX::X3D::PhantomTextureCoordinate, Ocean::SceneDescription::SDX::X3D::PackagedShader, Ocean::SceneDescription::SDX::X3D::OrientationInterpolator, Ocean::SceneDescription::SDX::X3D::NormalInterpolator, Ocean::SceneDescription::SDX::X3D::Normal, Ocean::SceneDescription::SDX::X3D::NavigationInfo, Ocean::SceneDescription::SDX::X3D::MultiTextureTransform, Ocean::SceneDescription::SDX::X3D::MultiTexture, Ocean::SceneDescription::SDX::X3D::MovieTexture, Ocean::SceneDescription::SDX::X3D::Material, Ocean::SceneDescription::SDX::X3D::LOD, Ocean::SceneDescription::SDX::X3D::LiveVideoTexture, Ocean::SceneDescription::SDX::X3D::Inline, Ocean::SceneDescription::SDX::X3D::IndexedLineSet, Ocean::SceneDescription::SDX::X3D::IndexedFaceSet, Ocean::SceneDescription::SDX::X3D::ImageTexture, Ocean::SceneDescription::SDX::X3D::HeadUpTransform, Ocean::SceneDescription::SDX::X3D::Group, Ocean::SceneDescription::SDX::X3D::FontStyle, Ocean::SceneDescription::SDX::X3D::DirectionalLight, Ocean::SceneDescription::SDX::X3D::Cylinder, Ocean::SceneDescription::SDX::X3D::CoordinateInterpolator, Ocean::SceneDescription::SDX::X3D::Coordinate, Ocean::SceneDescription::SDX::X3D::Cone, Ocean::SceneDescription::SDX::X3D::ComposedShader, Ocean::SceneDescription::SDX::X3D::ColorInterpolator, Ocean::SceneDescription::SDX::X3D::Color, Ocean::SceneDescription::SDX::X3D::Box, Ocean::SceneDescription::SDX::X3D::BooleanTrigger, Ocean::SceneDescription::SDX::X3D::BooleanToggle, Ocean::SceneDescription::SDX::X3D::BooleanFilter, Ocean::SceneDescription::SDX::X3D::Billboard, Ocean::SceneDescription::SDX::X3D::Background, Ocean::SceneDescription::SDX::X3D::AudioClip, and Ocean::SceneDescription::SDX::X3D::Appearance.

◆ operator=()

Node& Ocean::SceneDescription::Node::operator= ( const Node node)
protecteddelete

Disabled copy operator.

Parameters
nodeObject which would be copied
Returns
Reference to this object

◆ originalFieldName()

virtual std::string Ocean::SceneDescription::Node::originalFieldName ( const std::string &  fieldName) const
virtual

Tries to translate an alias field name to the original field name.

Parameters
fieldNameName of the alias field to return the original field name for
Returns
Original field name if existent, otherwise the given aliasFieldName again

Reimplemented in Ocean::SceneDescription::SDX::X3D::X3DNode.

◆ registerField()

void Ocean::SceneDescription::Node::registerField ( NodeSpecification specification,
const std::string &  fieldName,
const Field field,
const FieldAccessType  accessType = ACCESS_GET_SET 
)
protected

Registers a new field to a specified node type.

Parameters
specificationNode specification receiving the new field type
fieldNameName of the field to register
fieldField pattern to register
accessTypeField access type of the field to register

◆ setName()

virtual void Ocean::SceneDescription::Node::setName ( const std::string &  name)
virtual

Sets the name of this node.

Parameters
nameThe name of this node to set

Reimplemented in Ocean::SceneDescription::SDXNode.

◆ type()

const std::string & Ocean::SceneDescription::Node::type ( ) const
inline

Returns the type of this node.

Returns
Node type

Friends And Related Function Documentation

◆ Ocean::ObjectRef< Node >

friend class Ocean::ObjectRef< Node >
friend

Field Documentation

◆ name_

std::string Ocean::SceneDescription::Node::name_
protected

Node name.

◆ nodeId_

NodeId Ocean::SceneDescription::Node::nodeId_
protected

Unique node id.

◆ nodeIdCounter_

NodeId Ocean::SceneDescription::Node::nodeIdCounter_
staticprotected

Unique node id counter.

◆ specification_

NodeSpecification* Ocean::SceneDescription::Node::specification_ = nullptr
protected

Pointer to the node specification, guaranteed to exist as long as the node exist.

This pointer has to be set in derivated classes. Because it's not a pointer only the object is not disposed.


The documentation for this class was generated from the following file: