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

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

#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. More...
 
 WriterDOT (std::ostream &stream, std::shared_ptr< GenRunInfo > run=std::shared_ptr< GenRunInfo >())
 Constructor from ostream. More...
 
void write_event (const GenEvent &evt)
 Write event to file. More...
 
bool failed ()
 Return status of the stream. More...
 
void close ()
 Close file stream. More...
 
void set_style (const int &istyle)
 Close file stream. More...
 
void set_run_info (std::shared_ptr< GenRunInfo > run)
 Set the global GenRunInfo object. More...
 
std::shared_ptr< GenRunInforun_info () const
 Get the global GenRunInfo object. More...
 
void set_options (const std::map< std::string, std::string > &options)
 Set options. More...
 
std::map< std::string,
std::string > 
get_options () const
 Set options. More...
 

Protected Attributes

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

Private Member Functions

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

Private Attributes

std::ofstream m_file
 Output file. More...
 
std::ostream * m_stream
 Output stream. More...
 
int m_style
 style of dot file More...
 
char * m_buffer
 Stream buffer. More...
 
char * m_cursor
 Cursor inside stream buffer. More...
 
unsigned long m_buffer_size
 Buffer size. More...
 

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.

Constructor & Destructor Documentation

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 ( 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

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.

void close ( )
virtual

Close file stream.

Implements Writer.

Definition at line 26 of file WriterDOT.cc.

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

bool failed ( )
inlinevirtual

Return status of the stream.

Implements Writer.

Definition at line 34 of file WriterDOT.h.

References WriterDOT::m_file.

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.

void forced_flush ( )
inlineprivate

flushes output buffer

Definition at line 129 of file WriterDOT.cc.

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

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

Set options.

Definition at line 61 of file Writer.h.

References Writer::m_options.

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.

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.

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.

void set_style ( const int &  istyle)
inline

Close file stream.

Definition at line 40 of file WriterDOT.h.

References WriterDOT::m_style.

void write_event ( const GenEvent evt)
virtual

Field Documentation

char* m_buffer
private

Stream buffer.

Definition at line 51 of file WriterDOT.h.

unsigned long m_buffer_size
private

Buffer size.

Definition at line 53 of file WriterDOT.h.

char* m_cursor
private

Cursor inside stream buffer.

Definition at line 52 of file WriterDOT.h.

std::ofstream m_file
private

Output file.

Definition at line 48 of file WriterDOT.h.

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

options

Definition at line 68 of file Writer.h.

std::ostream* m_stream
private

Output stream.

Definition at line 49 of file WriterDOT.h.

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: