ProcessorBase.h 2.4 KB

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