claw::dynamic_library Class Reference

A class to use dynamic libraries. More...

#include <dynamic_library.hpp>

List of all members.

Public Member Functions

 dynamic_library (const std::string &name, bool current_program=false)
 Constructor.
 ~dynamic_library ()
 Destructor (close the library).
bool have_symbol (const std::string &name) const
 Tell if the library has a symbol.
template<class T >
get_symbol (const std::string &name) const
 Get a symbol in the library.

Private Attributes

dynamic_library_traits::handle m_handle
 Handle of the library.

Detailed Description

A class to use dynamic libraries.

Author:
Julien Jorge

Definition at line 41 of file dynamic_library.hpp.


Constructor & Destructor Documentation

claw::dynamic_library::dynamic_library ( const std::string &  name,
bool  current_program = false 
)

Constructor.

Parameters:
name Name of the library to load.
current_program Tell if the name parameter is the current program.

Definition at line 39 of file dynamic_library.cpp.

References m_handle.

00041 {
00042   if ( current_program )
00043     m_handle = dynamic_library_traits::auto_open( name );
00044   else
00045     m_handle = dynamic_library_traits::open( name );
00046 
00047   if ( !dynamic_library_traits::valid_handle(m_handle) )
00048     throw exception( "Can't open library '" + name + "'" );
00049 } // dynamic_library::dynamic_library()

claw::dynamic_library::~dynamic_library (  ) 

Destructor (close the library).

Definition at line 55 of file dynamic_library.cpp.

References m_handle.

00056 {
00057   dynamic_library_traits::close( m_handle );
00058 } // dynamic_library::~dynamic_library()


Member Function Documentation

template<class T >
T claw::dynamic_library::get_symbol ( const std::string &  name  )  const [inline]

Get a symbol in the library.

Parameters:
name The name of the symbol to get.

Definition at line 38 of file dynamic_library.tpp.

References m_handle.

00039 {
00040   return dynamic_library_traits::get_symbol<T>(m_handle, name);
00041 } // dynamic_library::get_symbol()

bool claw::dynamic_library::have_symbol ( const std::string &  name  )  const

Tell if the library has a symbol.

Parameters:
name The symbol to find.

Definition at line 65 of file dynamic_library.cpp.

References m_handle.

00066 {
00067   return dynamic_library_traits::have_symbol( m_handle, name );
00068 } // dynamic_library::have_symbol()


Member Data Documentation

dynamic_library_traits::handle claw::dynamic_library::m_handle [private]

Handle of the library.

Definition at line 54 of file dynamic_library.hpp.

Referenced by dynamic_library(), get_symbol(), have_symbol(), and ~dynamic_library().


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

Generated on 9 Nov 2009 for CLAW Library (a C++ Library Absolutely Wonderful) by  doxygen 1.6.1