Ocean
Ocean::SceneDescription::Library Class Reference

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

Inheritance diagram for Ocean::SceneDescription::Library:

Public Types

typedef std::map< std::string, std::string > FileExtensions
 Definition of a map mapping file extensions to file type descriptions. More...
 

Public Member Functions

SceneRef load (const std::string &filename, const std::string &fileExtension, const Rendering::EngineRef &engine, const Timestamp &timestamp, const DescriptionType descriptionType, float *progress=nullptr, bool *cancel=nullptr)
 Loads a new scene by a given filename. More...
 
const std::string & name () const
 Returns the name of the library. More...
 
DescriptionType descriptionType () const
 Returns the description type supported by the library. More...
 
virtual NodeRef node (const std::string &name) const
 Returns the node reference of the first available scene description node with a specified name. More...
 
virtual NodeRefs nodes (const std::string &name) const
 Returns all node references of all available scene description nodes with a specified name. More...
 
NodeRefManagernodeManager () const
 Returns the node reference manager of this library. More...
 
virtual void release ()
 Releases the library. More...
 

Protected Member Functions

 Library (const Library &library)=delete
 Disabled copy constructor. More...
 
 Library (const std::string &name, const DescriptionType descriptionType, const unsigned int priority)
 Creates a new library object. More...
 
virtual ~Library ()
 Destructs a library object. More...
 
unsigned int priority () const
 Returns the priority of this library. More...
 
FileExtensions registeredFileExtensions () const
 Returns all registered file extensions. More...
 
void registerFileExtension (const std::string &extension, const std::string &description)
 Registers an additional file extension. More...
 
virtual SceneRef loadPermanent (const std::string &filename, const std::string &fileExtension, const Rendering::EngineRef &engine, const Timestamp &timestamp, float *progress, bool *cancel)
 Loads a new scene by a given filename and returns a scene hierarchy which can be used permanently. More...
 
virtual SceneRef loadTransient (const std::string &filename, const std::string &fileExtension, float *progress, bool *cancel)
 Loads a new scene by a given filename and returns a transient scene hierarchy which can be converted to a rendering scene graph afterwards. More...
 
Libraryoperator= (const Library &library)=delete
 Disabled copy operator. More...
 

Static Protected Member Functions

static bool unregisterLibrary (const std::string &library)
 Unregisters a library at the manager. More...
 

Private Attributes

std::string name_
 The name of the library. More...
 
unsigned int priority_ = 0u
 The priority of this library, the higher the value, the higher the priority. More...
 
FileExtensions fileExtensions_
 Map holding accepted file extensions supported by this library. More...
 
DescriptionType descriptionType_
 Supported scene description type. More...
 
NodeRefManager nodeRefManager_
 Node reference manager for this library only. More...
 

Friends

class Manager
 
class ObjectRef< Library >
 

Detailed Description

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

Member Typedef Documentation

◆ FileExtensions

typedef std::map<std::string, std::string> Ocean::SceneDescription::Library::FileExtensions

Definition of a map mapping file extensions to file type descriptions.

Constructor & Destructor Documentation

◆ Library() [1/2]

Ocean::SceneDescription::Library::Library ( const Library library)
protecteddelete

Disabled copy constructor.

Parameters
libraryObject which would be copied

◆ Library() [2/2]

Ocean::SceneDescription::Library::Library ( const std::string &  name,
const DescriptionType  descriptionType,
const unsigned int  priority 
)
protected

Creates a new library object.

Parameters
nameThe name of the library
descriptionTypeSupported scene description type
priorityThe priority of this library, the higher the value, the higher the priority, with range [0, infinity)

◆ ~Library()

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

Destructs a library object.

Member Function Documentation

◆ descriptionType()

DescriptionType Ocean::SceneDescription::Library::descriptionType ( ) const
inline

Returns the description type supported by the library.

Returns
Scene description type

◆ load()

SceneRef Ocean::SceneDescription::Library::load ( const std::string &  filename,
const std::string &  fileExtension,
const Rendering::EngineRef engine,
const Timestamp timestamp,
const DescriptionType  descriptionType,
float *  progress = nullptr,
bool *  cancel = nullptr 
)

Loads a new scene by a given filename.

Parameters
filenameEntire filename of the scene to load
fileExtensionFile extention of the scene to load
engineRendering engine to be connected with the scene description, must be defined for permanent scene description objects only
timestampThe current timestamp, must be valid
descriptionTypeScene description type
progressProgress state receiving recurrently information about the load state with range [0, 1]
cancelCancel state allows the cancelation of a load process while loading process hasn't finished, if the cancel state is used the load process stops if the value is set to True
Returns
Resulting scene
See also
Manager::load().

◆ loadPermanent()

virtual SceneRef Ocean::SceneDescription::Library::loadPermanent ( const std::string &  filename,
const std::string &  fileExtension,
const Rendering::EngineRef engine,
const Timestamp timestamp,
float *  progress,
bool *  cancel 
)
protectedvirtual

Loads a new scene by a given filename and returns a scene hierarchy which can be used permanently.

Parameters
filenameEntire filename of the scene to load
fileExtensionFile extention of the scene to load
engineRendering engine to be connected with the scene description
timestampThe current timestamp, must be valid
progressProgress state receiving recurrently information about the load state with range [0, 1]
cancelCancel state allows the cancelation of a load process while loading process hasn't finished, if the cancel state is used the load process stops if the value is set to True
Returns
Resulting scene

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

◆ loadTransient()

virtual SceneRef Ocean::SceneDescription::Library::loadTransient ( const std::string &  filename,
const std::string &  fileExtension,
float *  progress,
bool *  cancel 
)
protectedvirtual

Loads a new scene by a given filename and returns a transient scene hierarchy which can be converted to a rendering scene graph afterwards.

Parameters
filenameEntire filename of the scene to load
fileExtensionFile extention of the scene to load
progressProgress state receiving recurrently information about the load state with range [0, 1]
cancelCancel state allows the cancelation of a load process while loading process hasn't finished, if the cancel state is used the load process stops if the value is set to True
Returns
Resulting scene

Reimplemented in Ocean::SceneDescription::SDL::OBJ::OBJLibrary, and Ocean::SceneDescription::SDL::Assimp::AssimpLibrary.

◆ name()

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

Returns the name of the library.

Returns
Library name

◆ node()

virtual NodeRef Ocean::SceneDescription::Library::node ( const std::string &  name) const
virtual

Returns the node reference of the first available scene description node with a specified name.

Parameters
nameThe name of the node to return
Returns
Node reference of the node, the reference will be empty if the node does not exist

◆ nodeManager()

NodeRefManager & Ocean::SceneDescription::Library::nodeManager ( ) const
inline

Returns the node reference manager of this library.

Returns
Node reference manager

◆ nodes()

virtual NodeRefs Ocean::SceneDescription::Library::nodes ( const std::string &  name) const
virtual

Returns all node references of all available scene description nodes with a specified name.

Parameters
nameThe name of the nodes to return
Returns
All node references found

◆ operator=()

Library& Ocean::SceneDescription::Library::operator= ( const Library library)
protecteddelete

Disabled copy operator.

Parameters
libraryObject which would be copied
Returns
Reference to this object

◆ priority()

unsigned int Ocean::SceneDescription::Library::priority ( ) const
inlineprotected

Returns the priority of this library.

In case two libraries support the same scene description format, the library with higher priority will be used first to load the scene.

Returns
The library's priority, with range [0, infinity)

◆ registeredFileExtensions()

Library::FileExtensions Ocean::SceneDescription::Library::registeredFileExtensions ( ) const
inlineprotected

Returns all registered file extensions.

Returns
Registered file extensions

◆ registerFileExtension()

void Ocean::SceneDescription::Library::registerFileExtension ( const std::string &  extension,
const std::string &  description 
)
protected

Registers an additional file extension.

Parameters
extensionNew file extension to register
descriptionDescription of the file type

◆ release()

virtual void Ocean::SceneDescription::Library::release ( )
virtual

Releases the library.

◆ unregisterLibrary()

static bool Ocean::SceneDescription::Library::unregisterLibrary ( const std::string &  library)
staticprotected

Unregisters a library at the manager.

Parameters
libraryName of the library to unregister
Returns
True, if succeeded

Friends And Related Function Documentation

◆ Manager

friend class Manager
friend

◆ ObjectRef< Library >

friend class ObjectRef< Library >
friend

Field Documentation

◆ descriptionType_

DescriptionType Ocean::SceneDescription::Library::descriptionType_
private

Supported scene description type.

◆ fileExtensions_

FileExtensions Ocean::SceneDescription::Library::fileExtensions_
private

Map holding accepted file extensions supported by this library.

◆ name_

std::string Ocean::SceneDescription::Library::name_
private

The name of the library.

◆ nodeRefManager_

NodeRefManager Ocean::SceneDescription::Library::nodeRefManager_
mutableprivate

Node reference manager for this library only.

◆ priority_

unsigned int Ocean::SceneDescription::Library::priority_ = 0u
private

The priority of this library, the higher the value, the higher the priority.


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