OpenASIP
2.0
|
#include <OperationIndex.hh>
Public Member Functions | |
OperationIndex () | |
virtual | ~OperationIndex () |
void | addPath (const std::string &path) |
std::string | path (int i) const |
int | pathCount () const |
OperationModule & | module (int i) |
int | moduleCount () const |
OperationModule & | module (int i, const std::string &path) |
int | moduleCount (const std::string &path) const |
void | addModule (OperationModule *module, const std::string &path) |
void | removeModule (const std::string &path, const std::string &modName) |
void | refreshModule (const std::string &path, const std::string &modName) |
OperationModule & | moduleOf (const std::string &name) |
std::string | operationName (int i, const OperationModule &om) |
int | operationCount (const OperationModule &om) |
Operation * | effectiveOperation (const TCEString &name) |
Static Public Attributes | |
static const std::string | PROPERTY_FILE_EXTENSION = ".opp" |
Private Types | |
typedef std::map< std::string, std::vector< OperationModule * > > | ModuleTable |
Contains all operation modules indexed by full path names. More... | |
typedef std::map< std::string, ObjectState * > | DefinitionTable |
Contains all object state trees of modules indexed by operation definition module names. More... | |
Private Member Functions | |
OperationIndex (const OperationIndex &) | |
Copying not allowed. More... | |
OperationIndex & | operator= (const OperationIndex &) |
Assignment not allowed. More... | |
void | readOperations (const OperationModule &module) |
OperationModule & | moduleOf (const std::string &path, const std::string &operName) |
Private Attributes | |
std::vector< std::string > | paths_ |
List of paths searched for the operation modules. More... | |
ModuleTable | modulesInPath_ |
Contains all operation modules found in a search path organized by path names. More... | |
DefinitionTable | opDefinitions_ |
Contains all operation definitions defined in available operation modules indexed by module names. More... | |
std::vector< OperationModule * > | modules_ |
Container holding all modules. More... | |
OperationSerializer | serializer_ |
Reads the operation property definitions. More... | |
OperationBehaviorLoader | loader_ |
std::vector< OperationBehaviorProxy * > | proxies_ |
std::set< const OperationModule * > | brokenModules_ |
Class that holds information about search paths, modules and operations.
An indexed table of all operations available organized by modules and indexed by names.
Definition at line 58 of file OperationIndex.hh.
|
private |
Contains all object state trees of modules indexed by operation definition module names.
Definition at line 90 of file OperationIndex.hh.
|
private |
Contains all operation modules indexed by full path names.
Definition at line 87 of file OperationIndex.hh.
OperationIndex::OperationIndex | ( | ) |
|
virtual |
Destructor.
Deletes all object state trees modeling module properties. Deletes all modules.
Definition at line 67 of file OperationIndex.cc.
References SequenceTools::deleteAllItems(), AssocTools::deleteAllValues(), modules_, opDefinitions_, and proxies_.
|
private |
Copying not allowed.
void OperationIndex::addModule | ( | OperationModule * | module, |
const std::string & | path | ||
) |
Adds a new module to OperationIndex.
module | Module to be added. |
path | Path in which module is located. |
PathNotFound | If path is not found. |
Definition at line 193 of file OperationIndex.cc.
References module(), modules_, modulesInPath_, and path().
Referenced by OSEdAddModuleCmd::Do().
void OperationIndex::addPath | ( | const std::string & | path | ) |
Adds a path to search path list.
When the path is added, all modules in that path are automatically scanned and recorded.
path | The path to be added. |
Definition at line 82 of file OperationIndex.cc.
References OperationBuilder::buildObject(), FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), FileSystem::fileNameBody(), FileSystem::fileOfPath(), FileSystem::globPath(), OperationBuilder::instance(), module(), modules_, modulesInPath_, path(), paths_, PROPERTY_FILE_EXTENSION, and FileSystem::STRING_WILD_CARD.
Referenced by OSEdAddModuleCmd::Do(), OperationContainer::operation(), OperationContainer::operationIndex(), and OperationPoolPimpl::OperationPoolPimpl().
Returns a new instance of the Operation with the given name that is 'effective' based on the search path priorities.
Definition at line 454 of file OperationIndex.cc.
References assert, ObjectState::child(), ObjectState::childCount(), TCEString::ciEqual(), NullOperationBehavior::instance(), loader_, Operation::loadState(), moduleOf(), opDefinitions_, Operation::OPRN_NAME, OperationModule::propertiesModule(), proxies_, Operation::setBehavior(), and ObjectState::stringAttribute().
Referenced by OperationPoolPimpl::operation(), and FUGen::parseOperations().
OperationModule& OperationIndex::module | ( | int | i | ) |
Referenced by addModule(), addPath(), OSEdTreeView::constructTree(), VectorLSGenerator::createVectorLSU(), OSEdBuildAllCmd::Do(), ProGeTools::generateableDAGOperations(), Automagic::generateableDAGOperations(), OperationContainer::isEffective(), OSEdBuildAllCmd::isEnabled(), OperationContainer::module(), module(), moduleOf(), OSEdInfoView::moduleView(), OperationContainer::operationExists(), readOperations(), refreshModule(), OpsetDialog::TransferDataToWindow(), OperationPropertyDialog::updateAffected(), and writeCustomOpMacros().
OperationModule & OperationIndex::module | ( | int | i, |
const std::string & | path | ||
) |
Returns the module by the given index in a given path.
i | The index of wanted module. |
path | The path of the module |
OutOfRange | If index i is out of range. |
PathNotFound | If path is not found. |
Definition at line 151 of file OperationIndex.cc.
References __func__, module(), modulesInPath_, and path().
int OperationIndex::moduleCount | ( | ) | const |
Referenced by OSEdTreeView::constructTree(), VectorLSGenerator::createVectorLSU(), OSEdBuildAllCmd::Do(), ProGeTools::generateableDAGOperations(), Automagic::generateableDAGOperations(), OperationContainer::isEffective(), OSEdBuildAllCmd::isEnabled(), OperationContainer::module(), OSEdInfoView::moduleView(), OperationContainer::operationExists(), OpsetDialog::TransferDataToWindow(), OperationPropertyDialog::updateAffected(), and writeCustomOpMacros().
int OperationIndex::moduleCount | ( | const std::string & | path | ) | const |
Returns the number of modules in a path.
path | The path of the modules. |
PathNotFound | If path is not found. |
Definition at line 175 of file OperationIndex.cc.
References __func__, modulesInPath_, and path().
OperationModule & OperationIndex::moduleOf | ( | const std::string & | name | ) |
Returns the module in which a given operation is defined.
If operation module is not found, a null operation module is returned.
name | The name of the operation. |
Definition at line 315 of file OperationIndex.cc.
References NullOperationModule::instance(), module(), and paths_.
Referenced by effectiveOperation(), OperationBehaviorLoader::importBehavior(), and OperationPoolPimpl::operation().
|
private |
Searches for a module in which a given operation is defined all in a given path.
If no module is found, NullOperationModule is returned.
path | The name of the path. |
operName | The name of the operation. |
Definition at line 403 of file OperationIndex.cc.
References brokenModules_, ObjectState::child(), ObjectState::childCount(), TCEString::ciEqual(), NullOperationModule::instance(), modulesInPath_, opDefinitions_, Operation::OPRN_NAME, path(), readOperations(), and ObjectState::stringAttribute().
int OperationIndex::operationCount | ( | const OperationModule & | om | ) |
Returns the number of operations in a particular module.
om | The OperationModule. |
BadOperationModule | When module is invalid. |
Definition at line 363 of file OperationIndex.cc.
References __func__, brokenModules_, ObjectState::childCount(), Exception::errorMessage(), opDefinitions_, OperationModule::propertiesModule(), and readOperations().
Referenced by OSEdTreeView::constructTree(), VectorLSGenerator::createVectorLSU(), OSEdAddOperationCmd::Do(), ProGeTools::generateableDAGOperations(), Automagic::generateableDAGOperations(), OperationContainer::isEffective(), OperationContainer::operationExists(), OSEdInfoView::operationView(), OpsetDialog::TransferDataToWindow(), OperationPropertyDialog::updateAffected(), and writeCustomOpMacros().
string OperationIndex::operationName | ( | int | i, |
const OperationModule & | om | ||
) |
Returns the name of the operation by the given index in a given module.
i | The index of the operation. |
om | The OperationModule. |
OutOfRange | If index i is out of range. |
BadOperationModule | When module is invalid. |
Definition at line 337 of file OperationIndex.cc.
References __func__, brokenModules_, ObjectState::child(), Exception::errorMessage(), opDefinitions_, Operation::OPRN_NAME, OperationModule::propertiesModule(), readOperations(), and ObjectState::stringAttribute().
Referenced by OSEdTreeView::constructTree(), VectorLSGenerator::createVectorLSU(), OSEdAddOperationCmd::Do(), ProGeTools::generateableDAGOperations(), Automagic::generateableDAGOperations(), OperationContainer::isEffective(), OperationContainer::operationExists(), OSEdInfoView::operationView(), OpsetDialog::TransferDataToWindow(), OperationPropertyDialog::updateAffected(), and writeCustomOpMacros().
|
private |
Assignment not allowed.
std::string OperationIndex::path | ( | int | i | ) | const |
int OperationIndex::pathCount | ( | ) | const |
|
private |
Read all operation definitions of a module.
module | The operation module to be read operations from. |
SerializerException | If reading fails. |
Definition at line 386 of file OperationIndex.cc.
References module(), opDefinitions_, OperationModule::propertiesModule(), OperationSerializer::readState(), serializer_, and OperationSerializer::setSourceFile().
Referenced by moduleOf(), operationCount(), and operationName().
void OperationIndex::refreshModule | ( | const std::string & | path, |
const std::string & | modName | ||
) |
Refreshes module (usually when new operation is added to it).
Refreshing is done by erasing the ObjectState tree of the module. That way it has to be read again.
path | The name of the path. |
modName | The name of the module. |
PathNotFound | If path is not found. |
Definition at line 272 of file OperationIndex.cc.
References __func__, module(), modulesInPath_, opDefinitions_, path(), and OperationModule::propertiesModule().
Referenced by OSEdAddOperationCmd::Do(), OSEdRemoveOperationCmd::Do(), and OSEdPropertiesCmd::Do().
void OperationIndex::removeModule | ( | const std::string & | path, |
const std::string & | modName | ||
) |
Removes the module in a given path.
path | The name of the path. |
modName | The name of the module. |
PathNotFound | If path is not found. |
Definition at line 212 of file OperationIndex.cc.
References __func__, modules_, modulesInPath_, opDefinitions_, path(), and OperationModule::propertiesModule().
Referenced by OSEdRemoveModuleCmd::Do().
|
private |
Definition at line 117 of file OperationIndex.hh.
Referenced by moduleOf(), operationCount(), and operationName().
|
private |
Definition at line 115 of file OperationIndex.hh.
Referenced by effectiveOperation().
|
private |
Container holding all modules.
Definition at line 112 of file OperationIndex.hh.
Referenced by addModule(), addPath(), removeModule(), and ~OperationIndex().
|
private |
Contains all operation modules found in a search path organized by path names.
Definition at line 107 of file OperationIndex.hh.
Referenced by addModule(), addPath(), module(), moduleCount(), moduleOf(), refreshModule(), and removeModule().
|
private |
Contains all operation definitions defined in available operation modules indexed by module names.
Definition at line 110 of file OperationIndex.hh.
Referenced by effectiveOperation(), moduleOf(), operationCount(), operationName(), readOperations(), refreshModule(), removeModule(), and ~OperationIndex().
|
private |
List of paths searched for the operation modules.
Definition at line 104 of file OperationIndex.hh.
Referenced by addPath(), and moduleOf().
|
static |
Definition at line 61 of file OperationIndex.hh.
Referenced by addPath().
|
private |
Definition at line 116 of file OperationIndex.hh.
Referenced by effectiveOperation(), and ~OperationIndex().
|
private |
Reads the operation property definitions.
Definition at line 114 of file OperationIndex.hh.
Referenced by readOperations().