ModuleBase.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef MDD_ModuleBase_H
  2. #define MDD_ModuleBase_H
  3. #include "Input.h"
  4. #include "IModule.h"
  5. namespace mdd {
  6. class ModuleBase : public IModule{
  7. private:
  8. std::string _prefix;
  9. std::string _type;
  10. int _appendix;
  11. std::vector<Input> _inputs;
  12. std::vector<std::shared_ptr<Output>> _outputs;
  13. public:
  14. std::string addInput(const std::string& type, int appendix, const json& value,
  15. const std::function<bool(const json&)>& verification = [](
  16. const json&) { return true; });
  17. json& setInputDefaultValue(int handler) override;
  18. json& setInputDefaultValue(std::string input_id) override;
  19. const json& getInputValue(std::string input_id) override;
  20. bool connectInput(std::string input_id, std::shared_ptr<IOutput> output) override;
  21. std::vector<std::string> getInputs() override;
  22. std::vector<std::string> getInputIDs() override;
  23. std::vector<std::string> getOutputs() override;
  24. std::vector<std::string> getOutputIDs() override;
  25. std::shared_ptr<IOutput> getOutput(std::string output_id) override;
  26. std::string addOutput(const std::string& type, int appendix, const json& initial);
  27. json &setOutputValue(int handle);
  28. void setType(std::string type) override;
  29. std::string getType() override;
  30. std::string getID() override;
  31. std::string setPrefix(std::string prefix) override;
  32. std::string setAppendix(int appendix) override;
  33. };
  34. }
  35. #endif //MDD_BASEMODULE_H