OpenASIP
2.0
|
#include <OperationBehaviorLoader.hh>
Public Member Functions | |
OperationBehaviorLoader (OperationIndex &index) | |
virtual | ~OperationBehaviorLoader () |
OperationBehavior & | importBehavior (const Operation &parent) |
void | freeBehavior () |
Private Types | |
typedef std::map< std::string, OperationBehavior * > | BehaviorMap |
Contains operation behavior models indexed by operation names. More... | |
typedef std::map< OperationBehavior *, void(*)(OperationBehavior *)> | DestructionMap |
Contains all deletion function of operation behavior models. More... | |
Private Member Functions | |
OperationBehaviorLoader (const OperationBehaviorLoader &) | |
Copying not allowed. More... | |
OperationBehaviorLoader & | operator= (const OperationBehaviorLoader &) |
Assignment not allowed. More... | |
Private Attributes | |
OperationIndex & | index_ |
Indexed table of all modules and operations accessible for this loader. More... | |
PluginTools | tools_ |
PluginTools for loading dynamic modules. More... | |
BehaviorMap | behaviors_ |
Container of all loaded operation behavior models. More... | |
DestructionMap | destructors_ |
Container of all destruction functions of behavioral models. More... | |
Static Private Attributes | |
static const std::string | CREATE_FUNC = "createOpBehavior_" |
The name of the creation function in dynamic module. More... | |
static const std::string | DELETE_FUNC = "deleteOpBehavior_" |
The name of the deletion function in dynamic module. More... | |
The purpose of this class is to import operation behavior models from dynamic modules.
PluginTools is used to import the operation behavior modules. OperationIndex is used to obtain modules in which certain operation belongs to.
Definition at line 54 of file OperationBehaviorLoader.hh.
|
private |
Contains operation behavior models indexed by operation names.
Definition at line 65 of file OperationBehaviorLoader.hh.
|
private |
Contains all deletion function of operation behavior models.
Definition at line 68 of file OperationBehaviorLoader.hh.
|
explicit |
Constructor.
OperationBehavior uses OperationIndex for getting the right modules.
index | OperationIndex. |
Definition at line 61 of file OperationBehaviorLoader.cc.
|
virtual |
Destructor.
Deletes all the loader operation behavior models.
Definition at line 70 of file OperationBehaviorLoader.cc.
References freeBehavior().
|
private |
Copying not allowed.
void OperationBehaviorLoader::freeBehavior | ( | ) |
Frees all the imported behavior models of the operations.
Definition at line 136 of file OperationBehaviorLoader.cc.
References behaviors_, destructors_, tools_, and PluginTools::unregisterAllModules().
Referenced by OperationBehaviorProxy::uninitializeBehavior(), and ~OperationBehaviorLoader().
OperationBehavior & OperationBehaviorLoader::importBehavior | ( | const Operation & | parent | ) |
Imports the behavior model of an operation.
First, the module that contains the given operation is obtained from OperationIndex. A pointer to appropriate create function is obtained and used to create OperationBehavior. Also pointer to appropriate destruction function is obtained and stored.
parent | The operation that owns the loaded behavior. |
DynamicLibraryException | If an error occurs while accessing the dynamic module. |
FileNotFound | If the .opb was not found. |
SymbolNotFound | If the constructor/destructor functions could not be imported from the .opb. |
Definition at line 91 of file OperationBehaviorLoader.cc.
References __func__, OperationModule::behaviorModule(), behaviors_, CREATE_FUNC, DELETE_FUNC, destructors_, PluginTools::importSymbol(), index_, NullOperationModule::instance(), OperationIndex::moduleOf(), Operation::name(), Exception::setCause(), StringTools::stringToUpper(), and tools_.
Referenced by OperationBehaviorProxy::initializeBehavior().
|
private |
Assignment not allowed.
|
private |
Container of all loaded operation behavior models.
Definition at line 85 of file OperationBehaviorLoader.hh.
Referenced by freeBehavior(), and importBehavior().
|
staticprivate |
The name of the creation function in dynamic module.
Definition at line 76 of file OperationBehaviorLoader.hh.
Referenced by importBehavior().
|
staticprivate |
The name of the deletion function in dynamic module.
Definition at line 78 of file OperationBehaviorLoader.hh.
Referenced by importBehavior().
|
private |
Container of all destruction functions of behavioral models.
Definition at line 87 of file OperationBehaviorLoader.hh.
Referenced by freeBehavior(), and importBehavior().
|
private |
Indexed table of all modules and operations accessible for this loader.
Definition at line 81 of file OperationBehaviorLoader.hh.
Referenced by importBehavior().
|
private |
PluginTools for loading dynamic modules.
Definition at line 83 of file OperationBehaviorLoader.hh.
Referenced by freeBehavior(), and importBehavior().