13#include "ers/DefaultStream.h"
14#include "ers/StreamFactory.h"
22 "default:",
"default:",
"default:",
24 "default:",
"default:",
122 char* c = &( key_buffer[0] );
128 const char* env = ::getenv( key_buffer );
129 if ( env != 0 )
return env;
131 if ( static_key )
return static_key;
145 std::string protocol;
148 std::string::size_type colon =
key.find(
':' );
149 if ( colon == std::string::npos ) { protocol =
key; }
152 protocol =
key.substr( 0, colon );
153 std::string::size_type uri_start = colon + 1;
154 if ( uri_start <
key.size() ) { uri =
key.substr( uri_start ); }
156 for ( stream_factory_collection::const_iterator pos =
m_factories.begin();
160 Stream*
s = callback( protocol, uri );
161 if (
s != 0 )
return s;
163 fprintf( stderr,
"Warning, could not find stream for key protocol=\"%s\" uri=\"%s\" (%s)\n",
164 protocol.c_str(), uri.c_str(),
key.c_str() );
259 if ( throw_error && issue_ptr->
is_error() ) {
throw *issue_ptr; }
263 stream_ptr->
send( issue_ptr );
267 dispatch( &issue_ref, throw_error );
298 "illegal severity_t %d", (
int)severity );
372 stream <<
"Stream factory - registered streams\n";
373 stream <<
"-----------------------------------\n";
375 for ( stream_factory_collection::const_iterator pos =
m_factories.begin();
378 std::string name = pos->first;
379 stream << i <<
")\t" << name << std::endl;
382 stream <<
"-----------------------------------\n";
#define ERS_PRE_CHECK_PTR(p)
#define ERS_NOT_IMPLEMENTED()
#define ERS_PRECONDITION(expr,...)
*************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
Source context for Issue.
static const char * to_string(severity_t s)
severity_t to string
static const char *const KEY
severity_t severity() const
severity_t of the issue
bool is_error()
is the issue an error (or fatal).
Wrapper for log messages.
Factory for Stream objects and repository of default streams.
static const char * key_for_severity(severity_t s)
finds key for severity_t
static void set_stream(severity_t, const std::string &key)
Stream * create_stream(severity_t s)
create a stream for severity_t
Stream * warning()
Warning stream.
static void dispatch(Issue *i, bool throw_error=false)
Sends an issue to the appropriate stream according to its severity_t.
static Stream * get_default_stream(severity_t s)
builds default stream for severity_t
bool register_factory(const std::string &name, create_stream_callback callback)
register a factory method
Stream *(* create_stream_callback)(const std::string &, const std::string &)
static void print_registered()
static const char * DEFAULT_STREAMS[]
keys for default streams
static StreamFactory * instance()
return the singleton
Stream * fatal()
Fatal stream.
stream_factory_collection m_factories
collection of factories to build streams
static StreamFactory * s_instance
singleton instance
void set(severity_t severity, Stream *s)
Sets the stream for a given severity_t.
Stream * get_stream(severity_t s)
get stream for severity_t
Stream * m_streams[severity_max]
array of pointers to streams per severity_t
void write_to(std::ostream &stream) const
write content of factory to stream
static void debug(Issue *i, severity_t)
sends an Issue to the debug stream
Stream * error()
Error stream.
virtual void send(const Issue *i)
Sends an issue into the stream.
efhlt::Interface * factory(void)
std::ostream & operator<<(std::ostream &, const Issue &)
enum ers::_severity_t severity_t