CORSIKA8  0.0.0
The framework to simulate particle cascades for astroparticle physics
BaseOutput.hpp
1 /*
2  * (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
3  *
4  * This software is distributed under the terms of the GNU General Public
5  * Licence version 3 (GPL Version 3). See file LICENSE for a full version of
6  * the license.
7  */
8 #pragma once
9 
10 #include <boost/filesystem.hpp>
11 
12 #include <yaml-cpp/yaml.h>
13 
14 namespace corsika {
15 
20  class BaseOutput {
21 
22  protected:
23  BaseOutput();
24 
25  public:
29  virtual void startOfLibrary(boost::filesystem::path const& directory) = 0;
30 
34  virtual void startOfShower() {}
35 
39  virtual void endOfShower() = 0;
40 
44  virtual void endOfLibrary() = 0;
45 
49  virtual YAML::Node getConfig() const = 0;
50 
54  virtual YAML::Node getSummary() { return YAML::Node(); }
55 
59  bool isInit() const { return is_init_; }
60 
61  protected:
65  void setInit(bool const v) { is_init_ = v; }
66 
67  int shower_{0};
68 
69  private:
70  bool is_init_{false};
71  };
72 
73 } // namespace corsika
74 
75 #include <corsika/detail/output/BaseOutput.inl>
virtual void startOfLibrary(boost::filesystem::path const &directory)=0
Called at the start of each run.
void setInit(bool const v)
Set init flag.
Definition: BaseOutput.hpp:65
bool isInit() const
Flag to indicate readiness.
Definition: BaseOutput.hpp:59
The cascade namespace assembles all objects needed to simulate full particles cascades.
virtual void endOfLibrary()=0
Called at the end of each run.
This is the base class for all outputs so that they can be stored in homogeneous containers.
Definition: BaseOutput.hpp:20
int shower_
The current event number.
Definition: BaseOutput.hpp:67
virtual void endOfShower()=0
Called at the end of each event/shower.
virtual void startOfShower()
Called at the start of each event/shower.
Definition: BaseOutput.hpp:34
virtual YAML::Node getSummary()
Get any summary information for the entire library.
Definition: BaseOutput.hpp:54
virtual YAML::Node getConfig() const =0
Get the configuration of this output.