From 2a7b0102b51e413ead82b3643b6eb68a16273a91 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Wed, 26 Jun 2019 19:00:32 +0900 Subject: [PATCH] [hermes] Use generic Config on reload (#3985) Source now has a default "reload" method implementation which uses generic configure method. Signed-off-by: Jonghyun Park --- contrib/hermes/include/hermes/core/Config.h | 8 ++++++++ contrib/hermes/include/hermes/core/Source.h | 4 +++- contrib/hermes/src/core/Source.cpp | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/contrib/hermes/include/hermes/core/Config.h b/contrib/hermes/include/hermes/core/Config.h index 49042dd..d937a36 100644 --- a/contrib/hermes/include/hermes/core/Config.h +++ b/contrib/hermes/include/hermes/core/Config.h @@ -17,9 +17,15 @@ #ifndef __HERMES_CONFIG_H__ #define __HERMES_CONFIG_H__ +#include "hermes/core/Severity.h" // TODO Put this into SourceSetting.h +#include "hermes/core/SourceSetting.h" + namespace hermes { +// TODO Introduce Source.forward.h +class Source; + /** * @brief Top-level configuration interface * @@ -28,6 +34,8 @@ namespace hermes struct Config { virtual ~Config() = default; + + virtual void configure(const Source *, SourceSetting &) const = 0; }; } // namespace hermes diff --git a/contrib/hermes/include/hermes/core/Source.h b/contrib/hermes/include/hermes/core/Source.h index b408b4a..b28532b 100644 --- a/contrib/hermes/include/hermes/core/Source.h +++ b/contrib/hermes/include/hermes/core/Source.h @@ -77,8 +77,10 @@ public: * @brief Update Source with a given configuration * * WARNING Do NOT invoke this manually. + * + * TODO Remove virtual after migration */ - virtual void reload(const Config *) = 0; + virtual void reload(const Config *); public: std::unique_ptr buffer(const Severity &) const; diff --git a/contrib/hermes/src/core/Source.cpp b/contrib/hermes/src/core/Source.cpp index 4d473cd..33f8b05 100644 --- a/contrib/hermes/src/core/Source.cpp +++ b/contrib/hermes/src/core/Source.cpp @@ -59,6 +59,8 @@ void Source::deactivate(void) assert((_reg == nullptr) && (_bus == nullptr)); } +void Source::reload(const Config *c) { c->configure(this, _setting); } + std::unique_ptr Source::buffer(const Severity &) const { // TODO Pass Severity -- 2.7.4