BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
DefaultStream.cxx
Go to the documentation of this file.
1/*
2 * DefaultStream.cxx
3 * ERS
4 *
5 * Created by Matthias Wiesmann on 21.01.05.
6 * Copyright 2005 CERN. All rights reserved.
7 *
8 */
9#include <iostream>
10
11#include "ers/DefaultStream.h"
12#include "ers/InvalidReferenceIssue.h"
13#include "ers/StreamFactory.h"
14
15/** The key for this stream is \c default the URI field is ignored */
16const char* const ers::DefaultStream::KEY = "default";
17const char* const ers::DefaultStream::VERBOSE_KEY = "verbose";
18
19namespace {
20 ers::Stream* create_stream( const std::string& protocol, const std::string& uri ) {
21
22 if ( protocol == ers::DefaultStream::KEY )
23 {
24 bool verbose = ( uri == ers::DefaultStream::VERBOSE_KEY );
25 return new ers::DefaultStream( verbose );
26 }
27 else {}
28 return 0;
29 } //
31 create_stream );
32} // anonymous namespace
33
34ers::DefaultStream::DefaultStream( bool verbose ) { m_verbose = verbose; } // DefaultStream
35
37
38/** We print the stream in a semi-tabbed mode.
39 * The message is first printed out, then a list of all properties.
40 * \param issue_ptr reference to the issue to print
41 * \note The format produced by this class is subject to change!
42 */
43
44void ers::DefaultStream::send( const Issue* issue_ptr ) {
45 ERS_PRE_CHECK_PTR( issue_ptr );
46 try
47 {
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
57 << std::endl;
58 if ( m_verbose )
59 {
60 out << "-----------" << std::endl;
61 for ( string_map_type::const_iterator pos = table->begin(); pos != table->end(); ++pos )
62 {
63 const std::string& key = pos->first;
64 const std::string& value = pos->second;
65 out << key << "=\t\"" << value << '\"' << std::endl;
66 } // for
67 out << "-----------" << std::endl;
68 } // if long format
69 } catch ( std::ios_base::failure& ex )
70 { throw ers::Issue( ERS_HERE, ers::error, &ex ); } // catch generic I/O errors
71
72} // send
*************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
void send(const Issue *ptr)
DefaultStream(bool verbose=false)
Root Issue class.
const std::string & get_value(const std::string &key, const std::string &def) const
Reads the property list.
severity_t severity() const
severity_t of the issue
static const char *const TIME_KEY
key for the time of the issue (text)
static const char *const SEVERITY_KEY
key for the severity_t of the issue
const string_map_type * get_value_table() const
extract value table
static const char *const SOURCE_POSITION_KEY
key for position in the source code
static const char *const MESSAGE_KEY
key for human readable
bool register_factory(const std::string &name, create_stream_callback callback)
register a factory method
static StreamFactory * instance()
return the singleton
Root/Null issue stream.
std::map< std::string, std::string > string_map_type