ltmm::backend< ThreadPolicy > Class Template Reference

#include <ltmm/backend.hh>

Inheritance diagram for ltmm::backend< ThreadPolicy >:

Inheritance graph
[legend]
Collaboration diagram for ltmm::backend< ThreadPolicy >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<typename ThreadPolicy = single_thread>
class ltmm::backend< ThreadPolicy >

Base class for backend loaders.

Error handling The user derived member method should throw
an exception of kind ltmm::backend_error initialised with and appropiate error code identifier, if an error occours. The library will process the exception and set the error condition as appropiate.

Definition at line 99 of file backend.hh.

Public Types

typedef ThreadPolicy thread_policy_type

Public Member Functions

const std::string & name () const
const std::string & prefix () const

Protected Member Functions

 backend (const std::string &name, const std::string &prefix)
virtual ~backend ()
virtual void * load (const std::string &f)=0 throw (backend_error)
virtual bool unload (void *m)=0 throw (backend_error)
virtual void * find_symbol (void *m, const std::string &s)=0 throw (backend_error)
virtual bool exit ()=0 throw (backend_error)

Static Protected Member Functions

static lt_module open (lt_user_data d, const char *f) throw ()
static int close (lt_user_data d, lt_module m) throw ()
static lt_ptr find_sym (lt_user_data d, lt_module m, const char *s) throw ()
static int exit (lt_user_data d) throw ()

Protected Attributes

std::string _name
std::string _prefix
lt_dlloader_place

Friends

class loader< ThreadPolicy >


Member Typedef Documentation

template<typename ThreadPolicy = single_thread>
typedef ThreadPolicy ltmm::backend< ThreadPolicy >::thread_policy_type
 

The type of thread locks.

Definition at line 103 of file backend.hh.


Constructor & Destructor Documentation

template<typename ThreadPolicy>
ltmm::backend< ThreadPolicy >::backend const std::string &  name,
const std::string &  prefix
[protected]
 

Constructor.

Definition at line 182 of file backend.hh.

template<typename ThreadPolicy = single_thread>
virtual ltmm::backend< ThreadPolicy >::~backend  )  [inline, protected, virtual]
 

Destructor.

Definition at line 144 of file backend.hh.


Member Function Documentation

template<typename ThreadPolicy>
int ltmm::backend< ThreadPolicy >::close lt_user_data  d,
lt_module  m
throw () [inline, static, protected]
 

Friend to forward calls to open.

Parameters:
d The data - actual an object of this class.
m Handle to library to close
Returns:
0 on success, 1 on errors.

Definition at line 207 of file backend.hh.

References ltmm::backend_error::cannot_close, ltmm::backend_error::id(), lt_dlseterror(), and ltmm::backend< ThreadPolicy >::unload().

Here is the call graph for this function:

template<typename ThreadPolicy = single_thread>
virtual bool ltmm::backend< ThreadPolicy >::exit  )  throw (backend_error) [protected, pure virtual]
 

Call-back called when the backend is removed.

The user cose should overload this to free any resources that the derived class may have.

Exceptions:
ltmm::backend See the class description.
Returns:
false on errors, true on success.

Implemented in ltmm::internal_backend< ThreadPolicy >.

template<typename ThreadPolicy>
int ltmm::backend< ThreadPolicy >::exit lt_user_data  d  )  throw () [inline, static, protected]
 

Friend to forward calls to exit.

Definition at line 240 of file backend.hh.

References ltmm::backend< ThreadPolicy >::exit(), ltmm::backend_error::id(), lt_dlseterror(), and ltmm::backend_error::remove_loader.

Referenced by ltmm::backend< ThreadPolicy >::exit().

Here is the call graph for this function:

template<typename ThreadPolicy>
lt_ptr ltmm::backend< ThreadPolicy >::find_sym lt_user_data  d,
lt_module  m,
const char *  s
throw () [inline, static, protected]
 

Friend to forward calls to find_symbol.

Parameters:
d The data - actual an object of this class.
m Handle to library to look in.
s Tjhe symbol to look for
Returns:
pointer to symbol, or 0 (zero) on errors.

Definition at line 223 of file backend.hh.

References ltmm::backend< ThreadPolicy >::find_symbol(), ltmm::backend_error::id(), lt_dlseterror(), lt_ptr, and ltmm::backend_error::symbol_not_found.

Here is the call graph for this function:

template<typename ThreadPolicy = single_thread>
virtual void* ltmm::backend< ThreadPolicy >::find_symbol void *  m,
const std::string &  s
throw (backend_error) [protected, pure virtual]
 

Find a symbol in a library.

The client code should overload this member function to find a symbol in the loaded library.

Parameters:
m Handle to loaded library.
s The name of the symbol to find.
Exceptions:
ltmm::backend See the class description.
Returns:
a handle to the symbol in the library, or 0 on errors.

Implemented in ltmm::internal_backend< ThreadPolicy >.

Referenced by ltmm::backend< ThreadPolicy >::find_sym().

template<typename ThreadPolicy = single_thread>
virtual void* ltmm::backend< ThreadPolicy >::load const std::string &  f  )  throw (backend_error) [protected, pure virtual]
 

Load a library.

The client should overload this to open a dynamic loadable library.

Parameters:
f The file name of the module to load.
Exceptions:
ltmm::backend See the class description.
Returns:
a handle to the loaded library, or 0 on errors.

Implemented in ltmm::internal_backend< ThreadPolicy >.

Referenced by ltmm::backend< ThreadPolicy >::open().

template<typename ThreadPolicy = single_thread>
const std::string& ltmm::backend< ThreadPolicy >::name  )  const [inline]
 

Get the name.

Definition at line 176 of file backend.hh.

Referenced by ltmm::loader< ThreadPolicy >::insert_backend(), and ltmm::loader< ThreadPolicy >::remove_backend().

template<typename ThreadPolicy>
lt_module ltmm::backend< ThreadPolicy >::open lt_user_data  d,
const char *  f
throw () [inline, static, protected]
 

Friend to forward calls to open.

Parameters:
d The data - actual an object of this class.
f The file name of library to load
Returns:
A handle to the opened library, or 0 on error.

Definition at line 191 of file backend.hh.

References ltmm::backend_error::cannot_open, ltmm::backend_error::id(), ltmm::backend< ThreadPolicy >::load(), and lt_dlseterror().

Here is the call graph for this function:

template<typename ThreadPolicy = single_thread>
const std::string& ltmm::backend< ThreadPolicy >::prefix  )  const [inline]
 

Get the prefix.

Definition at line 178 of file backend.hh.

Referenced by ltmm::loader< ThreadPolicy >::insert_backend().

template<typename ThreadPolicy = single_thread>
virtual bool ltmm::backend< ThreadPolicy >::unload void *  m  )  throw (backend_error) [protected, pure virtual]
 

Unload a library.

The client should overload this to close a dynamic loadable library.

Parameters:
m Handle to the library to unload.
Exceptions:
ltmm::backend See the class description.
Returns:
true if successful, false otherwise

Implemented in ltmm::internal_backend< ThreadPolicy >.

Referenced by ltmm::backend< ThreadPolicy >::close().


Friends And Related Function Documentation

template<typename ThreadPolicy = single_thread>
friend class loader< ThreadPolicy > [friend]
 

Loader class needs to be a friend.

Reimplemented in ltmm::internal_backend< ThreadPolicy >.

Definition at line 107 of file backend.hh.


Member Data Documentation

template<typename ThreadPolicy = single_thread>
std::string ltmm::backend< ThreadPolicy >::_name [protected]
 

Name of this backend.

Definition at line 110 of file backend.hh.

Referenced by ltmm::backend< thread_policy_type >::name().

template<typename ThreadPolicy = single_thread>
lt_dlloader* ltmm::backend< ThreadPolicy >::_place [protected]
 

Low-level pointer.

Definition at line 114 of file backend.hh.

Referenced by ltmm::loader< ThreadPolicy >::insert_backend(), ltmm::internal_backend< ThreadPolicy >::internal_backend(), and ltmm::loader< ThreadPolicy >::next_backend().

template<typename ThreadPolicy = single_thread>
std::string ltmm::backend< ThreadPolicy >::_prefix [protected]
 

Prefix for symbols.

Definition at line 112 of file backend.hh.

Referenced by ltmm::backend< thread_policy_type >::prefix().


The documentation for this class was generated from the following file:
Top of page
Last update Mon Jun 27 13:25:21 2005
Christian Holm
Created by DoxyGen 1.4.3-20050530