ProcessorBase.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef MDD_PROCESSORBASE_H
  2. #define MDD_PROCESSORBASE_H
  3. #include <list>
  4. #include "Input.h"
  5. #include "Output.h"
  6. #include "IProcessor.h"
  7. #include "Registration.h"
  8. namespace mdd {
  9. class Registration;
  10. class ProcessorBase : public IProcessor{
  11. private:
  12. std::string _type = "";
  13. int _appendix = 0;
  14. std::string _base_config = "";
  15. protected:
  16. ProcessorBase(const std::string& base_config);
  17. std::vector<std::shared_ptr<Input>>processor_inputs;
  18. std::vector<std::shared_ptr<Output>> processor_outputs;
  19. std::vector<std::shared_ptr<IModule>> modules;
  20. std::vector<std::shared_ptr<ModuleParameter>> inputs;
  21. std::vector<std::shared_ptr<ModuleParameter>> outputs;
  22. public:
  23. bool configure(const std::string& config) { return true; };
  24. std::string getBaseConfiguration() override;
  25. std::string getID() override ;
  26. std::string setType(const std::string& type) override;
  27. std::string getType() override;
  28. std::string setAppendix(int appendix) override;
  29. int getAppendix() override;
  30. std::string addModule(std::shared_ptr<IModule> module) override ;
  31. void removeModule(std::shared_ptr<IModule> module) override;
  32. std::vector<std::shared_ptr<ModuleParameter>>& getInputParams() override;
  33. std::vector<std::shared_ptr<ModuleParameter>>& getOutputParams() override;
  34. size_t getNumInputs() override;
  35. size_t getNumOutputs() override;
  36. std::shared_ptr<IInput> getInput(const std::string& id) override;
  37. std::shared_ptr<IInput> getInput(size_t index) override;
  38. std::shared_ptr<IOutput> getOutput(const std::string& id) override;
  39. std::shared_ptr<IOutput> getOutput(size_t index) override;
  40. std::vector<std::shared_ptr<IModule >>& getModules();
  41. size_t getNumModuls() override;
  42. std::shared_ptr<IModule> getModule(size_t index) override;
  43. std::shared_ptr<IModule> getModule(const std::string& id) override;
  44. bool connect(const std::string& output_id, const std::vector<std::string>& input_ids);
  45. void disconnect() override;
  46. void load(const json& j) override;
  47. json dump() override;
  48. };
  49. }
  50. #endif