This commit is contained in:
Сергей Маринкевич
2025-08-05 19:30:21 +07:00
parent f46e1a6d0b
commit d00bb90a38
11 changed files with 96 additions and 43 deletions
+2 -3
View File
@@ -1,5 +1,4 @@
#pragma once
#include <iostream>
#include "ifaces/INode.h"
#include "Logger.h"
@@ -9,12 +8,12 @@
class BaseNode : public virtual INode {
public:
BaseNode(std::string name) : name_(std::move(name)) {
Logger::get("Node").dbg(std::string("--- Base constructor called for: ") + name_);
Logger::get("ConDes").dbg(std::string("--- Base constructor called for: ") + name_);
}
const std::string& name() const override { return name_; }
const std::string& kind() const override { return kind_; }
~BaseNode() {
Logger::get("Node").dbg(std::string("--- Base destructor called for: ") + name_);
Logger::get("ConDes").info(std::string("--- Base destructor called for: ") + name_);
}
protected:
std::string name_;
+8 -5
View File
@@ -1,19 +1,22 @@
#pragma once
#include <iostream>
#include "nodes/BaseNode.h"
#include "mixins/HierarchicalLinkMixin.h"
#include "mixins/FabricMixin.h"
#include "Logger.h"
/// \brief Класс сложного (составного) узла дерева.
/// Может содержать несколько дочерних ComplexNode и один SimpleNode.
/// Может содержать несколько дочерних ComplexNode или один SimpleNode.
class ComplexNode : public BaseNode,
virtual public HierarchicalLinkMixin<INode> {
virtual public HierarchicalLinkMixin<INode>,
public FabricMixin<ComplexNode> {
public:
~ComplexNode() {
Logger::get("Node").dbg(std::string("--- Complex destructor called for: ") + name_);
Logger::get("ConDes").dbg(std::string("--- Complex destructor called for: ") + name_);
}
private:
friend class FabricMixin<ComplexNode>;
ComplexNode(std::string name) : BaseNode(std::move(name)) {
Logger::get("Node").dbg(std::string("--- Complex constructor called for: ") + name_);
Logger::get("ConDes").dbg(std::string("--- Complex constructor called for: ") + name_);
}
};
+7 -4
View File
@@ -1,20 +1,23 @@
#pragma once
#include <iostream>
#include "nodes/BaseNode.h"
#include "mixins/LazyLinkMixin.h"
#include "mixins/FabricMixin.h"
#include "links/OneToOneLink.h"
#include "Logger.h"
/// \brief Класс простого (листового) узла дерева.
/// Может содержать только одного дочернего ComplexNode.
class SimpleNode : public BaseNode,
virtual public LazyLinkMixin<OneToOneLink<INode>> {
virtual public LazyLinkMixin<OneToOneLink<INode>>,
public FabricMixin<SimpleNode> {
public:
~SimpleNode() {
Logger::get("Node").dbg(std::string("--- Simple destructor called for: ") + name_);
Logger::get("ConDes").dbg(std::string("--- Simple destructor called for: ") + name_);
}
private:
friend class FabricMixin<SimpleNode>;
SimpleNode(std::string name) : BaseNode(std::move(name)) {
Logger::get("Node").dbg(std::string("--- Simple constructor called for: ") + name_);
Logger::get("ConDes").dbg(std::string("--- Simple constructor called for: ") + name_);
}
};