8 #ifndef META_OCEAN_SCENEDESCRIPTION_MANAGER_H
9 #define META_OCEAN_SCENEDESCRIPTION_MANAGER_H
29 namespace SceneDescription
98 class OCEAN_SCENEDESCRIPTION_EXPORT
Manager :
129 typedef std::unordered_set<std::string>
NameSet;
134 typedef std::unordered_map<NodeId, SDXEventNode*>
EventNodes;
206 inline bool handlesMouseEvents()
const;
274 NodeRef node(
const std::string& library,
const std::string& name)
const;
306 template <
typename T>
307 bool registerLibrary(
const std::string& name);
383 template <
typename T>
393 ocean_assert(i->first);
395 if (i->first->name() == name)
408 ocean_assert(i->first);
410 if (i->first->priority() < newLibrary->priority())
412 libraries_.insert(i, std::make_pair(std::move(newLibrary), 1u));
419 libraries_.emplace_back(std::make_pair(std::move(newLibrary), 1u));
This class is the base class for all plugin manager able to load and manager files.
Definition: FileManager.h:26
std::map< std::string, std::string > FileExtensions
Definition of a map mapping supported file extensions to file type descriptions.
Definition: FileManager.h:32
This class implements a recursive lock object.
Definition: Lock.h:31
This class is the base class for all scene description libraries.
Definition: scenedescription/Library.h:37
This class implements the manager for all scene descriptions.
Definition: scenedescription/Manager.h:101
Lock managerLock_
Manager lock.
Definition: scenedescription/Manager.h:370
Timestamp preUpdate(const std::string &library, const Rendering::ViewRef &view, const Timestamp timestamp)
Pre-updates all scene description objects of a specified library only.
Manager()
Creates a new manager.
UpdateNodes updateNodes_
Map holding all update nodes.
Definition: scenedescription/Manager.h:367
std::vector< std::string > LibraryNames
Definition of a vector holding library names.
Definition: scenedescription/Manager.h:112
bool unload(const SceneId sceneId)
Unloads a given permanent scene description objects.
std::unordered_map< NodeId, SDXUpdateNode * > UpdateNodes
Definition of a map mapping scene description node ids to update nodes.
Definition: scenedescription/Manager.h:139
std::unordered_set< std::string > NameSet
Definition of a set holding library names.
Definition: scenedescription/Manager.h:129
std::pair< LibraryRef, unsigned int > LibraryCounterPair
Definition of a pair combining a library with a reference counter.
Definition: scenedescription/Manager.h:119
bool unregisterLibrary(const std::string &name)
Unregisters a library.
void mouseEvent(const ButtonType button, const ButtonEvent buttonEvent, const Vector2 &screenPosition, const Vector3 &objectPosition, const Rendering::ObjectId objectId, const Timestamp timestamp)
Sends a mouse event to be handled by the scene description.
void registerEventNode(SDXEventNode &node)
Registers a new event node.
void unregisterUpdateNode(SDXUpdateNode &node)
Unregisters an update node.
void unregisterEventNode(SDXEventNode &node)
Unregisters an event node.
SceneRef load(const std::string &filename, const Rendering::EngineRef &engine, const Timestamp ×tamp, const DescriptionType preferredDescriptionType=TYPE_PERMANENT, float *progress=nullptr, bool *cancel=nullptr)
Loads a new scene and creates a scene description hierarchy.
PermanentSceneMap permanentSceneMap_
Map holding all permanent scene description objects.
Definition: scenedescription/Manager.h:361
std::vector< LibraryCounterPair > Libraries
Definition of a vector holding library pairs.
Definition: scenedescription/Manager.h:124
LibraryNames libraries()
Returns a list of all registered libraries.
NodeRef node(const std::string &library, const std::string &name) const
Returns the node reference of the first available scene description node with a specified name define...
void keyEvent(const int key, const ButtonEvent buttonEvent, const Rendering::ObjectId objectId, const Timestamp timestamp)
Sends a key event to be handled by the scene description.
std::unordered_map< NodeId, SDXEventNode * > EventNodes
Definition of a map mapping scene description node ids to event nodes.
Definition: scenedescription/Manager.h:134
bool handlesMouseEvents() const
Returns whether currently at least one scene description node handles mouse events.
Definition: scenedescription/Manager.h:376
NodeRefs nodes(const std::string &name) const
Returns all node references of all available scene description nodes with a specified name.
Libraries libraries_
The vector holding all registered scene description libraries.
Definition: scenedescription/Manager.h:358
void unloadScenes()
Unloads all permanent scene description objects.
Timestamp preUpdate(const Rendering::ViewRef &view, const Timestamp timestamp)
Pre-updates all scene description objects needing regularly pre updates.
NodeRefs nodes(const std::string &library, const std::string &name) const
Returns all node references of all available scene description nodes with a specified name defined in...
FileExtensions supportedExtensions()
Returns all currently supported file extensions.
void update(const Rendering::ViewRef &view, const Timestamp timestamp)
Updates all scene description objects needing regularly updates.
EventNodes eventNodes_
Map holding all event nodes.
Definition: scenedescription/Manager.h:364
Lock libraryLock_
Library lock.
Definition: scenedescription/Manager.h:373
bool registerLibrary(const std::string &name)
Registers a new library.
Definition: scenedescription/Manager.h:384
std::map< SceneId, SDXSceneRef > PermanentSceneMap
Definition of a set holding permanent scene description objects.
Definition: scenedescription/Manager.h:144
void update(const std::string &library, const Rendering::ViewRef &view, const Timestamp timestamp)
Updates all scene description objects of a specified library only.
NodeRef node(const std::string &name) const
Returns the node reference of the first available scene description node with a specified name.
void registerUpdateNode(SDXUpdateNode &node)
Registers a new update node.
virtual ~Manager()
Destructs a manager.
void release()
Releases all scene library.
This class implements the base class for all nodes receiving event calls regularly.
Definition: SDXEventNode.h:25
This class implements the base class for all nodes needing update calls regularly.
Definition: SDXUpdateNode.h:25
This class implements a scoped lock object for recursive lock objects.
Definition: Lock.h:135
This template class is the base class for all singleton objects.
Definition: Singleton.h:71
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
size_t ObjectId
Definition of a object id.
Definition: rendering/Rendering.h:59
ButtonEvent
Definition of different device events.
Definition: SceneDescription.h:92
DescriptionType
Definition of different scene description types.
Definition: SceneDescription.h:64
std::vector< NodeRef > NodeRefs
Definition of a vector holding scene description node references.
Definition: scenedescription/Node.h:42
ButtonType
Definition of different button types.
Definition: SceneDescription.h:76
@ TYPE_PERMANENT
A scene description holding a permanent scene hierarchy allowing permanent access.
Definition: SceneDescription.h:68
size_t SceneId
Definition of a unique scene id.
Definition: SceneDescription.h:52
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15