Ocean
Ocean::Interaction::Experiences::ExperiencesLibrary Class Reference

This class implements the experiences interaction library object. More...

Inheritance diagram for Ocean::Interaction::Experiences::ExperiencesLibrary:

Data Structures

class  Instance
 Internal helper class holding the instance of this library. More...
 

Public Types

typedef std::unique_ptr< ExperienceUniqueExperience
 Definition of a unique pointer to an Experience object. More...
 
typedef std::function< UniqueExperience()> CreateExperienceFunction
 Definition of a callback function allowing to create a new experience. More...
 
- Public Types inherited from Ocean::Interaction::Library
typedef std::map< std::string, std::string > FileExtensions
 Definition of a map mapping file extensions to file type descriptions. More...
 

Static Public Member Functions

static void registerLibrary ()
 Creates this library and registers it at the global interaction manager. More...
 
static bool unregisterLibrary ()
 Unregisters this library at the global interaction manager. More...
 
static bool registerNewExperience (std::string experienceName, CreateExperienceFunction createExperienceFunction)
 Registers a new experience without actually creating the experience. More...
 

Protected Types

typedef std::unordered_map< std::string, UniqueExperienceNameToExperienceMap
 Definition of a vector holding experiences. More...
 
typedef std::unordered_map< std::string, CreateExperienceFunctionNameToFunctionMap
 Definition of an unordered map mapping experience names to experience create functions. More...
 

Protected Member Functions

 ExperiencesLibrary ()
 Creates a new experiences library object. More...
 
 ~ExperiencesLibrary () override
 Destructs a experiences library object. More...
 
bool load (const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp, const std::string &filename) override
 Loads a new interaction file. More...
 
bool unload (const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp, const std::string &filename) override
 Unloads one specific loaded interaction files. More...
 
void unload (const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp) override
 Unloads all loaded scripts. More...
 
void preFileLoad (const UserInterface &userInterface, const std::string &filename) override
 Pre file load interaction function. More...
 
void postFileLoad (const UserInterface &userInterface, const std::string &filename, const bool succeeded) override
 Post file load interaction function. More...
 
Timestamp preUpdate (const UserInterface &userInterface, const Rendering::EngineRef &engine, const Rendering::ViewRef &view, const Timestamp timestamp) override
 Pre update interaction function. More...
 
void postUpdate (const UserInterface &userInterface, const Rendering::EngineRef &engine, const Rendering::ViewRef &view, const Timestamp timestamp) override
 Post update interaction function. More...
 
void onMousePress (const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &button, const Vector2 &screenPosition, const Line3 &ray, const Rendering::ObjectId pickedObject, const Vector3 &pickedPosition, const Timestamp timestamp) override
 Mouse press event function. More...
 
void onMouseMove (const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &button, const Vector2 &screenPosition, const Line3 &ray, const Rendering::ObjectId pickedObject, const Vector3 &pickedPosition, const Timestamp timestamp) override
 Mouse move event function. More...
 
void onMouseRelease (const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &button, const Vector2 &screenPosition, const Line3 &ray, const Rendering::ObjectId pickedObject, const Vector3 &pickedPosition, const Timestamp timestamp) override
 Mouse release event function. More...
 
void onKeyPress (const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &key, const Timestamp timestamp) override
 Key press function. More...
 
void onKeyRelease (const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &key, const Timestamp timestamp) override
 Key release function. More...
 
void release () override
 Releases this library. More...
 
- Protected Member Functions inherited from Ocean::Interaction::Library
 Library (const std::string &name)
 Creates a new library object. More...
 
virtual ~Library ()
 Destructs a library object. 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...
 
 Library (const Library &library)=delete
 Disabled copy constructor. More...
 
Libraryoperator= (const Library &library)=delete
 Disabled copy operator. More...
 

Protected Attributes

NameToFunctionMap nameToFunctionMap_
 The map mapping names of experiences to create functions. More...
 
NameToExperienceMap nameToExperienceMap_
 The map mapping names of experiences to actual instances of experiences. More...
 
Lock lock_
 The library's lock. More...
 
- Protected Attributes inherited from Ocean::Interaction::Library
std::string libraryName
 Library name. More...
 
FileExtensions libraryFileExtensions
 Map holding accepted file extensions supported by this library. More...
 

Additional Inherited Members

- Public Member Functions inherited from Ocean::Interaction::Library
const std::string & name () const
 Returns the name of this library. More...
 
virtual bool isFileExtensionSupported (const std::string &extension) const
 Returns whether a specified file extension is supported by this interaction plugin. More...
 
- Static Protected Member Functions inherited from Ocean::Interaction::Library
static bool registerFactory (Library &library)
 Registers a library at the manager. More...
 
static bool unregisterLibrary (const std::string &library)
 Unregisters a library at the manager. More...
 

Detailed Description

This class implements the experiences interaction library object.

Member Typedef Documentation

◆ CreateExperienceFunction

Definition of a callback function allowing to create a new experience.

◆ NameToExperienceMap

Definition of a vector holding experiences.

◆ NameToFunctionMap

Definition of an unordered map mapping experience names to experience create functions.

◆ UniqueExperience

Definition of a unique pointer to an Experience object.

Constructor & Destructor Documentation

◆ ExperiencesLibrary()

Ocean::Interaction::Experiences::ExperiencesLibrary::ExperiencesLibrary ( )
protected

Creates a new experiences library object.

◆ ~ExperiencesLibrary()

Ocean::Interaction::Experiences::ExperiencesLibrary::~ExperiencesLibrary ( )
overrideprotected

Destructs a experiences library object.

Member Function Documentation

◆ load()

bool Ocean::Interaction::Experiences::ExperiencesLibrary::load ( const UserInterface userInterface,
const Rendering::EngineRef engine,
const Timestamp  timestamp,
const std::string &  filename 
)
overrideprotectedvirtual

Loads a new interaction file.

See also
Library::load().

Implements Ocean::Interaction::Library.

◆ onKeyPress()

void Ocean::Interaction::Experiences::ExperiencesLibrary::onKeyPress ( const UserInterface userInterface,
const Rendering::EngineRef engine,
const std::string &  key,
const Timestamp  timestamp 
)
overrideprotectedvirtual

Key press function.

See also
Library::onKeyPress().

Reimplemented from Ocean::Interaction::Library.

◆ onKeyRelease()

void Ocean::Interaction::Experiences::ExperiencesLibrary::onKeyRelease ( const UserInterface userInterface,
const Rendering::EngineRef engine,
const std::string &  key,
const Timestamp  timestamp 
)
overrideprotectedvirtual

Key release function.

See also
Library::onKeyRelease().

Reimplemented from Ocean::Interaction::Library.

◆ onMouseMove()

void Ocean::Interaction::Experiences::ExperiencesLibrary::onMouseMove ( const UserInterface userInterface,
const Rendering::EngineRef engine,
const std::string &  button,
const Vector2 screenPosition,
const Line3 ray,
const Rendering::ObjectId  pickedObject,
const Vector3 pickedPosition,
const Timestamp  timestamp 
)
overrideprotectedvirtual

Mouse move event function.

See also
Library::onMouseMove().

Reimplemented from Ocean::Interaction::Library.

◆ onMousePress()

void Ocean::Interaction::Experiences::ExperiencesLibrary::onMousePress ( const UserInterface userInterface,
const Rendering::EngineRef engine,
const std::string &  button,
const Vector2 screenPosition,
const Line3 ray,
const Rendering::ObjectId  pickedObject,
const Vector3 pickedPosition,
const Timestamp  timestamp 
)
overrideprotectedvirtual

Mouse press event function.

See also
Library::onMousePress().

Reimplemented from Ocean::Interaction::Library.

◆ onMouseRelease()

void Ocean::Interaction::Experiences::ExperiencesLibrary::onMouseRelease ( const UserInterface userInterface,
const Rendering::EngineRef engine,
const std::string &  button,
const Vector2 screenPosition,
const Line3 ray,
const Rendering::ObjectId  pickedObject,
const Vector3 pickedPosition,
const Timestamp  timestamp 
)
overrideprotectedvirtual

Mouse release event function.

See also
Library::onMouseRelease().

Reimplemented from Ocean::Interaction::Library.

◆ postFileLoad()

void Ocean::Interaction::Experiences::ExperiencesLibrary::postFileLoad ( const UserInterface userInterface,
const std::string &  filename,
const bool  succeeded 
)
overrideprotectedvirtual

Post file load interaction function.

See also
Library::postFileLoad().

Reimplemented from Ocean::Interaction::Library.

◆ postUpdate()

void Ocean::Interaction::Experiences::ExperiencesLibrary::postUpdate ( const UserInterface userInterface,
const Rendering::EngineRef engine,
const Rendering::ViewRef view,
const Timestamp  timestamp 
)
overrideprotectedvirtual

Post update interaction function.

See also
Library::postUpdate().

Reimplemented from Ocean::Interaction::Library.

◆ preFileLoad()

void Ocean::Interaction::Experiences::ExperiencesLibrary::preFileLoad ( const UserInterface userInterface,
const std::string &  filename 
)
overrideprotectedvirtual

Pre file load interaction function.

See also
Library::preFileLoad().

Reimplemented from Ocean::Interaction::Library.

◆ preUpdate()

Timestamp Ocean::Interaction::Experiences::ExperiencesLibrary::preUpdate ( const UserInterface userInterface,
const Rendering::EngineRef engine,
const Rendering::ViewRef view,
const Timestamp  timestamp 
)
overrideprotectedvirtual

Pre update interaction function.

See also
Library::preUpdate().

Reimplemented from Ocean::Interaction::Library.

◆ registerLibrary()

static void Ocean::Interaction::Experiences::ExperiencesLibrary::registerLibrary ( )
static

Creates this library and registers it at the global interaction manager.

Do not register this library if using it as plugin, because it's done by the plugin itself.
However, if you are not using the plugin mechanism you have to initialize this library once at program initialization.
If the library is not used anymore unregister it using the unregister function.
Beware: This registration must not be done more than once!

See also
Manager, unregisterLibrary()

◆ registerNewExperience()

static bool Ocean::Interaction::Experiences::ExperiencesLibrary::registerNewExperience ( std::string  experienceName,
CreateExperienceFunction  createExperienceFunction 
)
static

Registers a new experience without actually creating the experience.

Parameters
experienceNameThe name of the experience to register, must be valid
createExperienceFunctionThe create function of the new experience, must be valid
Returns
True, if succeeded

◆ release()

void Ocean::Interaction::Experiences::ExperiencesLibrary::release ( )
overrideprotectedvirtual

Releases this library.

Reimplemented from Ocean::Interaction::Library.

◆ unload() [1/2]

void Ocean::Interaction::Experiences::ExperiencesLibrary::unload ( const UserInterface userInterface,
const Rendering::EngineRef engine,
const Timestamp  timestamp 
)
overrideprotectedvirtual

Unloads all loaded scripts.

See also
Library::unload

Implements Ocean::Interaction::Library.

◆ unload() [2/2]

bool Ocean::Interaction::Experiences::ExperiencesLibrary::unload ( const UserInterface userInterface,
const Rendering::EngineRef engine,
const Timestamp  timestamp,
const std::string &  filename 
)
overrideprotectedvirtual

Unloads one specific loaded interaction files.

See also
Library::unload().

Implements Ocean::Interaction::Library.

◆ unregisterLibrary()

static bool Ocean::Interaction::Experiences::ExperiencesLibrary::unregisterLibrary ( )
static

Unregisters this library at the global interaction manager.

Do not unregister this library if using it as plugin, because it's done by the plugin itself when the plugin is unloaded.
Beware: This registration must not be done more than once and must not be done without previous registration!

Returns
True, if succeeded
See also
Manager, registerLibrary()

Field Documentation

◆ lock_

Lock Ocean::Interaction::Experiences::ExperiencesLibrary::lock_
protected

The library's lock.

◆ nameToExperienceMap_

NameToExperienceMap Ocean::Interaction::Experiences::ExperiencesLibrary::nameToExperienceMap_
protected

The map mapping names of experiences to actual instances of experiences.

◆ nameToFunctionMap_

NameToFunctionMap Ocean::Interaction::Experiences::ExperiencesLibrary::nameToFunctionMap_
protected

The map mapping names of experiences to create functions.


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