LibreOffice Module salhelper (master) 1
Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
salhelper::ODynamicLoader< API > Class Template Reference

The ODynamicLoader provides a special load on call mechanism for dynamic libraries which support a C-API. More...

#include <dynload.hxx>

Collaboration diagram for salhelper::ODynamicLoader< API >:
[legend]

Public Member Functions

 ODynamicLoader ()
 Default constructor. More...
 
 ODynamicLoader (const ::rtl::OUString &strModuleName, const ::rtl::OUString &strInitFunction)
 Constructor, loads the library if necessary otherwise the reference count will be increased. More...
 
 ODynamicLoader (const ODynamicLoader< API > &toCopy)
 Copy constructor. More...
 
 ~ODynamicLoader ()
 Destructor, decrease the reference count and unload the library if it is the last instance. More...
 
ODynamicLoader< API > &SAL_CALL operator= (const ODynamicLoader< API > &toAssign)
 Assign operator. More...
 
API *SAL_CALL getApi () const
 returns a pointer to the initialized API function structure. More...
 
API *SAL_CALL operator-> () const
 cast operator, which cast to a pointer with the initialized API function structure. More...
 
bool SAL_CALL isLoaded () const
 checks if the loader works on a loaded and initialized library. More...
 

Protected Attributes

ORealDynamicLoaderm_pLoader
 

Static Protected Attributes

static ORealDynamicLoaderm_pStaticLoader = NULL
 stores the real loader helper instance More...
 

Detailed Description

template<class API>
class salhelper::ODynamicLoader< API >

The ODynamicLoader provides a special load on call mechanism for dynamic libraries which support a C-API.

The libraries must provide a struct with function pointers for all supported C functions. The loader loads the specified library and call the specified initialization function to initialize the function pointers with the real functions. Furthermore provides the loader a reference counter for the library. When the last instance of the laoder will be destroyed the loader will unload the library.

Deprecated:
Do not use.

Definition at line 109 of file dynload.hxx.

Constructor & Destructor Documentation

◆ ODynamicLoader() [1/3]

template<class API >
salhelper::ODynamicLoader< API >::ODynamicLoader ( )
inline

Default constructor.

Definition at line 113 of file dynload.hxx.

References salhelper::ODynamicLoader< API >::m_pLoader, and NULL.

◆ ODynamicLoader() [2/3]

template<class API >
salhelper::ODynamicLoader< API >::ODynamicLoader ( const ::rtl::OUString &  strModuleName,
const ::rtl::OUString &  strInitFunction 
)
inline

Constructor, loads the library if necessary otherwise the reference count will be increased.

Parameters
strModuleNamespecifies the library name.
strInitFunctionspecifies the name of the initialization function.

Definition at line 124 of file dynload.hxx.

References salhelper::ORealDynamicLoader::acquire(), salhelper::ODynamicLoader< API >::m_pLoader, salhelper::ODynamicLoader< API >::m_pStaticLoader, and salhelper::ORealDynamicLoader::newInstance().

◆ ODynamicLoader() [3/3]

template<class API >
salhelper::ODynamicLoader< API >::ODynamicLoader ( const ODynamicLoader< API > &  toCopy)
inline

Copy constructor.

Definition at line 143 of file dynload.hxx.

References salhelper::ORealDynamicLoader::acquire(), and salhelper::ODynamicLoader< API >::m_pLoader.

◆ ~ODynamicLoader()

template<class API >
salhelper::ODynamicLoader< API >::~ODynamicLoader ( )
inline

Destructor, decrease the reference count and unload the library if it is the last instance.

Definition at line 151 of file dynload.hxx.

References salhelper::ODynamicLoader< API >::m_pLoader, salhelper::ODynamicLoader< API >::m_pStaticLoader, NULL, and salhelper::ORealDynamicLoader::release().

Member Function Documentation

◆ getApi()

template<class API >
API *SAL_CALL salhelper::ODynamicLoader< API >::getApi ( ) const
inline

returns a pointer to the initialized API function structure.

Definition at line 178 of file dynload.hxx.

References API, salhelper::ORealDynamicLoader::getApi(), and salhelper::ODynamicLoader< API >::m_pLoader.

◆ isLoaded()

template<class API >
bool SAL_CALL salhelper::ODynamicLoader< API >::isLoaded ( ) const
inline

checks if the loader works on a loaded and initialized library.

Definition at line 190 of file dynload.hxx.

References salhelper::ODynamicLoader< API >::m_pLoader, and NULL.

◆ operator->()

template<class API >
API *SAL_CALL salhelper::ODynamicLoader< API >::operator-> ( ) const
inline

cast operator, which cast to a pointer with the initialized API function structure.

Definition at line 184 of file dynload.hxx.

References API, salhelper::ORealDynamicLoader::getApi(), and salhelper::ODynamicLoader< API >::m_pLoader.

◆ operator=()

template<class API >
ODynamicLoader< API > &SAL_CALL salhelper::ODynamicLoader< API >::operator= ( const ODynamicLoader< API > &  toAssign)
inline

Member Data Documentation

◆ m_pLoader

template<class API >
ORealDynamicLoader* salhelper::ODynamicLoader< API >::m_pLoader
protected

◆ m_pStaticLoader

template<class API >
ORealDynamicLoader * salhelper::ODynamicLoader< API >::m_pStaticLoader = NULL
staticprotected

stores the real loader helper instance

Definition at line 197 of file dynload.hxx.

Referenced by salhelper::ODynamicLoader< API >::ODynamicLoader(), and salhelper::ODynamicLoader< API >::~ODynamicLoader().


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