Input.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 _name;
  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. protected:
  21. std::string type;
  22. std::string key;
  23. public:
  24. Input(IModule* parent, const std::string &name, int appendix, const std::vector<double>& default_value);
  25. //const std::function<bool(const json &)> &verification = [](const json&) { return true; }
  26. std::string getType() override;
  27. std::string getGeneratorKey() override;
  28. std::string setName(const std::string& name) override;
  29. std::string getName() override;
  30. std::string setAppendix(int appendix) override;
  31. int getAppendix() override;
  32. std::string getID() override;
  33. std::string getParentID() override;
  34. state getState() override;
  35. void resetState() override;
  36. const std::vector<double>& getValue() override;
  37. std::vector<double>& setValue() override;
  38. state setValue(const std::vector<double>& val) override;
  39. bool isOptimizable() override;
  40. void setOptimizability(bool state) override;
  41. const limits& getLimits() override;
  42. limits& setLimits() override;
  43. std::shared_ptr<IOutput> getConnection() override;
  44. //bool verify(const json & data) override;
  45. int addConnection(std::shared_ptr<IOutput> output) override;
  46. int removeConnection(std::shared_ptr<IOutput> output) override;
  47. bool connect(std::shared_ptr<IOutput> output) override;
  48. void disconnect() override;
  49. bool configure(const std::string& config) override;
  50. std::string getConfiguration() override;
  51. void load(const json& j) override;
  52. json dump() override;
  53. };
  54. }
  55. #endif //MDD_INPUT_H