From 8f2c8bc2b7a1d47bba975c206d2ab149cb53f623 Mon Sep 17 00:00:00 2001 From: Remy Prechelt <prechelt@hawaii.edu> Date: Wed, 2 Jun 2021 14:09:49 -1000 Subject: [PATCH] Move getConfig to its own class in the heirarchy. --- corsika/output/BaseOutput.hpp | 8 ++------ corsika/output/Configurable.hpp | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 corsika/output/Configurable.hpp diff --git a/corsika/output/BaseOutput.hpp b/corsika/output/BaseOutput.hpp index 435519a2c..bf490fb92 100644 --- a/corsika/output/BaseOutput.hpp +++ b/corsika/output/BaseOutput.hpp @@ -8,6 +8,7 @@ #pragma once #include <corsika/framework/core/Logging.hpp> +#include <corsika/output/Configurable.hpp> #include <boost/filesystem.hpp> #include <yaml-cpp/yaml.h> @@ -17,7 +18,7 @@ namespace corsika { * This is the base class for all outputs so that they * can be stored in homogeneous containers. */ - class BaseOutput { + class BaseOutput : public Configurable { protected: BaseOutput() = default; @@ -63,11 +64,6 @@ namespace corsika { */ virtual YAML::Node getSummary() const { return YAML::Node(); } - /** - * Provide YAML configuration for this BaseOutput. - */ - virtual YAML::Node getConfig() const = 0; - protected: /** * Set init flag. diff --git a/corsika/output/Configurable.hpp b/corsika/output/Configurable.hpp new file mode 100644 index 000000000..c5188e69b --- /dev/null +++ b/corsika/output/Configurable.hpp @@ -0,0 +1,34 @@ +/* + * (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ +#pragma once + +#include <corsika/framework/core/Logging.hpp> +#include <corsika/output/Configurable.hpp> +#include <boost/filesystem.hpp> +#include <yaml-cpp/yaml.h> + +namespace corsika { + + /** + * This is the base class for all classes that have + * YAML representations of their configurations. + */ + class Configurable { + + protected: + Configurable() = default; + virtual ~Configurable() = default; + + public: + /** + * Provide YAML configuration for this BaseOutput. + */ + virtual YAML::Node getConfig() const = 0; + }; + +} // namespace corsika -- GitLab