Input.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef MDD_INPUT_H
  2. #define MDD_INPUT_H
  3. #include <string>
  4. #include <functional>
  5. #include "Output.h"
  6. #include <memory>
  7. #include "IUnique.h"
  8. namespace mdd {
  9. class Input : public IInput{
  10. private:
  11. std::string _prefix;
  12. std::string _type;
  13. int _appendix;
  14. json _value;
  15. std::function<bool(const json &)> _verification;
  16. std::shared_ptr <IOutput> _output;
  17. public:
  18. Input(const std::string &type, int appendix, const json &default_value,
  19. const std::function<bool(const json &)> &verification = [](
  20. const json &) { return true; });
  21. std::string setType(std::string type) override;
  22. std::string getType() override;
  23. std::string getID() override;
  24. std::string setPrefix(std::string prefix) override;
  25. std::string setAppendix(int appendix) override;
  26. const json& getValue() override;
  27. json& setDefaultValue() override;
  28. bool verify(const json & data) override;
  29. bool connect(std::shared_ptr<IOutput> output) override;
  30. };
  31. }
  32. #endif //MDD_INPUT_H