From 1e501538096e648f4206da1352036919e44353d0 Mon Sep 17 00:00:00 2001 From: heck Date: Mon, 7 Jun 2021 23:53:09 +0200 Subject: [PATCH] Tests: PityNode - first shot --- test/pitytest11/src/PityNode.cc | 42 +++++++++++++++++++++++++++++++++ test/pitytest11/src/PityNode.hh | 39 ++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 test/pitytest11/src/PityNode.cc create mode 100644 test/pitytest11/src/PityNode.hh diff --git a/test/pitytest11/src/PityNode.cc b/test/pitytest11/src/PityNode.cc new file mode 100644 index 0000000..d9e0fb1 --- /dev/null +++ b/test/pitytest11/src/PityNode.cc @@ -0,0 +1,42 @@ +#include "PityModel.hh" +#include "PityNode.hh" +#include "PityUnit.hh" +#include "iostream" +#include + +namespace pEp { + namespace PityTest11 { + bool PityNode::debug_log_enabled = false; + + PityNode::PityNode(PityModel& model, int nodeNr) : + _model{ model }, _node_nr{ nodeNr }, _process_unit{ + std::make_shared>( + &(_model.rootUnit()), + getName(), + nullptr, + nullptr, + PityUnit::ExecutionMode::PROCESS_PARALLEL) + } + { + } + + std::string PityNode::getName() const + { + std::string ret{}; + ret += "node_" + std::to_string(_node_nr); + return ret; + } + + std::string PityNode::to_string() const + { + std::string ret{}; + ret += "node_" + std::to_string(_node_nr); + return ret; + } + + const std::shared_ptr>& PityNode::getProcessUnit() const + { + return _process_unit; + } + } // namespace PityTest11 +} // namespace pEp diff --git a/test/pitytest11/src/PityNode.hh b/test/pitytest11/src/PityNode.hh new file mode 100644 index 0000000..f349cf3 --- /dev/null +++ b/test/pitytest11/src/PityNode.hh @@ -0,0 +1,39 @@ +// This file is under GNU General Public License 3.0 +// see LICENSE.txt + +#ifndef PITYTEST_PITYNODE_HH +#define PITYTEST_PITYNODE_HH + +#include "../../../src/pEpLog.hh" +#include "PityUnit.hh" +#include "PityModel.hh" + +namespace pEp { + namespace PityTest11 { + class PityModel; + class PityNode { + public: + PityNode() = delete; + explicit PityNode(PityModel& model, int nodeNr); + std::string getName() const; + std::string to_string() const; + + //internal logging + static bool debug_log_enabled; + Adapter::pEpLog::pEpLogger logger_debug{ "PityNode", debug_log_enabled }; + private: + const int _node_nr; + PityModel& _model; + std::shared_ptr> _process_unit; + + public: + const std::shared_ptr>& getProcessUnit() const; + + private: + //internal logging + Adapter::pEpLog::pEpLogger& m4gic_logger_n4me = logger_debug; + }; + }; // namespace PityTest11 +}; // namespace pEp + +#endif // PITYTEST_PITYNODE_HH