Browse Source

Convenience function in model and automaton, building explicit mappings (independent of implementation)

Former-commit-id: e183ae7ea8 [formerly 62b52cb78b]
Former-commit-id: 8204f5b655
tempestpy_adaptions
sjunges 8 years ago
parent
commit
20eaac6918
  1. 11
      src/storage/jani/Automaton.cpp
  2. 5
      src/storage/jani/Automaton.h
  3. 10
      src/storage/jani/Model.cpp
  4. 5
      src/storage/jani/Model.h

11
src/storage/jani/Automaton.cpp

@ -148,6 +148,16 @@ namespace storm {
std::set<uint64_t> const& Automaton::getInitialLocationIndices() const {
return initialLocationIndices;
}
std::map<uint64_t, std::string> Automaton::buildIdToLocationNameMap() const {
std::map<uint64_t, std::string> mapping;
uint64_t i = 0;
for(auto const& loc : locations) {
mapping[i] = loc.getName();
++i;
}
return mapping;
}
Automaton::Edges Automaton::getEdgesFromLocation(std::string const& name) {
auto it = locationToIndex.find(name);
@ -299,6 +309,7 @@ namespace storm {
actionIndices.insert(edge.getActionIndex());
}
std::vector<Edge>& Automaton::getEdges() {
return edges;
}

5
src/storage/jani/Automaton.h

@ -193,6 +193,11 @@ namespace storm {
*/
std::set<uint64_t> const& getInitialLocationIndices() const;
/*!
* Builds a map from ID to Location Name.
*/
std::map<uint64_t, std::string> buildIdToLocationNameMap() const;
/*!
* Retrieves the edges of the location with the given name.
*/

10
src/storage/jani/Model.cpp

@ -260,6 +260,16 @@ namespace storm {
return result;
}
std::map<uint64_t, std::string> Model::buildActionToNameMap() const {
std::map<uint64_t, std::string> mapping;
uint64_t i = 0;
for(auto const& act : actions) {
mapping[i] = act.getName();
++i;
}
return mapping;
}
std::string const& Model::getSilentActionName() const {
return actions[silentActionIndex].getName();
}

5
src/storage/jani/Model.h

@ -81,6 +81,11 @@ namespace storm {
* Retrieves the actions of the model.
*/
std::vector<Action> const& getActions() const;
/*!
* Builds a map with action indices mapped to their names
*/
std::map<uint64_t, std::string> buildActionToNameMap() const;
/*!
* Retrieves all non-silent action indices of the model.

Loading…
Cancel
Save