9 #ifndef YARP_OS_SHAREDLIBRARYCLASS_H
10 #define YARP_OS_SHAREDLIBRARYCLASS_H
58 content = factory.
create();
62 return content !=
nullptr;
72 if (content !=
nullptr) {
73 pfactory->destroy(content);
75 if (pfactory->removeRef() == 0) {
128 return content !=
nullptr;
static void unlock()
Call post() on a global mutual-exclusion semaphore allocated by YARP.
static void lock()
Call wait() on a global mutual-exclusion semaphore allocated by YARP.
A type-safe wrapper for SharedLibraryFactory, committing to creation/destruction of instances of a pa...
Container for an object created using a factory provided by a shared library.
bool open(SharedLibraryClassFactory< T > &factory)
Construct an instance using the specified factory.
virtual ~SharedLibraryClass()
Destructor.
const T & getContent() const
Gives access to the created instance (const version).
T & getContent()
Gives access to the created instance.
virtual bool close()
Destroy an instance if one has been created.
const T * operator->() const
A pointer version of SharedLibraryClass::getContent (const version)
bool isValid() const
Check whether a valid instance has been created.
const T & operator*() const
Shorthand for SharedLibraryClass::getContent (const version)
T & operator*()
Shorthand for SharedLibraryClass::getContent.
T * operator->()
A pointer version of SharedLibraryClass::getContent.
SharedLibraryClass(SharedLibraryClassFactory< T > &factory)
Constructor for valid instance of a class from a shared library.
SharedLibraryClass()=default
Constructor for empty instance.
int addRef()
Increment the reference count of this factory.
The main, catch-all namespace for YARP.