Browse Source

store name index map for player member

main
Stefan Pranger 5 years ago
parent
commit
43353d5243
  1. 26
      src/storm/storage/prism/Player.cpp
  2. 10
      src/storm/storage/prism/Player.h

26
src/storm/storage/prism/Player.cpp

@ -2,7 +2,7 @@
namespace storm { namespace storm {
namespace prism { namespace prism {
Player::Player(std::string const& playerName, std::vector<storm::prism::Module> const& controlledModules, std::vector<storm::prism::Command> const& controlledCommands, std::string const& filename, uint_fast64_t lineNumber) : LocatedInformation(filename, lineNumber), playerName(playerName), controlledModules(controlledModules), controlledCommands(controlledCommands) {
Player::Player(std::string const& playerName, std::map<std::string, uint_fast64_t> const& controlledModules, std::map<std::string, uint_fast64_t> const& controlledCommands, std::string const& filename, uint_fast64_t lineNumber) : LocatedInformation(filename, lineNumber), playerName(playerName), controlledModules(controlledModules), controlledCommands(controlledCommands) {
// Nothing to do here. // Nothing to do here.
} }
@ -10,11 +10,11 @@ namespace storm {
return this->playerName; return this->playerName;
} }
std::vector<storm::prism::Module> const& Player::getModules() const {
std::map<std::string, uint_fast64_t> const& Player::getModules() const {
return this->controlledModules; return this->controlledModules;
} }
std::vector<storm::prism::Command> const& Player::getCommands() const {
std::map<std::string, uint_fast64_t> const& Player::getCommands() const {
return this->controlledCommands; return this->controlledCommands;
} }
@ -24,16 +24,16 @@ namespace storm {
stream << " " << player.getName(); stream << " " << player.getName();
} }
stream << std::endl; stream << std::endl;
for (auto const& module : player.getModules()) {
stream << module.getName() << " ";
//&module != (player.getModules()).back ? std::cout << "," : std::cout << std::endl;
}
stream << std::endl;
for (auto const& command : player.getCommands()) {
stream << "[" << command.getActionName() << "] ";
//&command != (player.getCommands()).back ? std::cout << "," : std::cout << std::endl;
}
stream << std::endl;
//for (auto const& module : player.getModules()) {
// stream << module.getName() << " ";
// //&module != (player.getModules()).back ? std::cout << "," : std::cout << std::endl;
//}
//stream << std::endl;
//for (auto const& command : player.getCommands()) {
// stream << "[" << command.getActionName() << "] ";
// //&command != (player.getCommands()).back ? std::cout << "," : std::cout << std::endl;
//}
//stream << std::endl;
stream << "endplayer" << std::endl; stream << "endplayer" << std::endl;
return stream; return stream;
} }

10
src/storm/storage/prism/Player.h

@ -24,7 +24,7 @@ namespace storm {
* @param filename The filename in which the player is defined. * @param filename The filename in which the player is defined.
* @param lineNumber The line number in which the player is defined. * @param lineNumber The line number in which the player is defined.
*/ */
Player(std::string const& playerName, std::vector<storm::prism::Module> const& controlledModules, std::vector<storm::prism::Command> const& controlledCommands, std::string const& filename = "", uint_fast64_t lineNumber = 0);
Player(std::string const& playerName, std::map<std::string, uint_fast64_t> const& controlledModules, std::map<std::string, uint_fast64_t> const& controlledCommands, std::string const& filename = "", uint_fast64_t lineNumber = 0);
// Create default implementations of constructors/assignment. // Create default implementations of constructors/assignment.
Player() = default; Player() = default;
@ -45,14 +45,14 @@ namespace storm {
* *
* @return The modules controlled by the player. * @return The modules controlled by the player.
*/ */
std::vector<storm::prism::Module> const& getModules() const;
std::map<std::string, uint_fast64_t> const& getModules() const; // TODO
/*! /*!
* Retrieves all controlled Commands of the player. * Retrieves all controlled Commands of the player.
* *
* @return The commands controlled by the player. * @return The commands controlled by the player.
*/ */
std::vector<storm::prism::Command> const& getCommands() const;
std::map<std::string, uint_fast64_t> const& getCommands() const;
friend std::ostream& operator<<(std::ostream& stream, Player const& player); friend std::ostream& operator<<(std::ostream& stream, Player const& player);
private: private:
@ -60,10 +60,10 @@ namespace storm {
std::string playerName; std::string playerName;
// The modules associated with this player. // The modules associated with this player.
std::vector<storm::prism::Module> controlledModules;
std::map<std::string, uint_fast64_t> controlledModules;
// The commands associated with this player. // The commands associated with this player.
std::vector<storm::prism::Command> controlledCommands;
std::map<std::string, uint_fast64_t> controlledCommands;
}; };
} // namespace prism } // namespace prism

Loading…
Cancel
Save