C++11 library providing functionality common to all adapters.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.7 KiB

  1. // This file is under GNU General Public License 3.0
  2. // see LICENSE.txt
  3. #ifndef PITYTEST_PITYMODEL_HH
  4. #define PITYTEST_PITYMODEL_HH
  5. #include "../../../src/pEpLog.hh"
  6. #include "PityNode.hh"
  7. #include <vector>
  8. #include <memory>
  9. // The Model currently is as follows:
  10. // The Model creates the TestTree using PityUnits.
  11. // When creating the model you specify how many nodes you want
  12. //
  13. // ATTENTION - TODO:
  14. // Currently there is a strict 1-1 relationship of nodes and identities.
  15. // One Node has exactly one identity, and this identity is only on this node.
  16. // This needs to be enhanced to be a n-n relationship
  17. // The Transport only addresses nodes, not idents, therefore
  18. // If you have one ident on n nodes, the transport needs to check the model for all nodes the
  19. // ident is on and send the message to all these nodes.
  20. // If you have a node that has n identities, the persepective needs to specify node AND ident.
  21. namespace pEp {
  22. namespace PityTest11 {
  23. class PityModel {
  24. public:
  25. // Constructors
  26. PityModel() = delete;
  27. PityModel(const std::string& name, int nodeCount);
  28. // Getters
  29. std::string getName() const;
  30. std::vector<std::shared_ptr<PityNode>> nodes() const;
  31. PityNode* nodeNr(int nr) const;
  32. //internal logging
  33. static bool debug_log_enabled;
  34. Adapter::pEpLog::pEpLogger logger_debug{ "PityModel", debug_log_enabled };
  35. private:
  36. std::vector<std::shared_ptr<PityNode>> _nodes;
  37. std::string _name;
  38. //internal logging
  39. Adapter::pEpLog::pEpLogger& m4gic_logger_n4me = logger_debug;
  40. };
  41. }; // namespace PityTest11
  42. }; // namespace pEp
  43. #endif // PITYTEST_PITYMODEL_HH