Input.h 1.2 KB

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