#include <Iguana/Utilities/classlib/utils/AutoLoad.h>
Public Member Functions | |
AutoLoad (AutoLoadLib &library, const char *symname) | |
Define an auto-loaded function or variable names symname, to be looked up in library on first dereference. | |
bool | exists (void) |
Return true if the auto-load entity is available: the library can be loaded and the symbol is found in the library. | |
Type & | operator * (void) |
Return a reference to the the auto-loaded entity. | |
Type * | operator-> (void) |
Return a pointer to the the auto-loaded entity. | |
Private Member Functions | |
void | loadme (void) |
Load the implementation if we haven't done so yet. | |
Private Attributes | |
AutoLoadLib & | m_library |
Type * | m_symbol |
const char * | m_symname |
AutoLoad defines a function or data smart pointer for entries that should be looked up at run-time by dynamically loading a library and resolving a symbol in it.
Typically one defines a smart pointer object with the appropriate type matching the entity, data or function. The entity is used by dereferencing this smart pointer.
Use this interface judiciously, hiding dependencies behind an auto-load facility is generally frowned upon.
Definition at line 64 of file AutoLoad.h.
lat::AutoLoad< Type >::AutoLoad | ( | AutoLoadLib & | library, | |
const char * | funcname | |||
) | [inline] |
bool lat::AutoLoad< Type >::exists | ( | void | ) | [inline] |
Return true if the auto-load entity is available: the library can be loaded and the symbol is found in the library.
Definition at line 125 of file AutoLoad.h.
References lat::AutoLoad< Type >::loadme(), and lat::AutoLoad< Type >::m_symbol.
void lat::AutoLoad< Type >::loadme | ( | void | ) | [inline, private] |
Load the implementation if we haven't done so yet.
Throws an AutoLoadError if the library fails to load or there is a symbol lookup failure (non-existence of the symbol is not a failure).
Definition at line 118 of file AutoLoad.h.
References lat::AutoLoad< Type >::m_library, lat::AutoLoad< Type >::m_symbol, and lat::AutoLoad< Type >::m_symname.
Referenced by lat::AutoLoad< Type >::exists(), lat::AutoLoad< Type >::operator *(), and lat::AutoLoad< Type >::operator->().
Type & lat::AutoLoad< Type >::operator * | ( | void | ) | [inline] |
Return a reference to the the auto-loaded entity.
Loads the library and resolves the symbol; if either operation fails, throws an AutoLoadError.
Definition at line 133 of file AutoLoad.h.
References lat::AutoLoad< Type >::loadme(), and lat::AutoLoad< Type >::m_symbol.
Type * lat::AutoLoad< Type >::operator-> | ( | void | ) | [inline] |
Return a pointer to the the auto-loaded entity.
Loads the library and resolves the symbol; if either operation fails, throws an AutoLoadError.
Definition at line 141 of file AutoLoad.h.
References lat::AutoLoad< Type >::loadme(), and lat::AutoLoad< Type >::m_symbol.
AutoLoadLib& lat::AutoLoad< Type >::m_library [private] |
Type* lat::AutoLoad< Type >::m_symbol [private] |
Definition at line 81 of file AutoLoad.h.
Referenced by lat::AutoLoad< Type >::exists(), lat::AutoLoad< Type >::loadme(), lat::AutoLoad< Type >::operator *(), and lat::AutoLoad< Type >::operator->().
const char* lat::AutoLoad< Type >::m_symname [private] |