Go to the documentation of this file.
90 vector<string> modules;
96 vector<OperationModule*> opModules;
97 for (
unsigned int i = 0; i < modules.size(); i++) {
99 string behaviourFile = modules[i];
100 string behaviourSourceFile =
101 behaviourFile.substr(0, behaviourFile.length() - 3) +
"cc";
104 *(behaviourFile.rbegin()) =
'b';
110 std::vector<std::string> output;
112 file.substr(0, file.length()-4), behaviourSourceFile,
115 std::cerr <<
"Warning: Found operation module specification "
116 <<
"file " << modules[i] <<
" and operation "
117 <<
"behavious source file " << behaviourSourceFile
118 <<
" without compiled behaviour "
119 <<
"implementation file "
120 << behaviourFile <<
"." << std::endl;
121 std::cerr <<
"Tried to compile behaviour impelementaton "
122 <<
"file, but the compilation failed to error: "
124 for (
unsigned int j = 0; j < output.size(); j++) {
125 std::cerr << output[j] << std::endl;
127 std::cerr <<
"This may cause program to hang if operation "
128 <<
"in this module is attempted to be simulated."
135 opModules.push_back(
module);
154 string msg =
"Path for the module not found.";
158 if (i < 0 || i >
static_cast<int>((*it).second.size()) - 1) {
159 string msg =
"Index out of range.";
176 ModuleTable::const_iterator it =
179 string msg =
"Path for the modules not found.";
182 return (*it).second.size();
196 string method =
"OperationIndex::addModule()";
197 string msg =
"Path not found.";
201 (*it).second.push_back(
module);
213 const std::string& path,
const std::string& modName) {
216 string msg =
"Paths of the module not found.";
222 vector<OperationModule*>::iterator modIter = (*iter).second.begin();
223 while (modIter != (*iter).second.end()) {
224 if ((*modIter)->name() == modName) {
225 toBeErased = *modIter;
226 (*iter).second.erase(modIter);
232 if (toBeErased == NULL) {
235 "Operation module " +
path +
":" + modName +
" not found.");
240 if (*modIter == toBeErased) {
252 delete (*dIter).second;
273 const std::string& path,
const std::string& modName) {
276 string msg =
"Path for the module not found.";
280 vector<OperationModule*>::iterator iter = (*modIter).second.begin();
282 while (iter != (*modIter).second.end()) {
283 if ((*iter)->name() == modName) {
293 "Operation module " +
path +
":" + modName +
" not found.");
296 DefinitionTable::iterator it =
318 for (
unsigned int i = 0; i <
paths_.size(); i++) {
345 string msg =
"Error when reading module: " + s.
errorMessage();
371 string msg =
"Error when reading module: " + s.
errorMessage();
404 const std::string& path,
405 const std::string& operName) {
412 vector<OperationModule*> mods = (*mt).second;
415 for (
unsigned int j = 0; j < mods.size(); j++) {
419 DefinitionTable::const_iterator dt =
441 if (childName.
ciEqual(operName)) {
458 DefinitionTable::const_iterator dt =
467 for (
int i = 0; i < root->
childCount(); i++) {
468 child = root->
child(i);
void addPath(const std::string &path)
void refreshModule(const std::string &path, const std::string &modName)
std::string stringAttribute(const std::string &name) const
DefinitionTable opDefinitions_
Contains all operation definitions defined in available operation modules indexed by module names.
std::set< const OperationModule * > brokenModules_
static const char * OPRN_NAME
Object state name for name.
std::vector< OperationModule * > modules_
Container holding all modules.
static void globPath(const std::string &pattern, std::vector< std::string > &filenames)
static std::string fileOfPath(const std::string pathName)
#define assert(condition)
static const std::string PROPERTY_FILE_EXTENSION
bool ciEqual(const TCEString &other) const
virtual std::string propertiesModule() const
virtual void setBehavior(OperationBehavior &behavior)
std::vector< OperationBehaviorProxy * > proxies_
void addModule(OperationModule *module, const std::string &path)
virtual ObjectState * readState()
virtual void loadState(const ObjectState *state)
std::vector< std::string > paths_
List of paths searched for the operation modules.
ObjectState * child(int index) const
void setSourceFile(const std::string &filename)
void readOperations(const OperationModule &module)
std::string errorMessage() const
static const std::string DIRECTORY_SEPARATOR
OperationBehaviorLoader loader_
virtual ~OperationIndex()
bool buildObject(const std::string &baseName, const std::string &behaviorFile, const std::string &path, std::vector< std::string > &output)
ModuleTable modulesInPath_
Contains all operation modules found in a search path organized by path names.
static NullOperationBehavior & instance()
static bool fileExists(const std::string fileName)
Operation * effectiveOperation(const TCEString &name)
std::string path(int i) const
void removeModule(const std::string &path, const std::string &modName)
OperationSerializer serializer_
Reads the operation property definitions.
static const std::string STRING_WILD_CARD
static NullOperationModule & instance()
static std::string fileNameBody(const std::string &fileName)
int operationCount(const OperationModule &om)
OperationModule & module(int i)
OperationModule & moduleOf(const std::string &name)
std::string operationName(int i, const OperationModule &om)
static OperationBuilder & instance()