ProcessorBase.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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
  10. : public IProcessor
  11. {
  12. private:
  13. std::weak_ptr<IModule> _parent;
  14. int _appendix = 0;
  15. unsigned int module_counter = 0;
  16. unsigned int input_counter = 0;
  17. unsigned int output_counter = 0;
  18. protected:
  19. json _base_config;
  20. ProcessorBase(const std::string& base_config);
  21. const std::string type = "processor";
  22. std::string key;
  23. std::vector<std::shared_ptr<Input>>processor_inputs;
  24. std::vector<std::shared_ptr<Output>> processor_outputs;
  25. std::vector<std::shared_ptr<IModule>> modules;
  26. std::vector<std::shared_ptr<Parameter>> inputs;
  27. std::vector<std::shared_ptr<Parameter>> outputs;
  28. bool configureChild(const json& config) override;
  29. public:
  30. bool configure(const json& config) override;
  31. const json& getConfiguration() override;
  32. void setParent(std::shared_ptr<IModule> parent) override;
  33. std::vector<std::string> getParentID() override;
  34. std::string getGeneratorKey() override;
  35. std::string getType() override;
  36. std::string setAppendix(int appendix) override;
  37. int getAppendix() override;
  38. std::string getID() override;
  39. std::string addModule(std::shared_ptr<IModule> module) override ;
  40. void removeModule(std::shared_ptr<IModule> module) override;
  41. json addInput(std::shared_ptr<IInput> input) override;
  42. json removeInput(std::shared_ptr<IInput> input) override;
  43. json addOutput(std::shared_ptr<IOutput> output) override;
  44. json removeOutput(std::shared_ptr<IOutput> output) override;
  45. std::vector<std::shared_ptr<Parameter>>& getInputParams() override;
  46. std::vector<std::shared_ptr<Parameter>>& getOutputParams() override;
  47. size_t getNumInputs() override;
  48. size_t getNumOutputs() override;
  49. std::shared_ptr<IInput> getInput(const json& jid) override;
  50. std::shared_ptr<IInput> getInput(size_t index) override;
  51. std::shared_ptr<IOutput> getOutput(const json& jid) override;
  52. std::shared_ptr<IOutput> getOutput(size_t index) override;
  53. std::vector<std::shared_ptr<IInput>> getOptimizableInputs() override;
  54. std::vector<std::shared_ptr<IOutput>> getOptimizableOutputs() override;
  55. std::vector<std::shared_ptr<IModule >>& getModules();
  56. size_t getNumModuls() override;
  57. std::shared_ptr<IModule> getModule(size_t index) override;
  58. std::shared_ptr<IModule> getModule(const json& jid) override;
  59. bool connect(const std::string& output_id, const std::vector<std::string>& input_ids);
  60. void disconnect() override;
  61. void load(const json& j) override;
  62. json dump() override;
  63. json getIdentifier() override;
  64. state update() override { return state::UNCHANGED; };
  65. };
  66. }
  67. //*/