diff --git a/corsika/detail/output/DummyOutputManager.inl b/corsika/detail/output/DummyOutputManager.inl new file mode 100644 index 0000000000000000000000000000000000000000..6a9d113e83f25a45409e4b2ba45193be36469deb --- /dev/null +++ b/corsika/detail/output/DummyOutputManager.inl @@ -0,0 +1,27 @@ +/* + * (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 + +namespace corsika { + + DummyOutputManager::DummyOutputManager() {} + + DummyOutputManager::~DummyOutputManager() {} + + template <typename TOutput> + void DummyOutputManager::add(std::string const& name, TOutput& output) {} + + void DummyOutputManager::startOfLibrary() {} + + void DummyOutputManager::startOfShower() {} + + void DummyOutputManager::endOfShower() {} + + void DummyOutputManager::endOfLibrary() {} + +} // namespace corsika diff --git a/corsika/output/DummyOutputManager.hpp b/corsika/output/DummyOutputManager.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fc5cf4647d5daa227fceceda5961bb051a840058 --- /dev/null +++ b/corsika/output/DummyOutputManager.hpp @@ -0,0 +1,70 @@ +/* + * (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 + +namespace corsika { + + /*! + * An output manager that does nothing. + */ + class DummyOutputManager final { + + public: + /** + * Construct an OutputManager instance with a name in a given directory. + * + * @param name The name of this output collection. + * @param dir The directory where the output directory will be stored. + */ + DummyOutputManager(); + + /** + * Handle graceful closure of the outputs upon destruction. + */ + ~DummyOutputManager(); + + /** + * Register an existing output to this manager. + * + * @param name The unique name of this output. + * @param args... These are perfect forwarded to the + * constructor of the output. + */ + template <typename TOutput> + void add(std::string const& name, TOutput& output); + + /** + * Called at the start of each library. + * + * This iteratively calls startOfLibrary on each registered output. + */ + void startOfLibrary(); + + /** + * Called at the start of each event/shower. + * This iteratively calls startOfEvent on each registered output. + */ + void startOfShower(); + + /** + * Called at the end of each event/shower. + * This iteratively calls endOfEvent on each registered output. + */ + void endOfShower(); + + /** + * Called at the end of each library. + * This iteratively calls endOfLibrary on each registered output. + */ + void endOfLibrary(); + + }; // class DummyOutputManager + +} // namespace corsika + +#include <corsika/detail/output/DummyOutputManager.inl>