Ocean
|
This class is the manager for all media objects. More...
Public Types | |
typedef std::vector< std::string > | Names |
Definition of a vector holding library names. More... | |
Public Member Functions | |
MediumRef | newMedium (const std::string &url, bool useExclusive=false) |
Creates a new medium by a given url. More... | |
MediumRef | newMedium (const std::string &url, const Medium::Type type, bool useExclusive=false) |
Creates a new medium by a given url and an expected type. More... | |
MediumRef | newMedium (const std::string &url, const std::string &library, const Medium::Type type, bool useExclusive=false) |
Creates a new medium by a given url, a library name and an expected type. More... | |
RecorderRef | newRecorder (const Recorder::Type type, const std::string &library=std::string()) |
Creates a new recorder specified by the recorder type. More... | |
Library::Definitions | selectableMedia () const |
Returns a list of selectable mediums. More... | |
Library::Definitions | selectableMedia (const Medium::Type type) const |
Returns a list of specific selectable mediums. More... | |
Names | libraries () const |
Returns the names currently registered media libraries. More... | |
void | release () |
Releases all registered libraries. More... | |
Manager () | |
Creates a new manager object. More... | |
virtual | ~Manager () |
Destructs the manager, called by the singleton object. More... | |
template<typename T > | |
bool | registerLibrary (const std::string &name) |
Registers a new library. More... | |
bool | unregisterLibrary (const std::string &name) |
Unregisters a library. More... | |
Protected Attributes | |
Libraries | libraries_ |
Registered libraries. More... | |
Lock | lock_ |
Lock for the libraries. More... | |
Private Types | |
typedef std::pair< LibraryRef, unsigned int > | LibraryCounterPair |
Definition of a pair combining a library with a reference counter. More... | |
typedef std::vector< LibraryCounterPair > | Libraries |
Definition of a vector holding library pairs. More... | |
Friends | |
class | Singleton< Manager > |
class | Library |
Additional Inherited Members | |
Static Public Member Functions inherited from Ocean::Singleton< Manager > | |
static Manager & | get () |
Returns a reference to the unique object. More... | |
Protected Member Functions inherited from Ocean::Singleton< Manager > | |
Singleton ()=default | |
Default constructor. More... | |
This class is the manager for all media objects.
As media objects cannot be created directly this manager is necessary to create individual media object.
Further, this manager encapsulates individual media libraries and allows to create media objects from specific or random libraries during one unique interface.
|
private |
Definition of a vector holding library pairs.
|
private |
Definition of a pair combining a library with a reference counter.
typedef std::vector<std::string> Ocean::Media::Manager::Names |
Definition of a vector holding library names.
Ocean::Media::Manager::Manager | ( | ) |
Creates a new manager object.
|
virtual |
Destructs the manager, called by the singleton object.
Beware: The release function should be called before the singleton invokes the destructor. In common cases the singleton is released to late for internal library objects.
Names Ocean::Media::Manager::libraries | ( | ) | const |
Returns the names currently registered media libraries.
MediumRef Ocean::Media::Manager::newMedium | ( | const std::string & | url, |
bool | useExclusive = false |
||
) |
Creates a new medium by a given url.
If no medium can be created an empty reference is returned.
url | Url of the medium |
useExclusive | Determines whether the caller would like to use this medium exclusively |
MediumRef Ocean::Media::Manager::newMedium | ( | const std::string & | url, |
const Medium::Type | type, | ||
bool | useExclusive = false |
||
) |
Creates a new medium by a given url and an expected type.
If no medium can be created an empty reference is returned.
url | Url of the medium |
type | Type of the expected medium |
useExclusive | Determines whether the caller would like to use this medium exclusively |
MediumRef Ocean::Media::Manager::newMedium | ( | const std::string & | url, |
const std::string & | library, | ||
const Medium::Type | type, | ||
bool | useExclusive = false |
||
) |
Creates a new medium by a given url, a library name and an expected type.
If no medium can be created an empty reference is returned.
url | Url of the medium |
library | Name of the library to use for this medium |
type | Type of the expected medium |
useExclusive | Determines whether the caller would like to use this medium exclusively |
RecorderRef Ocean::Media::Manager::newRecorder | ( | const Recorder::Type | type, |
const std::string & | library = std::string() |
||
) |
Creates a new recorder specified by the recorder type.
type | Type of the recorder to return |
library | The optional name of the library to be used, empty to use any library |
bool Ocean::Media::Manager::registerLibrary | ( | const std::string & | name | ) |
Registers a new library.
With each register call, the reference counter for a specific library will be incremented. Each call to registerLibrary() needs to be balanced with a corresponding call of unregisterLibrary() before shutting down.
name | The name of the library to register, must be valid |
T | The data type of the library to register |
void Ocean::Media::Manager::release | ( | ) |
Releases all registered libraries.
This function should be called once before the application is shutting down. However this function should be called after all medium reference have been released.
Library::Definitions Ocean::Media::Manager::selectableMedia | ( | ) | const |
Returns a list of selectable mediums.
Library::Definitions Ocean::Media::Manager::selectableMedia | ( | const Medium::Type | type | ) | const |
Returns a list of specific selectable mediums.
type | Type of the selectable mediums |
bool Ocean::Media::Manager::unregisterLibrary | ( | const std::string & | name | ) |
Unregisters a library.
With each unregister call, the reference counter for a specific library will be decremented and removed from the system if the counter reaches zero. Each call to registerLibrary() needs to be balanced with a corresponding call of unregisterLibrary() before shutting down.
name | The name of the library to unregister, must be valid |
|
friend |
|
protected |
Registered libraries.