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_READER_H
0007 #define HEPMC3_READER_H
0008 ///
0009 /// @file  Reader.h
0010 /// @brief Definition of interface \b Reader
0011 ///
0012 /// @class HepMC3::Reader
0013 /// @brief Base class for all I/O readers
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 Reader {
0026 public:
0027     ///Constructor
0028     Reader() {}
0029 
0030     /// Virtual destructor
0031     virtual ~Reader() {}
0032 
0033     /// skip or fast forward reading of some events
0034     virtual bool skip(const int) { return !failed();}
0035 
0036     /// Fill next event from input into @a evt
0037     virtual bool read_event(GenEvent& evt) = 0;
0038     /** @brief Get file and/or stream error state */
0039     virtual bool failed()=0;
0040     /** @brief Close file and/or stream */
0041     virtual void close()=0;
0042 
0043     /** @brief Get the global GenRunInfo object. */
0044     virtual std::shared_ptr<GenRunInfo> run_info() const { return m_run_info; }
0045 
0046 ///deleted copy constructor
0047     Reader(const Reader&) = delete;
0048 ///deleted copy assignment operator
0049     Reader& operator = (const Reader &) = delete;
0050     /** @brief  Set options */
0051     virtual void set_options(const std::map<std::string, std::string>& options) { m_options = options; }
0052     /** @brief  Get options  */
0053     virtual std::map<std::string, std::string> get_options() const { return m_options; }
0054 //protected:
0055     /// Set the global GenRunInfo object.
0056     virtual void set_run_info(std::shared_ptr<GenRunInfo> run) { m_run_info = run; }
0057 
0058 protected:
0059     /// Options
0060     std::map<std::string, std::string> m_options;
0061 private:
0062     /// The global GenRunInfo object.
0063     std::shared_ptr<GenRunInfo> m_run_info;
0064 };
0065 
0066 
0067 } // namespace HepMC3
0068 
0069 #endif