BOSS 7.0.1
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/StreamFactory.h"
13#include "ers/InvalidReferenceIssue.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 bool verbose = (uri == ers::DefaultStream::VERBOSE_KEY) ;
24 return new ers::DefaultStream(verbose) ;
25 } else {
26 }
27 return 0 ;
28 } //
30} // anonymous namespace
31
33 m_verbose = verbose ;
34} // DefaultStream
35
36
38
39/** We print the stream in a semi-tabbed mode.
40 * The message is first printed out, then a list of all properties.
41 * \param issue_ptr reference to the issue to print
42 * \note The format produced by this class is subject to change!
43 */
44
45void ers::DefaultStream::send(const Issue *issue_ptr) {
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
71
*************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)
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