Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes

maci::LibraryManager Class Reference

#include <maciLibraryManager.h>

Collaboration diagram for maci::LibraryManager:
Collaboration graph
[legend]

List of all members.

Classes

struct  LibraryInfo
 Structure to store data about loaded libraries. More...

Public Types

typedef bool(* DLLOpenFunc )(int argc, char *argv[])
typedef void(* DLLCloseFunc )(void)
typedef void(* DLLSetupCORBAFunc )(CORBA::ORB_ptr m_orb, PortableServer::POAManager_ptr m_poaManager, PortableServer::POA_ptr m_poaRoot, PortableServer::POA_ptr m_poaPersistent, PortableServer::POA_ptr m_poaTransient)
typedef void(* DLLInitThreadsFunc )(InitThreadFunc initFunc, DoneThreadFunc doneFunc)

Public Member Functions

 LibraryManager ()
 ~LibraryManager ()
void setSearchPath (const char *path)
const char * getSearchPath ()
void closeAllLibraries (bool inform=true)
char * locateLibrary (const char *name)
void lock (int h)
void unlock (int h)
int load (const char *path, int argc=0, char *argv[]=0)
void unload (int h)
void unload (const char *name)
void * getSymbol (int h, const char *symbol)
bool setupCORBAinDLL (int handle, CORBA::ORB_ptr m_orb, PortableServer::POAManager_ptr m_poaManager, PortableServer::POA_ptr m_poaRoot, PortableServer::POA_ptr m_poaPersistent, PortableServer::POA_ptr m_poaTransient)
bool initThreadsInDLL (int handle, InitThreadFunc initFunc, DoneThreadFunc doneFunc)

Private Member Functions

int ldfind (const ACE_TCHAR filename[], ACE_TCHAR pathname[], size_t maxpathnamelen)
Logging::Logger::LoggerSmartPtr getLogger ()

Private Attributes

Registrar< int, LibraryInfom_libraries
 Data about all loadrd libraries.
char * m_path
 Search path.
ACE_Recursive_Thread_Mutex mutex
 Thread synchornization mutex.
Logging::Logger::LoggerSmartPtr logger_m
 Logger for this container;.

Detailed Description

Class responsible of loading/unloading of dynamic-linked/shared libraries


Member Typedef Documentation

typedef void(* maci::LibraryManager::DLLCloseFunc)(void)

Declaration of the DLLClose function. A DLL that expects to be unloaded by the DLL Manager can export a function named "DLLClose". The DLL Manager then invokes this function just before it unloads the DLL.

Declaration of the DLLInitThreads function. A DLL that expects to be loaded by the DLL Manager can export a function named "DLLInitThreads". The DLL Manager then invokes this function just after it loads the DLL.

Parameters:
m_orb 
m_poaRoot 
m_poaPersistent 
typedef bool(* maci::LibraryManager::DLLOpenFunc)(int argc, char *argv[])

Declaration of the DLLOpen function. A DLL that expects to be loaded by the DLL Manager can export a function named "DLLOpen". The DLL Manager then invokes this function just after it loads the DLL.

Parameters:
argc number of arguments
argv array of arguments
Returns:
false on initialization failure (false indicates that DLL will be unloaded).
typedef void(* maci::LibraryManager::DLLSetupCORBAFunc)(CORBA::ORB_ptr m_orb, PortableServer::POAManager_ptr m_poaManager, PortableServer::POA_ptr m_poaRoot, PortableServer::POA_ptr m_poaPersistent, PortableServer::POA_ptr m_poaTransient)

Declaration of the DLLSetupCORBA function. A DLL that expects to be loaded by the DLL Manager can export a function named "DLLSetupCORBA". The DLL Manager then invokes this function just after it loads the DLL.

Parameters:
m_orb 
m_poaRoot 
m_poaPersistent 

Constructor & Destructor Documentation

maci::LibraryManager::LibraryManager (  ) 

Constructor

maci::LibraryManager::~LibraryManager (  ) 

Destructor


Member Function Documentation

void maci::LibraryManager::closeAllLibraries ( bool  inform = true  ) 

Close all currently opened libraries

Parameters:
inform if true DLLClose function will be called
Logging::Logger::LoggerSmartPtr maci::LibraryManager::getLogger (  )  [inline, private]

Returns an ACS Logger created for this container.

Returns:
an ACS Logger

References logger_m.

const char* maci::LibraryManager::getSearchPath (  )  [inline]

Get path where to libraries can be found

Parameters:
path 

References m_path.

void* maci::LibraryManager::getSymbol ( int  h,
const char *  symbol 
)

Resolves symbol from the library

Parameters:
handle given by open method
See also:
open
bool maci::LibraryManager::initThreadsInDLL ( int  handle,
InitThreadFunc  initFunc,
DoneThreadFunc  doneFunc 
)

Calls "DLLInitThreads" in library with specified handle

Parameters:
handle 
initFunc pointer to function
doneFunc pointer to function
Returns:
true if successful
int maci::LibraryManager::ldfind ( const ACE_TCHAR  filename[],
ACE_TCHAR  pathname[],
size_t  maxpathnamelen 
) [private]

Search throuh search path(s) for library with given name

Parameters:
filename library name
pathname found path to the library
Returns:
0 on success, -1 on failure
int maci::LibraryManager::load ( const char *  path,
int  argc = 0,
char *  argv[] = 0 
)

Loads library

Parameters:
path 
argc 
argv 
char* maci::LibraryManager::locateLibrary ( const char *  name  ) 

Get path of given library (e.g. ps returns /usr/lib/libps.so)

Parameters:
name "core" name of the library
void maci::LibraryManager::lock ( int  h  ) 

Lock library (increase reference counter)

Parameters:
handle given by open method
See also:
open
void maci::LibraryManager::setSearchPath ( const char *  path  ) 

Set path where to libraries can be found

Parameters:
path 
bool maci::LibraryManager::setupCORBAinDLL ( int  handle,
CORBA::ORB_ptr  m_orb,
PortableServer::POAManager_ptr  m_poaManager,
PortableServer::POA_ptr  m_poaRoot,
PortableServer::POA_ptr  m_poaPersistent,
PortableServer::POA_ptr  m_poaTransient 
)

Calls "DLLSetupCORBA" in library with specified handle

Parameters:
handle 
m_orb 
m_poaRoot 
m_poaPersistent 
Returns:
true if successful
void maci::LibraryManager::unload ( const char *  name  ) 

Forces to unload the library (ignoring existing references to this library)

void maci::LibraryManager::unload ( int  h  ) 

Forces to unload the library (ignoring existing references to this library)

void maci::LibraryManager::unlock ( int  h  ) 

Unlock library (decrease reference counter)

Parameters:
handle given by open method
See also:
open

Member Data Documentation

Logger for this container;.

Referenced by getLogger().

Data about all loadrd libraries.

Search path.

Referenced by getSearchPath().

ACE_Recursive_Thread_Mutex maci::LibraryManager::mutex [private]

Thread synchornization mutex.


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