Browse Source

init Player class for SMG parsing

tempestpy_adaptions
Stefan Pranger 4 years ago
parent
commit
bf54ca8a52
  1. 40
      src/storm/storage/prism/Player.cpp
  2. 72
      src/storm/storage/prism/Player.h

40
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<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) {
// Nothing to do here.
}
std::string const& Player::getName() const {
return this->playerName;
}
std::vector<storm::prism::Module> const& Player::getModules() const {
return this->controlledModules;
}
std::vector<storm::prism::Command> 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

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

@ -0,0 +1,72 @@
#ifndef STORM_STORAGE_PRISM_PLAYER_H_
#define STORM_STORAGE_PRISM_PLAYER_H_
#include <string>
#include <vector>
#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<storm::prism::Module> const& controlledModules, std::vector<storm::prism::Command> 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<storm::prism::Module> const& getModules() const;
/*!
* Retrieves all controlled Commands of the player.
*
* @return The commands controlled by the player.
*/
std::vector<storm::prism::Command> 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<storm::prism::Module> controlledModules;
// The commands associated with this player.
std::vector<storm::prism::Command> controlledCommands;
};
} // namespace prism
} // namespace storm
#endif /* STORM_STORAGE_PRISM_PLAYER_H_ */
Loading…
Cancel
Save