From a498d4e7255db52dc18ce277147a33eef6cdb4e6 Mon Sep 17 00:00:00 2001 From: fasiondog Date: Thu, 26 Oct 2023 02:18:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E9=80=9F=E7=BB=84=E5=90=88=E6=8C=87?= =?UTF-8?q?=E6=A0=87=E8=AE=A1=E7=AE=97(continue)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hikyuu_cpp/hikyuu/indicator/IndicatorImp.cpp | 27 ++++++++++++++++++++ hikyuu_cpp/hikyuu/indicator/IndicatorImp.h | 2 ++ 2 files changed, 29 insertions(+) diff --git a/hikyuu_cpp/hikyuu/indicator/IndicatorImp.cpp b/hikyuu_cpp/hikyuu/indicator/IndicatorImp.cpp index 8489535a..4a87d392 100644 --- a/hikyuu_cpp/hikyuu/indicator/IndicatorImp.cpp +++ b/hikyuu_cpp/hikyuu/indicator/IndicatorImp.cpp @@ -1476,4 +1476,31 @@ bool IndicatorImp::alike(const IndicatorImp &other) const { return true; } +std::list IndicatorImp::getAllSubNodes() const { + std::list result; + if (m_left) { + result.push_back(m_left); + auto sub_nodes = m_left->getAllSubNodes(); + result.splice(result.end(), sub_nodes); + } + if (m_right) { + result.push_back(m_right); + auto sub_nodes = m_right->getAllSubNodes(); + result.splice(result.end(), sub_nodes); + } + if (m_three) { + result.push_back(m_three); + auto sub_nodes = m_three->getAllSubNodes(); + result.splice(result.end(), sub_nodes); + } + for (auto iter = m_ind_params.begin(); iter != m_ind_params.end(); ++iter) { + if (iter->second) { + result.push_back(iter->second); + auto sub_nodes = iter->second->getAllSubNodes(); + result.splice(result.end(), sub_nodes); + } + } + return result; +} + } /* namespace hku */ diff --git a/hikyuu_cpp/hikyuu/indicator/IndicatorImp.h b/hikyuu_cpp/hikyuu/indicator/IndicatorImp.h index 8a78dd4a..7a201b2b 100644 --- a/hikyuu_cpp/hikyuu/indicator/IndicatorImp.h +++ b/hikyuu_cpp/hikyuu/indicator/IndicatorImp.h @@ -218,6 +218,8 @@ private: void execute_if(); void execute_corr(); + std::list getAllSubNodes() const; + protected: static size_t _get_step_start(size_t pos, size_t step, size_t discard);