HepMC3 event record library
Public Member Functions | Protected Attributes | Private Attributes
WriterGZ< T, C > Class Template Reference

Detailed Description

template<class T, Compression C = Compression::z>
class HepMC3::WriterGZ< T, C >

GenEvent I/O serialization for compressed files.

Examples
convert_example.cc.

Definition at line 25 of file WriterGZ.h.

#include <WriterGZ.h>

+ Inheritance diagram for WriterGZ< T, C >:
+ Collaboration diagram for WriterGZ< T, C >:

Public Member Functions

 WriterGZ (const std::string &filename, std::shared_ptr< GenRunInfo > run=std::shared_ptr< GenRunInfo >())
 Constructor.
 
 WriterGZ (std::ostream &stream, std::shared_ptr< GenRunInfo > run=std::shared_ptr< GenRunInfo >())
 Constructor from ostream.
 
 ~WriterGZ ()
 Destructor.
 
void write_event (const GenEvent &evt) override
 Write event to file.
 
bool failed () override
 Return status of the stream.
 
void close () override
 Close file stream.
 
void set_run_info (std::shared_ptr< GenRunInfo > run)
 Set the global GenRunInfo object.
 
std::shared_ptr< GenRunInforun_info () const
 Get the global GenRunInfo object.
 
void set_options (const std::map< std::string, std::string > &options)
 Set options.
 
std::map< std::string, std::string > get_options () const
 Set options.
 

Protected Attributes

std::map< std::string, std::string > m_options
 options
 

Private Attributes

std::shared_ptr< std::ostream > m_zstr
 Stream to write.
 
std::shared_ptr< Writerm_writer
 actual writter
 
std::shared_ptr< GenRunInfom_run_info
 The global GenRunInfo object.
 

Constructor & Destructor Documentation

◆ WriterGZ() [1/2]

WriterGZ ( const std::string &  filename,
std::shared_ptr< GenRunInfo run = std::shared_ptr<GenRunInfo>() 
)
inline

Constructor.

Warning
If file already exists, it will be cleared before writing

Definition at line 30 of file WriterGZ.h.

References WriterGZ< T, C >::m_writer, and WriterGZ< T, C >::m_zstr.

◆ WriterGZ() [2/2]

WriterGZ ( std::ostream &  stream,
std::shared_ptr< GenRunInfo run = std::shared_ptr<GenRunInfo>() 
)
inline

Constructor from ostream.

Definition at line 36 of file WriterGZ.h.

References WriterGZ< T, C >::m_writer, and WriterGZ< T, C >::m_zstr.

◆ ~WriterGZ()

~WriterGZ ( )
inline

Destructor.

Definition at line 42 of file WriterGZ.h.

Member Function Documentation

◆ close()

void close ( )
inlineoverridevirtual

Close file stream.

Implements Writer.

Definition at line 53 of file WriterGZ.h.

References WriterGZ< T, C >::m_writer, and WriterGZ< T, C >::m_zstr.

◆ failed()

bool failed ( )
inlineoverridevirtual

Return status of the stream.

Implements Writer.

Definition at line 50 of file WriterGZ.h.

References WriterGZ< T, C >::m_writer.

◆ get_options()

std::map< std::string, std::string > get_options ( ) const
inlineinherited

Set options.

Definition at line 61 of file Writer.h.

References Writer::m_options.

◆ run_info()

std::shared_ptr< GenRunInfo > run_info ( ) const
inlineinherited

Get the global GenRunInfo object.

Definition at line 47 of file Writer.h.

References Writer::m_run_info.

◆ set_options()

void set_options ( const std::map< std::string, std::string > &  options)
inlineinherited

Set options.

Definition at line 56 of file Writer.h.

References Writer::m_options.

◆ set_run_info()

void set_run_info ( std::shared_ptr< GenRunInfo run)
inlineinherited

Set the global GenRunInfo object.

Definition at line 42 of file Writer.h.

References Writer::m_run_info.

◆ write_event()

void write_event ( const GenEvent evt)
inlineoverridevirtual

Write event to file.

Parameters
[in]evtEvent to be serialized

Implements Writer.

Definition at line 47 of file WriterGZ.h.

References WriterGZ< T, C >::m_writer.

Field Documentation

◆ m_options

std::map<std::string, std::string> m_options
protectedinherited

options

Definition at line 68 of file Writer.h.

◆ m_run_info

std::shared_ptr<GenRunInfo> m_run_info
privateinherited

The global GenRunInfo object.

Definition at line 73 of file Writer.h.

◆ m_writer

std::shared_ptr<Writer> m_writer
private

actual writter

Definition at line 61 of file WriterGZ.h.

◆ m_zstr

std::shared_ptr< std::ostream > m_zstr
private

Stream to write.

Definition at line 60 of file WriterGZ.h.


The documentation for this class was generated from the following file: