HepMC3 event record library
Reader.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // This file is part of HepMC
4 // Copyright (C) 2014-2019 The HepMC collaboration (see AUTHORS for details)
5 //
6 #ifndef HEPMC3_READER_H
7 #define HEPMC3_READER_H
8 ///
9 /// @file Reader.h
10 /// @brief Definition of interface \b Reader
11 ///
12 /// @class HepMC3::Reader
13 /// @brief Base class for all I/O readers
14 ///
15 /// @ingroup IO
16 ///
17 
18 #include "HepMC3/GenRunInfo.h"
19 
20 namespace HepMC3 {
21 
22 // Forward declaration
23 class GenEvent;
24 
25 class Reader {
26 public:
27 
28  /// Virtual destructor
29  virtual ~Reader() {}
30 
31  /// Fill next event from input into @a evt
32  virtual bool read_event(GenEvent& evt) = 0;
33  /** @brief Get file and/or stream error state */
34  virtual bool failed()=0;
35  /** @brief Close file and/or stream */
36  virtual void close()=0;
37 
38  /// Get the global GenRunInfo object.
39  shared_ptr<GenRunInfo> run_info() const {
40  return m_run_info;
41  }
42 
43 protected:
44 
45  /// Set the global GenRunInfo object.
46  void set_run_info(shared_ptr<GenRunInfo> run) {
47  m_run_info = run;
48  }
49 
50 private:
51 
52  /// The global GenRunInfo object.
53  shared_ptr<GenRunInfo> m_run_info;
54 
55 };
56 
57 
58 } // namespace HepMC3
59 
60 #endif
HepMC3::GenEvent
Stores event-related information.
Definition: GenEvent.h:42
HepMC3::Reader::~Reader
virtual ~Reader()
Virtual destructor.
Definition: Reader.h:29
HepMC3
HepMC3 main namespace.
Definition: ReaderGZ.h:28
HepMC3::Reader
Base class for all I/O readers.
Definition: Reader.h:25
GenRunInfo.h
Definition of class GenRunInfo.
HepMC3::Reader::run_info
shared_ptr< GenRunInfo > run_info() const
Get the global GenRunInfo object.
Definition: Reader.h:39
HepMC3::Reader::failed
virtual bool failed()=0
Get file and/or stream error state.
HepMC3::Reader::m_run_info
shared_ptr< GenRunInfo > m_run_info
The global GenRunInfo object.
Definition: Reader.h:53
HepMC3::Reader::close
virtual void close()=0
Close file and/or stream.
HepMC3::Reader::set_run_info
void set_run_info(shared_ptr< GenRunInfo > run)
Set the global GenRunInfo object.
Definition: Reader.h:46
HepMC3::Reader::read_event
virtual bool read_event(GenEvent &evt)=0
Fill next event from input into evt.