libmoost
|
A pseudo stream acts as an abstraction to a normal ostream. More...
#include <pseudo_ostream.hpp>
Public Types | |
typedef std::ostream &(* | iomanip_t )(std::ostream &) |
IO manipulators need special handling when streaming. | |
Public Member Functions | |
pseudo_ostream () | |
void | attach (std::ostream &out) |
Assign a (new) ostream. | |
void | detach () |
Detach current ostream. | |
template<typename T > | |
pseudo_ostream & | operator<< (T const &t) |
Allow streaming of any type. | |
pseudo_ostream & | operator<< (iomanip_t const &iomanip) |
operator void * () const | |
A quick way to check stream is still ok. | |
Private Attributes | |
std::ostream * | pout_ |
boost::mutex | mtx_ |
A pseudo stream acts as an abstraction to a normal ostream.
Since a logger can't log its own failures (at least it's probably not the best thing to try) the logging framework can be assigned an ostream that will be used to log any status/error messages. This ostream will be wrapped by the pseudo ostream class, which will provide thread synchronisation when writing. Also, if no ostream is provided it will silently ignore writes.
Definition at line 52 of file pseudo_ostream.hpp.
typedef std::ostream&(* moost::logging::pseudo_ostream::iomanip_t)(std::ostream &) |
IO manipulators need special handling when streaming.
iomanip | : An IO manipulator |
Definition at line 103 of file pseudo_ostream.hpp.
moost::logging::pseudo_ostream::pseudo_ostream | ( | ) | [inline] |
Definition at line 55 of file pseudo_ostream.hpp.
void moost::logging::pseudo_ostream::attach | ( | std::ostream & | out | ) | [inline] |
Assign a (new) ostream.
out | : a reference to an output stream |
Definition at line 62 of file pseudo_ostream.hpp.
void moost::logging::pseudo_ostream::detach | ( | ) | [inline] |
Detach current ostream.
Definition at line 71 of file pseudo_ostream.hpp.
moost::logging::pseudo_ostream::operator void * | ( | ) | const [inline] |
A quick way to check stream is still ok.
Definition at line 120 of file pseudo_ostream.hpp.
pseudo_ostream& moost::logging::pseudo_ostream::operator<< | ( | T const & | t | ) | [inline] |
Allow streaming of any type.
T | : the type to be streamed |
t | : the object to be streamed |
Definition at line 85 of file pseudo_ostream.hpp.
pseudo_ostream& moost::logging::pseudo_ostream::operator<< | ( | iomanip_t const & | iomanip | ) | [inline] |
Definition at line 104 of file pseudo_ostream.hpp.
boost::mutex moost::logging::pseudo_ostream::mtx_ [mutable, private] |
Definition at line 128 of file pseudo_ostream.hpp.
std::ostream* moost::logging::pseudo_ostream::pout_ [private] |
Definition at line 127 of file pseudo_ostream.hpp.