Input.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef MDD_INPUT_H
  2. #define MDD_INPUT_H
  3. #include <string>
  4. #include <functional>
  5. #include "IInput.h"
  6. #include "IModule.h"
  7. #include <memory>
  8. #include "IUnique.h"
  9. namespace mdd {
  10. class Input : public IInput{
  11. private:
  12. std::string _type;
  13. int _appendix;
  14. IModule* _parent;
  15. std::vector<double> _value;
  16. //std::function<bool(const json &)> _verification;
  17. std::shared_ptr <IOutput> _output;
  18. bool _optimizable;
  19. limits _limit;//make shared_ptr!!!
  20. public:
  21. Input(IModule* parent, const std::string &type, int appendix, const std::vector<double>& default_value);
  22. //const std::function<bool(const json &)> &verification = [](const json&) { return true; }
  23. std::string setType(const std::string& type) override;
  24. std::string getType() override;
  25. std::string getID() override;
  26. std::string setAppendix(int appendix) override;
  27. int getAppendix() override;
  28. std::string getParentID() override;
  29. state getState() override;
  30. void resetState() override;
  31. const std::vector<double>& getValue() override;
  32. std::vector<double>& setValue() override;
  33. state setValue(const std::vector<double>& val) override;
  34. bool isOptimizable() override;
  35. void setOptimizability(bool state) override;
  36. const limits& getLimits() override;
  37. limits& setLimits() override;
  38. std::shared_ptr<IOutput> getConnection() override;
  39. //bool verify(const json & data) override;
  40. int addConnection(std::shared_ptr<IOutput> output) override;
  41. int removeConnection(std::shared_ptr<IOutput> output) override;
  42. bool connect(std::shared_ptr<IOutput> output) override;
  43. void disconnect() override;
  44. };
  45. }
  46. #endif //MDD_INPUT_H