HepMC event record
build/outputs/include/HepMC/Writer.h
1 // -*- C++ -*-
2 //
3 // This file is part of HepMC
4 // Copyright (C) 2014-2015 The HepMC collaboration (see AUTHORS for details)
5 //
6 #ifndef HEPMC_WRITER_H
7 #define HEPMC_WRITER_H
8 ///
9 /// @file Writer.h
10 /// @brief Definition of interface \b Writer
11 ///
12 /// @class HepMC::Writer
13 /// @brief Base class for all I/O writers
14 ///
15 /// @ingroup IO
16 ///
17 
18 #include "HepMC/GenRunInfo.h"
19 
20 namespace HepMC {
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  virtual bool failed() = 0;
34  virtual void close() = 0;
35 
36  /// Set the global GenRunInfo object.
37  void set_run_info(shared_ptr<GenRunInfo> run) {
38  m_run_info = run;
39  }
40 
41  /// Get the global GenRunInfo object.
42  shared_ptr<GenRunInfo> run_info() const {
43  return m_run_info;
44  }
45 
46  private:
47 
48  /// The global GenRunInfo object.
49  shared_ptr<GenRunInfo> m_run_info;
50 
51  };
52 
53 
54 } // namespace HepMC
55 
56 #endif
virtual void write_event(const GenEvent &evt)=0
Write event evt to output target.
void set_run_info(shared_ptr< GenRunInfo > run)
Set the global GenRunInfo object.
shared_ptr< GenRunInfo > run_info() const
Get the global GenRunInfo object.
Stores event-related information.
Base class for all I/O writers.
virtual ~Writer()
Virtual destructor.
shared_ptr< GenRunInfo > m_run_info
The global GenRunInfo object.
Definition of template class SmartPointer.