10#ifndef ERS_STREAM_FACTORY
11#define ERS_STREAM_FACTORY
14#include "ers/Context.h"
122 typedef Stream* (*create_stream_callback)(
const std::string &,
const std::string &);
143 static void warning(
const Context &c,
const std::string &message);
159 void write_to(std::ostream& stream)
const ;
172#if ! defined(ERS_FAST_DEBUG)
173#define ERS_DEBUG_0(...) { char ers_debug_buf[256] ; snprintf(ers_debug_buf,sizeof(ers_debug_buf),__VA_ARGS__) ; ers::StreamFactory::debug(ERS_HERE,ers_debug_buf,ers::debug_0) ; }
175#define ERS_DEBUG_0(...) { fprintf(stderr,"debug-0 ") ; fprintf(stderr,__VA_ARGS__) ; fprintf(stderr,"\n") ; }
181#if (! defined(ERS_FAST_DEBUG))
182#define ERS_DEBUG_1(...) { char ers_debug_buf[256] ; snprintf(ers_debug_buf,sizeof(ers_debug_buf),__VA_ARGS__) ; ers::StreamFactory::debug(ERS_HERE,ers_debug_buf,ers::debug_1) ; }
184#define ERS_DEBUG_1(...) { fprintf(stderr,"debug-1 ") ; fprintf(stderr,__VA_ARGS__) ; fprintf(stderr,"\n") ; }
187#define ERS_DEBUG_1(...)
192#define ERS_DEBUG_2(...) { char ers_debug_buf[256] ; snprintf(ers_debug_buf,sizeof(ers_debug_buf),__VA_ARGS__) ; ers::StreamFactory::debug(ERS_HERE,ers_debug_buf,ers::debug_2) ; }
194#define ERS_DEBUG_2(...)
199#define ERS_DEBUG_3(...) { char ers_debug_buf[256] ; snprintf(ers_debug_buf,sizeof(ers_debug_buf),__VA_ARGS__) ; ers::StreamFactory::debug(ERS_HERE,ers_debug_buf,ers::debug_3) ; }
201#define ERS_DEBUG_3(...)
205#define ERS_WARN(...) { char ers_warn_buf[256] ; snprintf(ers_warn_buf,sizeof(ers_warn_buf),__VA_ARGS__) ; ers::StreamFactory::warning(ERS_HERE,ers_warn_buf) ; }
efhlt::Interface * factory(void)
*************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.
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
std::map< std::string, create_stream_callback > stream_factory_collection
static void debug(Issue *i, severity_t)
sends an Issue to the debug stream
Stream * error()
Error stream.
std::ostream & operator<<(std::ostream &, const Issue &)
enum ers::_severity_t severity_t