Connector.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #pragma once
  2. #include "memory"
  3. #include "json.hpp"
  4. #include <filesystem>
  5. #include <iostream>
  6. #include <iomanip>
  7. #include <fstream>
  8. #include "Input.h"
  9. #include "Output.h"
  10. #include <Registration.h>
  11. #include <ProcessorStandard.h>
  12. namespace mdd {
  13. class Connector {
  14. private:
  15. Registration regi = Registration();
  16. IProcessor::Ptr _root;
  17. IOptimizer::Ptr _opt;
  18. const std::map<const std::string, std::function<json(const json&)>> _ops = {//const std::map<const std::string, const json& (Connector::*)(const json&)> _ops = {
  19. {"add", std::bind(&Connector::add,this,std::placeholders::_1) },
  20. {"change", std::bind(&Connector::change,this,std::placeholders::_1)},
  21. {"load", std::bind(&Connector::load,this,std::placeholders::_1)},
  22. {"remove", std::bind(&Connector::remove,this,std::placeholders::_1)},
  23. {"save", std::bind(&Connector::save,this,std::placeholders::_1)},
  24. {"state", std::bind(&Connector::state,this,std::placeholders::_1)}
  25. };
  26. std::function <json(const json&)> _callback;
  27. /**
  28. *subject
  29. *object
  30. **/
  31. //refernece funktioniert nicht!????
  32. json add(const json& args);
  33. /**
  34. *subject
  35. *object
  36. **/
  37. json remove(const json& args);
  38. /**
  39. *subject
  40. *object
  41. **/
  42. json change(const json& args);
  43. /**
  44. *subject
  45. *object
  46. **/
  47. json state(const json& args);
  48. json save(const json& args);
  49. json load(const json& args);
  50. json optimizerCallback(const json& callback);
  51. public:
  52. Connector();
  53. json decode(const json& request);
  54. json encode();
  55. void attachCallback(std::function<json(const json&)> callback);
  56. };
  57. }