Tests: PityNode - first shot

LIB-11
heck 2 years ago
parent c6f377fc2b
commit 1e50153809

@ -0,0 +1,42 @@
#include "PityModel.hh"
#include "PityNode.hh"
#include "PityUnit.hh"
#include "iostream"
#include <memory>
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<PityUnit<PityModel>>(
&(_model.rootUnit()),
getName(),
nullptr,
nullptr,
PityUnit<PityModel>::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<PityUnit<PityModel>>& PityNode::getProcessUnit() const
{
return _process_unit;
}
} // namespace PityTest11
} // namespace pEp

@ -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<PityUnit<PityModel>> _process_unit;
public:
const std::shared_ptr<PityUnit<PityModel>>& getProcessUnit() const;
private:
//internal logging
Adapter::pEpLog::pEpLogger& m4gic_logger_n4me = logger_debug;
};
}; // namespace PityTest11
}; // namespace pEp
#endif // PITYTEST_PITYNODE_HH
Loading…
Cancel
Save