ModuleBase.h 993 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef MDD_BASEMODULE_H
  2. #define MDD_BASEMODULE_H
  3. #include "Input.h"
  4. #include "IModule.h"
  5. namespace mdd {
  6. class ModuleBase : public IModule{
  7. private:
  8. std::vector<Input> _inputs;
  9. std::vector<std::shared_ptr<Output>> _outputs;
  10. public:
  11. int addInput(const std::string& type, const json& value,
  12. const std::function<bool(const json&)>& verification = [](
  13. const json&) { return true; });
  14. json& setInputDefaultValue(int handle) override;
  15. const json& getInputValue(int handle) override;
  16. bool connectInput(int handle, std::shared_ptr<IOutput> output) override;
  17. std::vector<std::string> getInputs() override;
  18. std::vector<std::string> getOutputs() override;
  19. std::shared_ptr<IOutput> getOutput(int handle) override;
  20. int addOutput(const std::string& type, const json& initial);
  21. json &setOutputValue(int handle);
  22. };
  23. }
  24. #endif //MDD_BASEMODULE_H