Input.h 2.3 KB

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