HepMC3 event record library
Writer.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_WRITER_H
7 #define HEPMC3_WRITER_H
8 ///
9 /// @file Writer.h
10 /// @brief Definition of interface \b Writer
11 ///
12 /// @class HepMC3::Writer
13 /// @brief Base class for all I/O writers
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 Writer {
26 public:
27 
28  /// Virtual destructor
29  virtual ~Writer() {}
30 
31  /// Write event @a evt to output target
32  virtual void write_event(const 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  /// Set the global GenRunInfo object.
39  void set_run_info(shared_ptr<GenRunInfo> run) {
40  m_run_info = run;
41  }
42 
43  /// Get the global GenRunInfo object.
44  shared_ptr<GenRunInfo> run_info() const {
45  return m_run_info;
46  }
47 
48 private:
49 
50  /// The global GenRunInfo object.
51  shared_ptr<GenRunInfo> m_run_info;
52 
53 };
54 
55 
56 } // namespace HepMC3
57 
58 #endif
HepMC3::Writer::run_info
shared_ptr< GenRunInfo > run_info() const
Get the global GenRunInfo object.
Definition: Writer.h:44
HepMC3::GenEvent
Stores event-related information.
Definition: GenEvent.h:42
HepMC3
HepMC3 main namespace.
Definition: ReaderGZ.h:28
HepMC3::Writer::set_run_info
void set_run_info(shared_ptr< GenRunInfo > run)
Set the global GenRunInfo object.
Definition: Writer.h:39
GenRunInfo.h
Definition of class GenRunInfo.
HepMC3::Writer::close
virtual void close()=0
Close file and/or stream.
HepMC3::Writer::write_event
virtual void write_event(const GenEvent &evt)=0
Write event evt to output target.
HepMC3::Writer
Base class for all I/O writers.
Definition: Writer.h:25
HepMC3::Writer::m_run_info
shared_ptr< GenRunInfo > m_run_info
The global GenRunInfo object.
Definition: Writer.h:51
HepMC3::Writer::failed
virtual bool failed()=0
Get file and/or stream error state.
HepMC3::Writer::~Writer
virtual ~Writer()
Virtual destructor.
Definition: Writer.h:29