ModuleBase.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef MDD_ModuleBase_H
  2. #define MDD_ModuleBase_H
  3. #include "Input.h"
  4. #include "Output.h"
  5. #include "IModule.h"
  6. namespace mdd {
  7. class ModuleBase : public IModule{
  8. private:
  9. std::string _name = "";
  10. int _appendix = 0;
  11. std::string _base_config = "";
  12. protected:
  13. ModuleBase(const std::string& base_config = "{}");
  14. std::string type = "module";
  15. std::string key;
  16. std::vector<std::shared_ptr<Input>> inputs;
  17. std::vector<std::shared_ptr<Output>> outputs;
  18. public:
  19. bool configure(const std::string& config) { return true; };
  20. std::string getConfiguration() override;
  21. size_t getNumInputs() override;
  22. size_t getNumOutputs() override;
  23. std::shared_ptr<IInput> getInput(size_t index) override;
  24. std::shared_ptr<IInput> getInput(const std::string& id) override;
  25. std::shared_ptr<IOutput> getOutput(size_t index) override;
  26. std::shared_ptr<IOutput> getOutput(const std::string& id) override;
  27. std::vector<std::shared_ptr<IInput>> getOptimizableInputs() override;
  28. std::vector<std::shared_ptr<IOutput>> getOptimizableOutputs() override;
  29. std::string getGeneratorKey() override;
  30. std::string getType() override;
  31. std::string setName(const std::string& name) override;
  32. std::string getName() override;
  33. std::string setAppendix(int appendix) override;
  34. int getAppendix() override;
  35. std::string getID() override;
  36. void load(const json& j) override;
  37. json dump() override;
  38. void disconnect() override;
  39. };
  40. }
  41. #endif //MDD_BASEMODULE_H