ProcessorBase.h 2.8 KB

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