CppUnit project page | FAQ

DynamicLibraryManager.h
Go to the documentation of this file.
1 #ifndef CPPUNIT_PLUGIN_DYNAMICLIBRARYMANAGER_H
2 #define CPPUNIT_PLUGIN_DYNAMICLIBRARYMANAGER_H
3
4 #include <cppunit/Portability.h>
5 #include <string>
6
7 #if !defined(CPPUNIT_NO_TESTPLUGIN)
8
9 CPPUNIT_NS_BEGIN
10
11
34 class DynamicLibraryManager
35 {
36 public:
37 typedef void *Symbol;
38 typedef void *LibraryHandle;
39
45 DynamicLibraryManager( const std::string &libraryFileName );
46
48 ~DynamicLibraryManager();
49
55 Symbol findSymbol( const std::string &symbol );
56
57 private:
63 void loadLibrary( const std::string &libraryName );
64
69 void releaseLibrary();
70
77 LibraryHandle doLoadLibrary( const std::string &libraryName );
78
85 void doReleaseLibrary();
86
93 Symbol doFindSymbol( const std::string &symbol );
94
103 std::string getLastErrorDetail() const;
104
106 DynamicLibraryManager( const DynamicLibraryManager &copy );
107
109 void operator =( const DynamicLibraryManager &copy );
110
111 private:
112 LibraryHandle m_libraryHandle;
113 std::string m_libraryName;
114 };
115
116
117 CPPUNIT_NS_END
118
119 #endif // !defined(CPPUNIT_NO_TESTPLUGIN)
120
121 #endif // CPPUNIT_PLUGIN_DYNAMICLIBRARYMANAGER_H
DynamicLibraryManager::findSymbol
Symbol findSymbol(const std::string &symbol)
Returns a pointer on the specified symbol exported by the library.
Definition: DynamicLibraryManager.cpp:24
DynamicLibraryManager::~DynamicLibraryManager
~DynamicLibraryManager()
Releases the loaded library..
Definition: DynamicLibraryManager.cpp:17
DynamicLibraryManager::loadLibrary
void loadLibrary(const std::string &libraryName)
Definition: DynamicLibraryManager.cpp:44
DynamicLibraryManager::doLoadLibrary
LibraryHandle doLoadLibrary(const std::string &libraryName)
DynamicLibraryManager::Symbol
void * Symbol
Definition: DynamicLibraryManager.h:37
DynamicLibraryManager::DynamicLibraryManager
DynamicLibraryManager(const std::string &libraryFileName)
Loads the specified library.
Definition: DynamicLibraryManager.cpp:9
DynamicLibraryManager::operator=
void operator=(const DynamicLibraryManager &copy)
Prevents the use of the copy operator.
DynamicLibraryManager::doFindSymbol
Symbol doFindSymbol(const std::string &symbol)
DynamicLibraryManager::m_libraryHandle
LibraryHandle m_libraryHandle
Definition: DynamicLibraryManager.h:112
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:105
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition: Portability.h:106
DynamicLibraryManager::DynamicLibraryManager
DynamicLibraryManager(const DynamicLibraryManager &copy)
Prevents the use of the copy constructor.
DynamicLibraryManager
Manages dynamic libraries.
Definition: DynamicLibraryManager.h:35
DynamicLibraryManager::releaseLibrary
void releaseLibrary()
Definition: DynamicLibraryManager.cpp:64
DynamicLibraryManager::doReleaseLibrary
void doReleaseLibrary()
DynamicLibraryManager::getLastErrorDetail
std::string getLastErrorDetail() const
Portability.h
DynamicLibraryManager::LibraryHandle
void * LibraryHandle
Definition: DynamicLibraryManager.h:38
DynamicLibraryManager::m_libraryName
std::string m_libraryName
Definition: DynamicLibraryManager.h:113

| Send comments to: CppUnit Developers