Browse Source

refactor Coalition to use boost variant

tempestpy_adaptions
Stefan Pranger 4 years ago
parent
commit
f9368be970
  1. 4
      src/storm-parsers/parser/FormulaParserGrammar.cpp
  2. 23
      src/storm/logic/Coalition.cpp
  3. 30
      src/storm/logic/Coalition.h

4
src/storm-parsers/parser/FormulaParserGrammar.cpp

@ -144,9 +144,9 @@ namespace storm {
coalitionOperator = (qi::lit("<<")
> *( (identifier[phoenix::push_back(qi::_a, qi::_1)]
| qi::int_[phoenix::push_back(qi::_b, qi::_1)]) % ','
| qi::int_[phoenix::push_back(qi::_a, qi::_1)]) % ','
)
> qi::lit(">>"))[qi::_val = phoenix::bind(&FormulaParserGrammar::createCoalition, phoenix::ref(*this), qi::_a, qi::_b)];
> qi::lit(">>"))[qi::_val = phoenix::bind(&FormulaParserGrammar::createCoalition, phoenix::ref(*this), qi::_a)];
coalitionOperator.name("coalition operator");
// only LRA for now, need to adapt this (beware of cyclic gameFormula pass!)

23
src/storm/logic/Coalition.cpp

@ -1,23 +0,0 @@
#include "storm/logic/Coalition.h"
namespace storm {
namespace logic {
Coalition::Coalition(std::vector<std::string> const& playerNames,
std::vector<uint_fast32_t> const& playerIds) : playerNames(playerNames), playerIds(playerIds) {
// Intentionally left empty.
}
std::ostream& operator<<(std::ostream& stream, Coalition const& coalition) {
stream << "<<";
for (auto const& playerName : coalition.playerNames) {
stream << playerName << ", ";
}
for (auto const& playerId : coalition.playerIds) {
stream << playerId << ", ";
}
stream << ">>";
return stream;
}
}
}

30
src/storm/logic/Coalition.h

@ -1,30 +0,0 @@
#ifndef STORM_LOGIC_COALITION_H_
#define STORM_LOGIC_COALITION_H_
#include <vector>
#include <string>
#include <boost/optional.hpp>
#include "storm/storage/BoostTypes.h"
#include "storm/utility/OsDetection.h"
namespace storm {
namespace logic {
class Coalition {
public:
Coalition() = default;
Coalition(std::vector<std::string> const& playerNames, std::vector<uint_fast32_t> const& playerIds);
Coalition(Coalition const& other) = default;
friend std::ostream& operator<<(std::ostream& stream, Coalition const& coalition);
private:
std::vector<std::string> playerNames;
std::vector<uint_fast32_t> playerIds;
};
}
}
#endif /* STORM_LOGIC_COALITION_H_ */
Loading…
Cancel
Save