ModuleBase.h 892 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef MDD_BASEMODULE_H
  2. #define MDD_BASEMODULE_H
  3. #include <string>
  4. #include <functional>
  5. #include "IModule.h"
  6. #include "Output.h"
  7. #include <bits/shared_ptr.h>
  8. struct Input
  9. {
  10. std::string name;
  11. rapidjson::Value value;
  12. std::function<bool(rapidjson::Value&)> verification;
  13. std::shared_ptr<IOutput> output;
  14. Input(std::string name, rapidjson::Value value, std::function<bool(rapidjson::Value&)> verification = [](rapidjson::Value&){return true;});
  15. };
  16. class ModuleBase : IModule
  17. {
  18. std::vector<Input> inputs;
  19. public:
  20. std::vector<std::string> getInputs();
  21. int addInput(std::string name, rapidjson::Value value, std::function<bool(rapidjson::Value&)> verification = [](rapidjson::Value&){return true;});
  22. bool connectInput(std::string input_name, std::shared_ptr<IOutput> output);
  23. const rapidjson::Value& getValue(int handle);
  24. };
  25. #endif //MDD_BASEMODULE_H