HepMC3 event record library
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
WriterDOT Class Reference

Detailed Description

GenEvent I/O output to dot files that should be processed by graphviz or other software.

Definition at line 21 of file WriterDOT.h.

#include <WriterDOT.h>

+ Inheritance diagram for WriterDOT:
+ Collaboration diagram for WriterDOT:

Public Member Functions

 WriterDOT (const std::string &filename, std::shared_ptr< GenRunInfo > run=std::shared_ptr< GenRunInfo >())
 Constructor.
 
 WriterDOT (std::ostream &stream, std::shared_ptr< GenRunInfo > run=std::shared_ptr< GenRunInfo >())
 Constructor from ostream.
 
void write_event (const GenEvent &evt)
 Write event to file.
 
bool failed ()
 Return status of the stream.
 
void close ()
 Close file stream.
 
void set_style (const int &istyle)
 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 Member Functions

void allocate_buffer ()
 allocates buffer for output
 
void flush ()
 flushes output buffer
 
void forced_flush ()
 flushes output buffer
 

Private Attributes

std::ofstream m_file
 Output file.
 
std::ostream * m_stream
 Output stream.
 
int m_style
 style of dot file
 
char * m_buffer
 Stream buffer.
 
char * m_cursor
 Cursor inside stream buffer.
 
unsigned long m_buffer_size
 Buffer size.
 
std::shared_ptr< GenRunInfom_run_info
 The global GenRunInfo object.
 

Constructor & Destructor Documentation

◆ WriterDOT() [1/2]

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

Constructor.

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

Definition at line 4 of file WriterDOT.cc.

References HEPMC3_ERROR, and WriterDOT::m_file.

◆ WriterDOT() [2/2]

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

Constructor from ostream.

Definition at line 16 of file WriterDOT.cc.

Member Function Documentation

◆ allocate_buffer()

void allocate_buffer ( )
private

allocates buffer for output

Definition at line 100 of file WriterDOT.cc.

References HEPMC3_ERROR, HEPMC3_WARNING, WriterDOT::m_buffer, WriterDOT::m_buffer_size, and WriterDOT::m_cursor.

◆ close()

void close ( )
virtual

Close file stream.

Implements Writer.

Definition at line 26 of file WriterDOT.cc.

References WriterDOT::forced_flush(), and WriterDOT::m_stream.

◆ failed()

bool failed ( )
inlinevirtual

Return status of the stream.

Implements Writer.

Definition at line 34 of file WriterDOT.h.

References WriterDOT::m_file.

◆ flush()

void flush ( )
inlineprivate

flushes output buffer

Definition at line 118 of file WriterDOT.cc.

References WriterDOT::m_buffer, WriterDOT::m_buffer_size, WriterDOT::m_cursor, and WriterDOT::m_stream.

◆ forced_flush()

void forced_flush ( )
inlineprivate

flushes output buffer

Definition at line 127 of file WriterDOT.cc.

References WriterDOT::m_buffer, WriterDOT::m_cursor, and WriterDOT::m_stream.

◆ 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.

◆ set_style()

void set_style ( const int &  istyle)
inline

Close file stream.

Definition at line 40 of file WriterDOT.h.

References WriterDOT::m_style.

◆ write_event()

void write_event ( const GenEvent evt)
virtual

Field Documentation

◆ m_buffer

char* m_buffer
private

Stream buffer.

Definition at line 51 of file WriterDOT.h.

◆ m_buffer_size

unsigned long m_buffer_size
private

Buffer size.

Definition at line 53 of file WriterDOT.h.

◆ m_cursor

char* m_cursor
private

Cursor inside stream buffer.

Definition at line 52 of file WriterDOT.h.

◆ m_file

std::ofstream m_file
private

Output file.

Definition at line 48 of file WriterDOT.h.

◆ 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_stream

std::ostream* m_stream
private

Output stream.

Definition at line 49 of file WriterDOT.h.

◆ m_style

int m_style
private

style of dot file

Definition at line 50 of file WriterDOT.h.


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