8 #ifndef META_OCEAN_SCENEDESCRIPTION_SDX_NODE_H
9 #define META_OCEAN_SCENEDESCRIPTION_SDX_NODE_H
24 namespace SceneDescription
49 class OCEAN_SCENEDESCRIPTION_EXPORT
SDXNode :
virtual public Node
56 typedef std::unordered_map<NodeId, unsigned int>
NodeIdMap;
89 inline const Library* library()
const;
95 inline const std::string& filename()
const;
101 inline SceneId sceneId()
const;
136 inline const std::string& library()
const;
143 inline const std::string& filename()
const;
149 inline SceneId sceneId()
const;
161 void setName(
const std::string& name)
override;
229 inline void registerParentNode(
const NodeId parentId);
235 inline void unregisterParentNode(
const NodeId parentId);
261 bool initialized_ =
false;
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 the library.
Definition: scenedescription/Library.h:196
This class is the base class for all scene description nodes.
Definition: scenedescription/Node.h:49
This class implements a node environment container.
Definition: SDXNode.h:62
SDXEnvironment()=default
Creates an empty environment object.
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
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
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.
std::unordered_map< NodeId, unsigned int > NodeIdMap
Definition of a map mapping node ids to reference counters.
Definition: SDXNode.h:56
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.
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.
virtual const Rendering::ObjectRef & renderingObject() const
Returns the associated rendering object.
~SDXNode() override
Destructs a node object.
This class implements a scoped lock object for recursive lock objects.
Definition: Lock.h:135
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:36
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:30
std::vector< NodeRef > NodeRefs
Definition of a vector holding scene description node references.
Definition: scenedescription/Node.h:42
size_t NodeId
Definition of a object id.
Definition: SceneDescription.h:41
constexpr SceneId invalidSceneId
Definition of an invalid scene id.
Definition: SceneDescription.h:57
size_t SceneId
Definition of a unique scene id.
Definition: SceneDescription.h:52
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15