From b6ff5b79f94ad62f9358ab2946e985bba11a17c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=9C=D0=B0=D1=80?= =?UTF-8?q?=D0=B8=D0=BD=D0=BA=D0=B5=D0=B2=D0=B8=D1=87?= Date: Wed, 8 Oct 2025 17:39:31 +0700 Subject: [PATCH] =?UTF-8?q?qosd:=20=D0=BF=D1=80=D0=BE=D0=BA=D0=B8=D0=BD?= =?UTF-8?q?=D1=83=D1=82=20kind=20=D0=B4=D0=BE=20BaseNode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь конкретные узлы не сами устанавливают себе `kind_`, а делают это через `BaseNode` — единую точку входа. --- include/nodes/BaseNode.h | 3 ++- include/nodes/ComplexNode.h | 3 ++- include/nodes/HTBNode.h | 6 ++---- include/nodes/LeafNode.h | 4 ++-- include/nodes/SFQNode.h | 8 +++----- include/nodes/WREDNode.h | 8 +++----- 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/include/nodes/BaseNode.h b/include/nodes/BaseNode.h index f2af8f3..f430074 100644 --- a/include/nodes/BaseNode.h +++ b/include/nodes/BaseNode.h @@ -9,7 +9,8 @@ class BaseNode : public virtual INode { public: /// \brief Конструктор узла. /// \param name Неуникальное имя узла. - BaseNode(std::string name) : name_(std::move(name)) { + BaseNode(std::string name, std::string kind) : + name_(std::move(name)), kind_(std::move(kind)) { Logger::get("ConDes").dbg(std::string("--- Base constructor called for: ") + name_); } /// \brief Неуникальное имя узла. diff --git a/include/nodes/ComplexNode.h b/include/nodes/ComplexNode.h index 06dd4ef..c5e68eb 100644 --- a/include/nodes/ComplexNode.h +++ b/include/nodes/ComplexNode.h @@ -14,7 +14,8 @@ public: Logger::get("ConDes").dbg(std::string("--- Complex destructor called for: ") + name_); } protected: - ComplexNode(std::string name) : BaseNode(std::move(name)) { + ComplexNode(std::string name, std::string kind) : + BaseNode(std::move(name), std::move(kind)) { Logger::get("ConDes").dbg(std::string("--- Complex constructor called for: ") + name_); } }; diff --git a/include/nodes/HTBNode.h b/include/nodes/HTBNode.h index fc0ea1a..8a7e569 100644 --- a/include/nodes/HTBNode.h +++ b/include/nodes/HTBNode.h @@ -27,14 +27,12 @@ public: const Config& config() const { return config_; } private: friend class FabricMixin; - HTBNode(std::string&& name) : ComplexNode(std::move(name)) { - kind_ = "HTB"; + HTBNode(std::string&& name) : ComplexNode(std::move(name), "HTB") { Logger::get("ConDes").dbg(std::string("--- HTB constructor called for: ") + name_); } - HTBNode(std::string&& name, Config&& config) : ComplexNode(std::move(name)), + HTBNode(std::string&& name, Config&& config) : ComplexNode(std::move(name), "HTB"), config_(std::move(config)) { - kind_ = "HTB"; Logger::get("ConDes").dbg(std::string("--- HTB constructor called for: ") + name_); } diff --git a/include/nodes/LeafNode.h b/include/nodes/LeafNode.h index 62cb51c..fce80d5 100644 --- a/include/nodes/LeafNode.h +++ b/include/nodes/LeafNode.h @@ -15,8 +15,8 @@ public: Logger::get("ConDes").dbg(std::string("--- Leaf destructor called for: ") + name_); } protected: - LeafNode(std::string name, std::string kind) : BaseNode(std::move(name)) { - kind_ = std::move(kind); + LeafNode(std::string name, std::string kind) : + BaseNode(std::move(name), std::move(kind)) { Logger::get("ConDes").dbg(std::string("--- Leaf constructor called for: ") + name_ + ", kind=" + kind_); } }; diff --git a/include/nodes/SFQNode.h b/include/nodes/SFQNode.h index ae2ceda..c7e4ca0 100644 --- a/include/nodes/SFQNode.h +++ b/include/nodes/SFQNode.h @@ -31,14 +31,12 @@ public: const Config& config() const { return config_; } private: friend class FabricMixin; - SFQNode(std::string&& name) : BaseNode(std::move(name)) { - kind_ = "SFQ"; + SFQNode(std::string&& name) : BaseNode(std::move(name), "SFQ") { Logger::get("ConDes").dbg(std::string("--- SFQ constructor called for: ") + name_); } - SFQNode(std::string&& name, Config&& config) - : BaseNode(std::move(name)), config_(std::move(config)) { - kind_ = "SFQ"; + SFQNode(std::string&& name, Config&& config) : BaseNode(std::move(name), "SFQ"), + config_(std::move(config)) { Logger::get("ConDes").dbg(std::string("--- SFQ constructor called for: ") + name_); } diff --git a/include/nodes/WREDNode.h b/include/nodes/WREDNode.h index d608a00..c773d5d 100644 --- a/include/nodes/WREDNode.h +++ b/include/nodes/WREDNode.h @@ -29,14 +29,12 @@ public: const Config& config() const { return config_; } private: friend class FabricMixin; - WREDNode(std::string&& name) : BaseNode(std::move(name)) { - kind_ = "WRED"; + WREDNode(std::string&& name) : BaseNode(std::move(name), "WRED") { Logger::get("ConDes").dbg(std::string("--- WRED constructor called for: ") + name_); } - WREDNode(std::string&& name, Config&& config) - : BaseNode(std::move(name)), config_(std::move(config)) { - kind_ = "WRED"; + WREDNode(std::string&& name, Config&& config) : BaseNode(std::move(name), "WRED"), + config_(std::move(config)) { Logger::get("ConDes").dbg(std::string("--- WRED constructor called for: ") + name_); }