Container for an object created using a factory provided by a shared library. More...
#include <yarp/os/SharedLibraryClass.h>
Public Member Functions | |
SharedLibraryClass ()=default | |
Constructor for empty instance. More... | |
SharedLibraryClass (SharedLibraryClassFactory< T > &factory) | |
Constructor for valid instance of a class from a shared library. More... | |
bool | open (SharedLibraryClassFactory< T > &factory) |
Construct an instance using the specified factory. More... | |
virtual bool | close () |
Destroy an instance if one has been created. More... | |
virtual | ~SharedLibraryClass () |
Destructor. More... | |
T & | getContent () |
Gives access to the created instance. More... | |
const T & | getContent () const |
Gives access to the created instance (const version). More... | |
bool | isValid () const |
Check whether a valid instance has been created. More... | |
T & | operator* () |
Shorthand for SharedLibraryClass::getContent. More... | |
const T & | operator* () const |
Shorthand for SharedLibraryClass::getContent (const version) More... | |
T * | operator-> () |
A pointer version of SharedLibraryClass::getContent. More... | |
const T * | operator-> () const |
A pointer version of SharedLibraryClass::getContent (const version) More... | |
Container for an object created using a factory provided by a shared library.
Used to ensure the object is destroyed by a method also provided by the shared library. Mixing creation and destruction methods could be very bad.
Definition at line 24 of file SharedLibraryClass.h.
|
default |
Constructor for empty instance.
|
inline |
Constructor for valid instance of a class from a shared library.
factory | the factory to use to construct (and eventually destroy) the instance. |
Definition at line 42 of file SharedLibraryClass.h.
|
inlinevirtual |
Destructor.
Definition at line 90 of file SharedLibraryClass.h.
|
inlinevirtual |
Destroy an instance if one has been created.
Definition at line 70 of file SharedLibraryClass.h.
|
inline |
Gives access to the created instance.
No check made to ensure an instance is in fact present. Call SharedLibraryClass::isValid first if unsure.
Definition at line 103 of file SharedLibraryClass.h.
|
inline |
Gives access to the created instance (const version).
No check made to ensure an instance is in fact present. Call SharedLibraryClass::isValid first if unsure.
Definition at line 116 of file SharedLibraryClass.h.
|
inline |
Check whether a valid instance has been created.
Definition at line 126 of file SharedLibraryClass.h.
|
inline |
Construct an instance using the specified factory.
If an instance has already been made, it is destroyed.
factory | the factory to use to construct (and eventually destroy) the instance. |
Definition at line 55 of file SharedLibraryClass.h.
|
inline |
Shorthand for SharedLibraryClass::getContent.
Definition at line 136 of file SharedLibraryClass.h.
|
inline |
Shorthand for SharedLibraryClass::getContent (const version)
Definition at line 146 of file SharedLibraryClass.h.
|
inline |
A pointer version of SharedLibraryClass::getContent.
Definition at line 157 of file SharedLibraryClass.h.
|
inline |
A pointer version of SharedLibraryClass::getContent (const version)
Definition at line 168 of file SharedLibraryClass.h.