8#ifndef META_OCEAN_SCENEDESCRIPTION_SDX_NODE_H
9#define META_OCEAN_SCENEDESCRIPTION_SDX_NODE_H
49class OCEAN_SCENEDESCRIPTION_EXPORT
SDXNode :
virtual public Node
56 using NodeIdMap = std::unordered_map<NodeId, unsigned int>;
95 inline const std::string&
filename()
const;
136 inline const std::string&
library()
const;
143 inline const std::string&
filename()
const;
326 ++
parents_.insert(std::make_pair(parentId, 0)).first->second;
333 NodeIdMap::iterator iNode =
parents_.find(parentId);
334 ocean_assert(iNode !=
parents_.end());
336 ocean_assert(iNode->second != 0u);
338 if (--iNode->second == 0u)
This class implements a recursive lock object.
Definition Lock.h:31
This class is the base class for all scene description fields.
Definition Field.h:36
This class is the base class for all scene description libraries.
Definition scenedescription/Library.h:37
const std::string & name() const
Returns the name of this node.
Definition scenedescription/Node.h:412
Node()
Creates a new node.
const Field & field(const std::string &fieldName) const
Returns the field base of a specified (standard) field.
This class implements a node environment container.
Definition SDXNode.h:62
SDXEnvironment()=default
Creates an empty environment object.
SceneId sceneId_
Unique environment scene id.
Definition SDXNode.h:115
const std::string & filename() const
Returns the name of the file defining the node.
Definition SDXNode.h:286
SceneId sceneId() const
Returns the unique id of the scene defining the node originally.
Definition SDXNode.h:291
const Library * library() const
Returns the name of the scene description library defining the node.
Definition SDXNode.h:281
const Rendering::EngineRef & engine() const
Returns the rendering engine used in the environment.
Definition SDXNode.h:276
const Library * library_
Owner library.
Definition SDXNode.h:109
std::string filename_
Name of the file defining the node.
Definition SDXNode.h:112
Rendering::EngineRef engine_
Rendering engine the node is connected with.
Definition SDXNode.h:106
This class implements the base class for all SDX scene description nodes.
Definition SDXNode.h:50
const Rendering::EngineRef & engine() const
Returns the rendering engine used by this node.
Definition SDXNode.h:296
virtual void initialize(const Rendering::SceneRef &scene, const Timestamp timestamp, const bool reinitialize=false)
Event function to inform the node that it has been initialized and can apply all internal values to c...
NodeIdMap parents_
Map holding all parent nodes.
Definition SDXNode.h:255
const std::string & library() const
Returns the name of the scene description library defining this node.
Definition SDXNode.h:302
std::unordered_map< NodeId, unsigned int > NodeIdMap
Definition of a map mapping node ids to reference counters.
Definition SDXNode.h:56
void setName(const std::string &name) override
Sets the name of this node.
void registerThisNodeAsParent(const SDXNodeRef &child)
Registers this node at a child as parent node.
NodeRefs parentNodes() const
Returns all parent nodes of this node.
void unregisterParentNode(const NodeId parentId)
Unregisters a parent node for this (child) node.
Definition SDXNode.h:329
SDXNode(const SDXEnvironment *environment)
Creates a new node object.
DescriptionType descriptionType() const override
Returns the scene description type of this node.
void unregisterThisNodeAsParent(const SDXNodeRef &child)
Unregisters this node from a child as parent.
bool initialized_
State determining whether the node has been initialized already.
Definition SDXNode.h:261
virtual const Rendering::ObjectRef & renderingObject() const
Returns the associated rendering object.
virtual void onInitialize(const Rendering::SceneRef &scene, const Timestamp timestamp)
Internal event function to inform the node that it has been initialized and can apply all internal va...
Rendering::ObjectRef renderingObject_
Corresponding rendering object.
Definition SDXNode.h:258
const std::string & filename() const
Returns the name of the file defining this node.
Definition SDXNode.h:310
virtual void onFieldChanged(const std::string &fieldName)
Event function to inform the node about a changed field.
SceneId sceneId() const
Returns the unique id of the scene defining this node originally.
Definition SDXNode.h:316
const SDXEnvironment * environment_
Object specifying the environment of this node.
Definition SDXNode.h:252
SDXNodeSet ancestorNodes() const
Returns all ancestor nodes of this node.
Lock lock_
Node lock.
Definition SDXNode.h:264
void registerParentNode(const NodeId parentId)
Registers a new parent node for this (child) node.
Definition SDXNode.h:322
virtual bool setField(const std::string &fieldName, const Field &field)
Sets or changes a specified (standard) field of this node.
virtual bool setAnyField(const std::string &fieldName, const Field &field)
Sets or changes a specified standard or dynamic field of this node.
~SDXNode() override
Destructs a node object.
This class implements the base class for all sdx scene object providing access to all elements of a s...
Definition SDXScene.h:39
This class implements a scoped lock object for recursive lock objects.
Definition Lock.h:147
This template class implements a smart object reference which is a specialization of an ObjectRef obj...
Definition SmartObjectRef.h:90
This class implements a timestamp.
Definition Timestamp.h:64
Ocean::ObjectRef< Engine > EngineRef
Definition of an engine reference object.
Definition Engine.h:30
SmartObjectRef< Scene > SceneRef
Definition of a smart object reference holding a scene node.
Definition rendering/Scene.h:29
Ocean::ObjectRef< Object > ObjectRef
Definition of a rendering object reference with an internal reference counter.
Definition Object.h:34
std::vector< NodeRef > NodeRefs
Definition of a vector holding scene description node references.
Definition scenedescription/Node.h:42
DescriptionType
Definition of different scene description types.
Definition SceneDescription.h:64
std::set< SDXNodeRef > SDXNodeSet
Definition of a set holding SDX node references.
Definition SDXNode.h:43
SmartObjectRef< SDXNode, Node > SDXNodeRef
Definition of a smart object reference for SDX scene description nodes.
Definition SDXNode.h:37
size_t NodeId
Definition of a object id.
Definition SceneDescription.h:41
Namespace of the SceneDescription library.
Definition DynamicNode.h:21
size_t SceneId
Definition of a unique scene id.
Definition SceneDescription.h:52
constexpr SceneId invalidSceneId
Definition of an invalid scene id.
Definition SceneDescription.h:57
The namespace covering the entire Ocean framework.
Definition Accessor.h:15