Input.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. protected:
  19. public:
  20. Input(const std::string &type, int appendix, const json &default_value,
  21. const std::function<bool(const json &)> &verification = [](
  22. const json &) { return true; });
  23. std::string setType(std::string type) override;
  24. std::string getType() override;
  25. std::string getID() override;
  26. std::string setPrefix(std::string prefix) override;
  27. std::string setAppendix(int appendix) override;
  28. state getState() override;
  29. void resetState() override;
  30. const json& getValue() override;
  31. std::shared_ptr<IOutput> getConnection() override;
  32. json& setDefaultValue() override;
  33. bool verify(const json & data) override;
  34. int addConnection(std::shared_ptr<IOutput> output) override;
  35. int removeConnection(std::shared_ptr<IOutput> output) override;
  36. bool connect(std::shared_ptr<IOutput> output) override;
  37. };
  38. }
  39. #endif //MDD_INPUT_H