diff --git a/src/storm/storage/prism/Player.cpp b/src/storm/storage/prism/Player.cpp new file mode 100644 index 000000000..845c45dc5 --- /dev/null +++ b/src/storm/storage/prism/Player.cpp @@ -0,0 +1,40 @@ +#include "storm/storage/prism/Player.h" + +namespace storm { + namespace prism { + Player::Player(std::string const& playerName, std::vector const& controlledModules, std::vector const& controlledCommands, std::string const& filename, uint_fast64_t lineNumber) : LocatedInformation(filename, lineNumber), playerName(playerName), controlledModules(controlledModules), controlledCommands(controlledCommands) { + // Nothing to do here. + } + + std::string const& Player::getName() const { + return this->playerName; + } + + std::vector const& Player::getModules() const { + return this->controlledModules; + } + + std::vector const& Player::getCommands() const { + return this->controlledCommands; + } + + std::ostream& operator<<(std::ostream& stream, Player const& player) { + stream << "player"; + if (player.getName() != "") { + stream << " \"" << player.getName() << "\""; + } + 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 << "player" << std::endl; + return stream; + } + } // namespace prism +} // namespace storm diff --git a/src/storm/storage/prism/Player.h b/src/storm/storage/prism/Player.h new file mode 100644 index 000000000..ee4689417 --- /dev/null +++ b/src/storm/storage/prism/Player.h @@ -0,0 +1,72 @@ +#ifndef STORM_STORAGE_PRISM_PLAYER_H_ +#define STORM_STORAGE_PRISM_PLAYER_H_ + +#include +#include + +#include "storm/storage/prism/Module.h" +#include "storm/storage/prism/Command.h" + +// needed? +#include "storm/storage/BoostTypes.h" +#include "storm/utility/OsDetection.h" + +namespace storm { + namespace prism { + class Player : public LocatedInformation { + public: + /*! + * Creates a player with the given name, controlled modules and actions. + * + * @param playerName The name of the player. + * @param controlledModules The controlled modules. + * @param controlledCommands The controlled actions. + * @param filename The filename in which the player is defined. + * @param lineNumber The line number in which the player is defined. + */ + Player(std::string const& playerName, std::vector const& controlledModules, std::vector const& controlledCommands, std::string const& filename = "", uint_fast64_t lineNumber = 0); + + // Create default implementations of constructors/assignment. + Player() = default; + Player(Player const& other) = default; + Player& operator=(Player const& other) = default; + Player(Player&& other) = default; + Player& operator=(Player&& other) = default; + + /*! + * Retrieves the name of the player. + * + * @return The name of the player. + */ + std::string const& getName() const; + + /*! + * Retrieves all controlled Modules of the player. + * + * @return The modules controlled by the player. + */ + std::vector const& getModules() const; + + /*! + * Retrieves all controlled Commands of the player. + * + * @return The commands controlled by the player. + */ + std::vector const& getCommands() const; + + friend std::ostream& operator<<(std::ostream& stream, Player const& player); + private: + // The name of the player. + std::string playerName; + + // The modules associated with this player. + std::vector controlledModules; + + // The commands associated with this player. + std::vector controlledCommands; + }; + + } // namespace prism +} // namespace storm + +#endif /* STORM_STORAGE_PRISM_PLAYER_H_ */