IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 95724831 authored by Remy Prechelt's avatar Remy Prechelt
Browse files

Add NoOutput class to disable output writing.

parent 55d7e99a
No related branches found
No related tags found
No related merge requests found
/*
* (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 {
NoOutput::NoOutput()
: {}
void NoOutput::startOfRun(std::filesystem::path const& directory) {}
void NoOutput::startOfEvent() {}
void NoOutput::endOfEvent() {}
void NoOutput::endOfRun() {}
YAML::Node NoOutput::getConfig() const { return YAML::Node(); }
YAML::Node NoOutput::getFinalOutput() const { return YAML::Node(); }
template <typename... TVArgs>
void NoOutput::write(TVArgs&& args...) {}
} // namespace corsika
/*
* (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/output/BaseOutput.hpp>
namespace corsika {
/**
* This class can be used as a drop-in for any output template
* and doesn't write *any* output files.
*
*/
class NoOutput : public BaseOutput {
public:
/**
* Construct a blank output.
*/
NoOutput();
/**
* Called at the start of each run.
*/
virtual void startOfRun(std::filesystem::path const& directory) final override;
/**
* Called at the start of each event/shower.
*/
virtual void startOfEvent() final override;
/**
* Called at the end of each event/shower.
*/
virtual void endOfEvent() final override;
/**
* Called at the end of each run.
*/
virtual void endOfRun() final override;
/**
* Get the configuration of this output.
*/
virtual YAML::Node getConfig() const final override;
/**
* Accept any arguments and ignore them.
*/
template <typename... TVArgs>
void write(TVArgs&& args...);
/**
* Get final text outputs for the config file.
*/
virtual YAML::Node getFinalOutput() const final override;
};
} // namespace corsika
#include <corsika/detail/output/NoOutput.inl>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment