|
|
@ -17,7 +17,7 @@ namespace ir { |
|
|
|
|
|
|
|
// Initializes all members with their default constructors.
|
|
|
|
Module::Module() : moduleName(), booleanVariables(), integerVariables(), booleanVariablesToIndexMap(), |
|
|
|
integerVariablesToIndexMap(), commands() { |
|
|
|
integerVariablesToIndexMap(), commands(), actionsToCommandIndexMap() { |
|
|
|
// Nothing to do here.
|
|
|
|
} |
|
|
|
|
|
|
@ -29,8 +29,14 @@ Module::Module(std::string moduleName, std::vector<storm::ir::BooleanVariable> b |
|
|
|
std::vector<storm::ir::Command> commands) |
|
|
|
: moduleName(moduleName), booleanVariables(booleanVariables), integerVariables(integerVariables), |
|
|
|
booleanVariablesToIndexMap(booleanVariableToIndexMap), |
|
|
|
integerVariablesToIndexMap(integerVariableToIndexMap), commands(commands) { |
|
|
|
// Nothing to do here.
|
|
|
|
integerVariablesToIndexMap(integerVariableToIndexMap), commands(commands), actionsToCommandIndexMap() { |
|
|
|
// Build actionsToCommandIndexMap
|
|
|
|
for (unsigned int id = 0; id < this->commands.size(); id++) { |
|
|
|
std::string action = this->commands[id].getActionName(); |
|
|
|
if (action != "") { |
|
|
|
this->actionsToCommandIndexMap[action]->insert(id); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Return the number of boolean variables.
|
|
|
@ -100,6 +106,16 @@ std::string Module::toString() const { |
|
|
|
return result.str(); |
|
|
|
} |
|
|
|
|
|
|
|
// Return Commands with given action.
|
|
|
|
std::shared_ptr<std::set<uint_fast64_t>> const Module::getCommandsByAction(std::string const& action) const { |
|
|
|
auto res = this->actionsToCommandIndexMap.find(action); |
|
|
|
if (res == this->actionsToCommandIndexMap.end()) { |
|
|
|
return std::shared_ptr<std::set<uint_fast64_t>>(new std::set<uint_fast64_t>()); |
|
|
|
} else { |
|
|
|
return res->second; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} // namespace ir
|
|
|
|
|
|
|
|
} // namespace storm
|