Browse Source

use int instead of string ids

Former-commit-id: 91c6eda5c6
tempestpy_adaptions
ThomasH 8 years ago
parent
commit
b930ed0dde
  1. 29
      src/storage/gspn/GspnBuilder.cpp
  2. 14
      src/storage/gspn/GspnBuilder.h

29
src/storage/gspn/GspnBuilder.cpp

@ -22,28 +22,29 @@ namespace storm {
gspn.addPlace(place);
}
void GspnBuilder::addImmediateTransition(std::string const& name, uint_fast64_t const& priority, double const& weight) {
void GspnBuilder::addImmediateTransition(uint_fast64_t const& id, uint_fast64_t const& priority, double const& weight) {
auto trans = storm::gspn::ImmediateTransition<double>();
trans.setName(name);
trans.setName(std::to_string(id));
trans.setPriority(priority);
trans.setWeight(weight);
gspn.addImmediateTransition(trans);
}
void GspnBuilder::addTimedTransition(std::string const& name, uint_fast64_t const& priority, double const& rate) {
void GspnBuilder::addTimedTransition(uint_fast64_t const &id, uint_fast64_t const &priority, double const &rate) {
auto trans = storm::gspn::TimedTransition<double>();
trans.setName(name);
trans.setName(std::to_string(id));
trans.setPriority(priority);
trans.setRate(rate);
gspn.addTimedTransition(trans);
}
void GspnBuilder::addInputArc(uint_fast64_t const& from, std::string const& to, uint_fast64_t const& multiplicity) {
auto transPair = gspn.getTransition(to);
void GspnBuilder::addInputArc(uint_fast64_t const &from, uint_fast64_t const &to,
uint_fast64_t const &multiplicity) {
auto transPair = gspn.getTransition(std::to_string(to));
if (!std::get<0>(transPair)) {
STORM_LOG_THROW(false, storm::exceptions::IllegalFunctionCallException, "The transition with the name \"" + to + "\" does not exist.");
STORM_LOG_THROW(false, storm::exceptions::IllegalFunctionCallException, "The transition with the name \"" + std::to_string(to) + "\" does not exist.");
}
auto placePair = gspn.getPlace(idToPlaceName.at(from));
@ -54,10 +55,10 @@ namespace storm {
std::get<1>(transPair)->setInputArcMultiplicity(std::get<1>(placePair), multiplicity);
}
void GspnBuilder::addInhibitionArc(uint_fast64_t const& from, std::string const& to, uint_fast64_t const& multiplicity) {
auto transPair = gspn.getTransition(to);
void GspnBuilder::addInhibitionArc(uint_fast64_t const& from, uint_fast64_t const& to, uint_fast64_t const& multiplicity) {
auto transPair = gspn.getTransition(std::to_string(to));
if (!std::get<0>(transPair)) {
STORM_LOG_THROW(false, storm::exceptions::IllegalFunctionCallException, "The transition with the name \"" + to + "\" does not exist.");
STORM_LOG_THROW(false, storm::exceptions::IllegalFunctionCallException, "The transition with the name \"" + std::to_string(to) + "\" does not exist.");
}
auto placePair = gspn.getPlace(idToPlaceName.at(from));
@ -68,13 +69,13 @@ namespace storm {
std::get<1>(transPair)->setInhibitionArcMultiplicity(std::get<1>(placePair), multiplicity);
}
void GspnBuilder::addOutputArc(uint_fast64_t const& from, std::string const& to, uint_fast64_t const& multiplicity) {
auto transPair = gspn.getTransition(to);
void GspnBuilder::addOutputArc(uint_fast64_t const& from, uint_fast64_t const& to, uint_fast64_t const& multiplicity) {
auto transPair = gspn.getTransition(std::to_string(from));
if (!std::get<0>(transPair)) {
STORM_LOG_THROW(false, storm::exceptions::IllegalFunctionCallException, "The transition with the name \"" + to + "\" does not exist.");
STORM_LOG_THROW(false, storm::exceptions::IllegalFunctionCallException, "The transition with the name \"" + std::to_string(to) + "\" does not exist.");
}
auto placePair = gspn.getPlace(idToPlaceName.at(from));
auto placePair = gspn.getPlace(idToPlaceName.at(to));
if (!std::get<0>(placePair)) {
STORM_LOG_THROW(false, storm::exceptions::IllegalFunctionCallException, "The place with the id \"" + std::to_string(from) + "\" does not exist.");
}

14
src/storage/gspn/GspnBuilder.h

@ -32,19 +32,19 @@ namespace storm {
/**
* Adds an immediate transition to the gspn.
* @param name The name must be unique for the gspn.
* @param id The id must be unique for the gspn.
* @param priority The priority for the transtion.
* @param weight The weight for the transition.
*/
void addImmediateTransition(std::string const& name, uint_fast64_t const& priority = 0, double const& weight = 0);
void addImmediateTransition(uint_fast64_t const& id, uint_fast64_t const& priority = 0, double const& weight = 0);
/**
* Adds an timed transition to the gspn.
* @param name The name must be unique for the gspn.
* @param id The name id be unique for the gspn.
* @param priority The priority for the transtion.
* @param weight The weight for the transition.
*/
void addTimedTransition(std::string const& name, uint_fast64_t const& priority = 0, double const& rate = 0);
void addTimedTransition(uint_fast64_t const &id, uint_fast64_t const &priority = 0, double const &rate = 0);
/**
* Adds an new input arc from a place to an transition.
@ -52,7 +52,7 @@ namespace storm {
* @param to The transtion to which the arc goes to.
* @param multiplicity The multiplicity of the arc.
*/
void addInputArc(uint_fast64_t const& from, std::string const& to, uint_fast64_t const& multiplicity = 1);
void addInputArc(uint_fast64_t const &from, uint_fast64_t const &to, uint_fast64_t const &multiplicity = 1);
/**
* Adds an new input arc from a place to an transition.
@ -60,7 +60,7 @@ namespace storm {
* @param to The transtion to which the arc goes to.
* @param multiplicity The multiplicity of the arc.
*/
void addInhibitionArc(uint_fast64_t const& from, std::string const& to, uint_fast64_t const& multiplicity = 1);
void addInhibitionArc(uint_fast64_t const& from, uint_fast64_t const& to, uint_fast64_t const& multiplicity = 1);
/**
* Adds an new input arc from a place to an transition.
@ -68,7 +68,7 @@ namespace storm {
* @param to The transtion to which the arc goes to.
* @param multiplicity The multiplicity of the arc.
*/
void addOutputArc(uint_fast64_t const& from, std::string const& to, uint_fast64_t const& multiplicity = 1);
void addOutputArc(uint_fast64_t const& from, uint_fast64_t const& to, uint_fast64_t const& multiplicity = 1);
/**
*

Loading…
Cancel
Save