All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HSEP::DriverLib< Type > Class Template Reference

The DriverLib is a special type of "Library" that will execute several standard exported functions to "acquire" several "instances" from the specified library. More...

#include <DriverLib.h>

+ Inheritance diagram for HSEP::DriverLib< Type >:
+ Collaboration diagram for HSEP::DriverLib< Type >:

Public Types

typedef Dictionary< Type > TypeDictionary
 Dictionary to control stored instances of Type.
 
typedef TypeDictionary *(* createTypeCatalog )()
 Function existing in the library to create the TypeDictionary.
 
typedef void(* destroyTypeCatalog )(TypeDictionary *)
 Function existing in the library to destroy the TypeDictionary.
 
typedef void(* driverInfo )(string &)
 Function with information about the library itself.
 
typedef function< void(string
&pKey, Type *pValue)> 
ForEachWorker
 The function prototype to be used in the foreach method.
 

Public Member Functions

 DriverLib (string &pPathRef, string &pFactoryFunctionNameRef)
 Given the specified library name, loads it and run a creation function based on the "create" prefix and the pFactoryFunctionNameRef, to obtain a series of dynamically constructed objects inside a map whose key is a string representing the name of the particular object.
 
 ~DriverLib ()
 Executes the "destroy"+aFactoryFunctionName function and releases all the miscellaneous data structure elements defined to contain the Library.
 
TypeDictionarygetCatalogPtr ()
 Provides a pointer to the catalog containing the loaded objects.
 
string & infoRef ()
 Returns the information provided by the specific driver has been loaded.
 
Type * getItemPtr (string &pItemNameRef)
 Provides the particular object, according with its name.
 
void forEach (ForEachWorker pWorker)
 Executes the provider pWorker on each stored component.
 
bool has (string &pItemNameRef)
 Indicates if the provided component is stored inside the DriverLib.
 
- Public Member Functions inherited from HSEP::Library
 Library (const char *pType, string &pPath)
 Constructs and loads the library pointed by pPath.
 
 ~Library ()
 Unloads the library and clean the related data structures.
 
void invalidate ()
 Makes the library to be in invalid state, unloading any loaded material.
 
- Public Member Functions inherited from HSEP::HSEPObject
string & lastErrorRef ()
 Returns a reference to the last stored error message.
 
ErrorCode lastCode ()
 Returns the last stored code.
 
bool valid ()
 Permits to know if the object has a valid internal state.
 
string & typeRef ()
 Permits to know the type of this particular object.
 

Additional Inherited Members

- Protected Member Functions inherited from HSEP::Library
void * getMethodPtr (string &pMethodNameRef)
 Returns a pointer to the specified method is contained in the loaded dynamic library.
 
- Protected Attributes inherited from HSEP::Library
void * aHandlerPtr
 The library handler.
 

Detailed Description

template<class Type>
class HSEP::DriverLib< Type >

The DriverLib is a special type of "Library" that will execute several standard exported functions to "acquire" several "instances" from the specified library.

What these instances can do depends on how the DriverLib is designed to be used.

Definition at line 40 of file DriverLib.h.

Member Typedef Documentation

template<class Type >
typedef TypeDictionary*(* HSEP::DriverLib< Type >::createTypeCatalog)()

Function existing in the library to create the TypeDictionary.

Definition at line 45 of file DriverLib.h.

template<class Type >
typedef void(* HSEP::DriverLib< Type >::destroyTypeCatalog)(TypeDictionary *)

Function existing in the library to destroy the TypeDictionary.

Definition at line 46 of file DriverLib.h.

template<class Type >
typedef void(* HSEP::DriverLib< Type >::driverInfo)(string &)

Function with information about the library itself.

Definition at line 47 of file DriverLib.h.

template<class Type >
typedef function<void (string& pKey, Type* pValue)> HSEP::DriverLib< Type >::ForEachWorker

The function prototype to be used in the foreach method.

Definition at line 49 of file DriverLib.h.

template<class Type >
typedef Dictionary<Type> HSEP::DriverLib< Type >::TypeDictionary

Dictionary to control stored instances of Type.

Definition at line 44 of file DriverLib.h.

Constructor & Destructor Documentation

template<class Type >
HSEP::DriverLib< Type >::DriverLib ( string &  pPathRef,
string &  pFactoryFunctionNameRef 
)
inline

Given the specified library name, loads it and run a creation function based on the "create" prefix and the pFactoryFunctionNameRef, to obtain a series of dynamically constructed objects inside a map whose key is a string representing the name of the particular object.

The pFactoryFunctionNameRef is stored because when the DriverLib need to be destroyed, a function based on the "destroy" prefix and such value will be executed. Its intent is to clear any type of resource could have been created when the create+pFactoryFunctionNameRef funcion was executed.

Also, executes the library "driverInfo" function, that will provide a basic textual description for the library.

Future versions could add more standard methods to obtain even more flexible types of libraries.

Parameters
pPathRefWhere the library is located.
pFactoryFunctionNameRefThe name of the C style function inside the library.

Definition at line 76 of file DriverLib.h.

References driverInfo().

+ Here is the call graph for this function:

template<class Type >
HSEP::DriverLib< Type >::~DriverLib ( )
inline

Executes the "destroy"+aFactoryFunctionName function and releases all the miscellaneous data structure elements defined to contain the Library.

Definition at line 112 of file DriverLib.h.

Member Function Documentation

template<class Type >
void HSEP::DriverLib< Type >::forEach ( ForEachWorker  pWorker)
inline

Executes the provider pWorker on each stored component.

Parameters
pWorker

Definition at line 176 of file DriverLib.h.

template<class Type >
TypeDictionary* HSEP::DriverLib< Type >::getCatalogPtr ( )
inline

Provides a pointer to the catalog containing the loaded objects.

Returns

Definition at line 140 of file DriverLib.h.

template<class Type >
Type* HSEP::DriverLib< Type >::getItemPtr ( string &  pItemNameRef)
inline

Provides the particular object, according with its name.

Parameters
pItemNameRef
Returns

Definition at line 162 of file DriverLib.h.

Referenced by HSEP::DriverSet< Type >::ptr().

+ Here is the caller graph for this function:

template<class Type >
bool HSEP::DriverLib< Type >::has ( string &  pItemNameRef)
inline

Indicates if the provided component is stored inside the DriverLib.

Parameters
pItemNameRef
Returns
true when the component is stored
false when the component is not stored

Definition at line 188 of file DriverLib.h.

Referenced by HSEP::DriverSet< Type >::has().

+ Here is the caller graph for this function:

template<class Type >
string& HSEP::DriverLib< Type >::infoRef ( )
inline

Returns the information provided by the specific driver has been loaded.

Returns

Definition at line 153 of file DriverLib.h.

Referenced by HSEP::DriverSet< Type >::info().

+ Here is the caller graph for this function:


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