BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
ers::DefaultStream Class Reference

Default Issue display. More...

#include <DefaultStream.h>

+ Inheritance diagram for ers::DefaultStream:

Public Member Functions

 DefaultStream (bool verbose=false)
 
 ~DefaultStream ()
 
void send (const Issue *ptr)
 
- Public Member Functions inherited from ers::Stream
 Stream ()
 
 Stream (const Stream &other)
 
 operator std::string () const
 
virtual ~Stream ()
 
virtual void send (const Issue *i)
 Sends an issue into the stream.
 
virtual Issuereceive ()
 Receives an issue from the stream.
 
virtual void print_to (std::ostream &stream) const
 

Static Public Attributes

static const char *const KEY = "default"
 
static const char *const VERBOSE_KEY = "verbose"
 
- Static Public Attributes inherited from ers::Stream
static const char *const NULL_STREAM_KEY = "null"
 

Protected Attributes

bool m_verbose
 

Detailed Description

Default Issue display.

This class displas an Issue on the standard error stream This class is meant to be used as default stream for simple on screen display. More advanced streams are offered in the System package This stream only sends output to the standard error stream. To select this stream, simply use the default string key. You can get a verbose output by

Author
Matthias Wiesmann
Version
1.0

Definition at line 28 of file DefaultStream.h.

Constructor & Destructor Documentation

◆ DefaultStream()

ers::DefaultStream::DefaultStream ( bool  verbose = false)

Definition at line 32 of file DefaultStream.cxx.

32 {
33 m_verbose = verbose ;
34} // DefaultStream

◆ ~DefaultStream()

ers::DefaultStream::~DefaultStream ( )

Definition at line 37 of file DefaultStream.cxx.

37{}

Member Function Documentation

◆ send()

void ers::DefaultStream::send ( const Issue issue_ptr)
virtual

We print the stream in a semi-tabbed mode. The message is first printed out, then a list of all properties.

Parameters
issue_ptrreference to the issue to print
Note
The format produced by this class is subject to change!

Reimplemented from ers::Stream.

Definition at line 45 of file DefaultStream.cxx.

45 {
46 ERS_PRE_CHECK_PTR(issue_ptr);
47 try {
48 const string_map_type *table = issue_ptr->get_value_table();
49 const std::string & message_str = issue_ptr->get_value(Issue::MESSAGE_KEY) ;
50 const std::string & severity_str = issue_ptr->get_value(Issue::SEVERITY_KEY) ;
51 const std::string & position_str = issue_ptr->get_value(Issue::SOURCE_POSITION_KEY) ;
52 const std::string & date_str = issue_ptr->get_value(Issue::TIME_KEY);
53
54 std::ostream & out = issue_ptr->severity() < warning ? std::cout : std::cerr;
55
56 out << severity_str << " at " << position_str << " (" << date_str << "): " << message_str << std::endl ;
57 if (m_verbose) {
58 out << "-----------" << std::endl ;
59 for(string_map_type::const_iterator pos = table->begin();pos!=table->end();++pos) {
60 const std::string &key = pos->first ;
61 const std::string &value = pos->second ;
62 out << key << "=\t\"" << value << '\"' << std::endl ;
63 } // for
64 out << "-----------" << std::endl ;
65 } // if long format
66 } catch (std::ios_base::failure &ex) {
68 } // catch generic I/O errors
69
70} // send
#define ERS_HERE
Definition: Context.h:119
#define ERS_PRE_CHECK_PTR(p)
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
Definition: Taupair.h:42
Root Issue class.
static const char *const MESSAGE_KEY
key for human readable
static const char *const SEVERITY_KEY
key for the severity_t of the issue
static const char *const TIME_KEY
key for the time of the issue (text)
static const char *const SOURCE_POSITION_KEY
key for position in the source code
@ warning
Definition: Core.h:24
@ error
Definition: Core.h:24
std::map< std::string, std::string > string_map_type
Definition: Core.h:26

Member Data Documentation

◆ KEY

const char *const ers::DefaultStream::KEY = "default"
static

The key for this stream is default the URI field is ignored

Definition at line 32 of file DefaultStream.h.

Referenced by ers::StreamFactory::key_for_severity().

◆ m_verbose

bool ers::DefaultStream::m_verbose
protected

Definition at line 30 of file DefaultStream.h.

Referenced by DefaultStream().

◆ VERBOSE_KEY

const char *const ers::DefaultStream::VERBOSE_KEY = "verbose"
static

Definition at line 33 of file DefaultStream.h.


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