Ocean
Ocean::Interaction::Manager Class Reference

This class implements the manager for all interaction libraries / plugins. More...

Inheritance diagram for Ocean::Interaction::Manager:

Public Member Functions

bool load (const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp, const std::string &filename)
 Loads a new interaction file. More...
 
bool unload (const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp, const std::string &filename)
 Unloads one specific loaded interaction files. More...
 
void unload (const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp)
 Unloads all loaded interaction files. More...
 
bool handlesMouseEvents () const
 Returns whether currently at least one interaction library handles mouse events. More...
 
void preFileLoad (const UserInterface &userInterface, const std::string &filename)
 Pre file load interaction function. More...
 
void postFileLoad (const UserInterface &userInterface, const std::string &filename, const bool succeeded)
 Post file load interaction function. More...
 
Timestamp preUpdate (const UserInterface &userInterface, const Rendering::EngineRef &engine, const Rendering::ViewRef &view, const Timestamp timestamp)
 Pre update interaction function. More...
 
void postUpdate (const UserInterface &userInterface, const Rendering::EngineRef &engine, const Rendering::ViewRef &view, const Timestamp timestamp)
 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)
 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)
 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)
 Mouse release event function. More...
 
void onKeyPress (const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &key, const Timestamp timestamp)
 Key press function. More...
 
void onKeyRelease (const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &key, const Timestamp timestamp)
 Key release function. More...
 
virtual FileExtensions supportedExtensions ()
 Returns all currently supported file extensions. More...
 
Names libraries () const
 Returns the names of all currently registered libraries. More...
 
void release ()
 Releases all interaction libraries. More...
 
void registerMouseEventLibrary (const std::string &name)
 Registers an interaction library handling mouse events. More...
 
bool unregisterMouseEventLibrary (const std::string &name)
 Unregisters an interaction library handling mouse events. More...
 
Locklock () const
 Retruns the lock object of this engine. More...
 
- Public Member Functions inherited from Ocean::IO::FileManager
virtual bool isSupported (const std::string &extension)
 Returns whether a specified file extension is supported. More...
 

Protected Types

typedef std::unordered_set< Library * > LibrarySet
 Definition of a set holding registered interaction libraries. More...
 
typedef std::unordered_set< std::string > NameSet
 Definition of a set holding names of interaction libraries. More...
 
typedef std::vector< std::string > Names
 Definition of a vector holding names. More...
 

Protected Member Functions

 Manager ()
 Creates a new manager. More...
 
virtual ~Manager ()
 Destructs a manager. More...
 
void registerLibrary (Library &library)
 Registers a new interaction library able to read a specific interaction format. More...
 
bool unregisterLibrary (const std::string &name)
 Unregisters a library. More...
 
- Protected Member Functions inherited from Ocean::IO::FileManager
 FileManager ()
 Creates a new file manager object. More...
 
virtual ~FileManager ()
 Destructs a file manager object. More...
 
- Protected Member Functions inherited from Ocean::Singleton< Manager >
 Singleton ()=default
 Default constructor. More...
 

Protected Attributes

LibrarySet librarySet_
 Set holding all registered interaction libraries. More...
 
NameSet mouseEventLibraries_
 Set holding all names of libraries interested in mouse events. More...
 
Lock lock_
 Manager lock. More...
 

Friends

class Singleton< Manager >
 
class Library
 

Additional Inherited Members

- Public Types inherited from Ocean::IO::FileManager
typedef std::map< std::string, std::string > FileExtensions
 Definition of a map mapping supported file extensions to file type descriptions. More...
 
- Static Public Member Functions inherited from Ocean::Singleton< Manager >
static Manager & get ()
 Returns a reference to the unique object. More...
 

Detailed Description

This class implements the manager for all interaction libraries / plugins.

Member Typedef Documentation

◆ LibrarySet

typedef std::unordered_set<Library*> Ocean::Interaction::Manager::LibrarySet
protected

Definition of a set holding registered interaction libraries.

◆ Names

typedef std::vector<std::string> Ocean::Interaction::Manager::Names
protected

Definition of a vector holding names.

◆ NameSet

typedef std::unordered_set<std::string> Ocean::Interaction::Manager::NameSet
protected

Definition of a set holding names of interaction libraries.

Constructor & Destructor Documentation

◆ Manager()

Ocean::Interaction::Manager::Manager ( )
protected

Creates a new manager.

◆ ~Manager()

virtual Ocean::Interaction::Manager::~Manager ( )
protectedvirtual

Destructs a manager.

Member Function Documentation

◆ handlesMouseEvents()

bool Ocean::Interaction::Manager::handlesMouseEvents ( ) const
inline

Returns whether currently at least one interaction library handles mouse events.

Because mouse events can produce high computational overhead this test can safe computational time.

Returns
True, if so

◆ libraries()

Names Ocean::Interaction::Manager::libraries ( ) const

Returns the names of all currently registered libraries.

Returns
Library names

◆ load()

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

Loads a new interaction file.

Parameters
userInterfaceThe application's UI elements
engineCurrent engine
timestampRecent timestmap
filenameFilename of the interaction to load
Returns
True, if succeeded

◆ lock()

Lock & Ocean::Interaction::Manager::lock ( ) const
inline

Retruns the lock object of this engine.

Beware: Use this lock with caution.

Returns
Engine lock object

◆ onKeyPress()

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

Key press function.

Parameters
userInterfaceThe application's UI elements
engineRendering engine currently used
keyKey which has been pressed
timestampEvent timestamp

◆ onKeyRelease()

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

Key release function.

Parameters
userInterfaceThe application's UI elements
engineRendering engine currently used
keyKey which has been pressed
timestampEvent timestamp

◆ onMouseMove()

void Ocean::Interaction::Manager::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 
)

Mouse move event function.

Parameters
userInterfaceThe application's UI elements
engineRendering engine currently used
buttonPressed mouse button
screenPosition2D screen position of the mouse cursor
ray3D picking ray
pickedObjectName of the possible picked object
pickedPositionPossible intersection point between mouse-pick-ray and 3D object
timestampEvent timestamp

◆ onMousePress()

void Ocean::Interaction::Manager::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 
)

Mouse press event function.

Parameters
userInterfaceThe application's UI elements
engineRendering engine currently used
buttonPressed mouse button
screenPosition2D screen position of the mouse cursor
ray3D picking ray
pickedObjectName of the possible picked object
pickedPositionPossible intersection point between mouse-pick-ray and 3D object
timestampEvent timestamp

◆ onMouseRelease()

void Ocean::Interaction::Manager::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 
)

Mouse release event function.

Parameters
userInterfaceThe application's UI elements
engineRendering engine currently used
buttonReleased mouse button
screenPosition2D screen position of the mouse cursor
ray3D picking ray
pickedObjectName of the possible picked object
pickedPositionPossible intersection point between mouse-pick-ray and 3D object
timestampEvent timestamp

◆ postFileLoad()

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

Post file load interaction function.

Parameters
userInterfaceThe application's UI elements
filenameFilename of the loaded filename
succeededState determining whether the file has been loaded successfully

◆ postUpdate()

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

Post update interaction function.

Parameters
userInterfaceThe application's UI elements
engineEngine which has been updated, must be valid
viewThe view which will be used to render, must be valid
timestampRecent update timestamp

◆ preFileLoad()

void Ocean::Interaction::Manager::preFileLoad ( const UserInterface userInterface,
const std::string &  filename 
)

Pre file load interaction function.

Parameters
userInterfaceThe application's UI elements
filenameFilename of the file to be loaded

◆ preUpdate()

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

Pre update interaction function.

This function is invoked before each update process, the application interaction module has the possibility to return a different preferred update timestamp.
If several interaction modules are used and each is changing the timestamp each changed timestamp is given to the next module as preferred timestamp.
Therefore the last registered interaction module has the possiblity to define the used timestamp.

Parameters
userInterfaceThe application's UI elements
engineEngine to be updated, must be valid
viewThe view which will be used to render, must be valid
timestampRecent update timestmap
Returns
Timestamp which should be used for the update process, if the timestamp is null any timestamp can be used

◆ registerLibrary()

void Ocean::Interaction::Manager::registerLibrary ( Library library)
protected

Registers a new interaction library able to read a specific interaction format.

Parameters
libraryLibrary to register

◆ registerMouseEventLibrary()

void Ocean::Interaction::Manager::registerMouseEventLibrary ( const std::string &  name)

Registers an interaction library handling mouse events.

Parameters
nameThe name of the library interested in mouse events

◆ release()

void Ocean::Interaction::Manager::release ( )

Releases all interaction libraries.

◆ supportedExtensions()

virtual FileExtensions Ocean::Interaction::Manager::supportedExtensions ( )
virtual

Returns all currently supported file extensions.

See also
FileManager::supportedExtensions().

Implements Ocean::IO::FileManager.

◆ unload() [1/2]

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

Unloads all loaded interaction files.

Parameters
userInterfaceThe application's UI elements
engineCurrent engine
timestampRecent timestmap

◆ unload() [2/2]

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

Unloads one specific loaded interaction files.

Parameters
userInterfaceThe application's UI elements
engineCurrent engine
timestampRecent timestmap
filenameFilename of the interaction to be unloaded
Returns
True, if succeeded

◆ unregisterLibrary()

bool Ocean::Interaction::Manager::unregisterLibrary ( const std::string &  name)
protected

Unregisters a library.

Parameters
nameThe name of the library to unregister
Returns
True, if succeeded

◆ unregisterMouseEventLibrary()

bool Ocean::Interaction::Manager::unregisterMouseEventLibrary ( const std::string &  name)

Unregisters an interaction library handling mouse events.

Parameters
nameThe name of the library not interested in mouse events anymore
Returns
True, if succeeded

Friends And Related Function Documentation

◆ Library

friend class Library
friend

◆ Singleton< Manager >

friend class Singleton< Manager >
friend

Field Documentation

◆ librarySet_

LibrarySet Ocean::Interaction::Manager::librarySet_
protected

Set holding all registered interaction libraries.

◆ lock_

Lock Ocean::Interaction::Manager::lock_
mutableprotected

Manager lock.

◆ mouseEventLibraries_

NameSet Ocean::Interaction::Manager::mouseEventLibraries_
protected

Set holding all names of libraries interested in mouse events.

This set is used to decided whether mouse events should be processed for this interaction libraries.


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