2021-05-07 21:36:26 -04:00
|
|
|
#ifndef POLICY_H
|
|
|
|
#define POLICY_H
|
|
|
|
|
2021-05-15 19:44:19 -04:00
|
|
|
#include <memory>
|
2021-05-07 21:36:26 -04:00
|
|
|
#include <string>
|
|
|
|
|
2021-05-15 19:44:19 -04:00
|
|
|
class Actor;
|
|
|
|
|
2021-05-07 21:36:26 -04:00
|
|
|
class Policy
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit Policy(const std::string& satisfaction, const std::string& dissatisfaction);
|
|
|
|
virtual ~Policy() = 0;
|
|
|
|
|
|
|
|
struct CheckResult
|
|
|
|
{
|
|
|
|
bool satisfied = false;
|
|
|
|
std::string commentary;
|
|
|
|
};
|
|
|
|
|
2021-05-15 19:44:19 -04:00
|
|
|
virtual CheckResult check(const std::shared_ptr<Actor> &actor) const = 0;
|
2021-05-07 21:36:26 -04:00
|
|
|
|
|
|
|
protected:
|
2021-05-15 19:44:19 -04:00
|
|
|
CheckResult composeMessageFromResult(bool result) const;
|
2021-05-07 21:36:26 -04:00
|
|
|
|
|
|
|
std::string _commentary_on_satisfaction;
|
|
|
|
std::string _commentary_on_dissatisfaction;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // POLICY_H
|