Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:14

0001 // -*- C++ -*-
0002 //
0003 // This file is part of HepMC
0004 // Copyright (C) 2014-2023 The HepMC collaboration (see AUTHORS for details)
0005 //
0006 #ifndef HEPMC3_WRITER_H
0007 #define HEPMC3_WRITER_H
0008 ///
0009 /// @file  Writer.h
0010 /// @brief Definition of interface \b Writer
0011 ///
0012 /// @class HepMC3::Writer
0013 /// @brief Base class for all I/O writers
0014 ///
0015 /// @ingroup IO
0016 ///
0017 
0018 #include "HepMC3/GenRunInfo.h"
0019 
0020 namespace HepMC3 {
0021 
0022 // Forward declaration
0023 class GenEvent;
0024 
0025 class Writer {
0026 public:
0027 
0028     ///Constructor
0029     Writer() {}
0030 
0031     /// Virtual destructor
0032     virtual ~Writer() {}
0033 
0034     /// Write event @a evt to output target
0035     virtual void write_event(const GenEvent &evt) = 0;
0036     /** @brief Get file and/or stream error state */
0037     virtual bool failed() = 0;
0038     /** @brief Close file and/or stream */
0039     virtual void close() = 0;
0040 
0041     /// Set the global GenRunInfo object.
0042     virtual void set_run_info(std::shared_ptr<GenRunInfo> run) { m_run_info = run; }
0043 
0044     /// Get the global GenRunInfo object.
0045     virtual std::shared_ptr<GenRunInfo> run_info() const { return m_run_info; }
0046 
0047 ///deleted copy constructor
0048     Writer(const Writer&) = delete;
0049 ///deleted copy assignment operator
0050     Writer& operator = (const Writer &) = delete;
0051     /// Set options
0052     virtual void set_options(const std::map<std::string, std::string>& options) { m_options = options; }
0053     /// Set options
0054     virtual std::map<std::string, std::string> get_options() const { return m_options; }
0055 
0056 protected:
0057 
0058     /// options
0059     std::map<std::string, std::string> m_options;
0060 
0061 private:
0062 
0063     /// The global GenRunInfo object.
0064     std::shared_ptr<GenRunInfo> m_run_info;
0065 
0066 };
0067 
0068 
0069 } // namespace HepMC3
0070 
0071 #endif