Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ers::DefaultStream Class Reference

Default Issue display. More...

#include <DefaultStream.h>

Inheritance diagram for ers::DefaultStream:

ers::Stream ers::Stream List of all members.

Public Member Functions

 DefaultStream (bool verbose=false)
 DefaultStream (bool verbose=false)
 operator std::string () const
 operator std::string () const
virtual void print_to (std::ostream &stream) const
virtual void print_to (std::ostream &stream) const
virtual Issuereceive ()
 Receives an issue from the stream.
virtual Issuereceive ()
 Receives an issue from the stream.
void send (const Issue *ptr)
 Sends an issue into the stream.
void send (const Issue *ptr)
 ~DefaultStream ()
 ~DefaultStream ()

Static Public Attributes

const char *const KEY
const char *const KEY = "default"
const char *const NULL_STREAM_KEY
const char *const NULL_STREAM_KEY = "null"
const char *const VERBOSE_KEY
const char *const VERBOSE_KEY = "verbose"

Protected Attributes

bool m_verbose

Detailed Description

Default Issue display.

This class displas an Issue on the standard error stream This class is meant to be used as default stream for simple on screen display. More advanced streams are offered in the System package This stream only sends output to the standard error stream. To select this stream, simply use the default string key. You can get a verbose output by

Author:
Matthias Wiesmann
Version:
1.0


Constructor & Destructor Documentation

ers::DefaultStream::DefaultStream bool  verbose = false  ) 
 

00032                                             {
00033     m_verbose = verbose ;
00034 } // DefaultStream

ers::DefaultStream::~DefaultStream  ) 
 

00037 {} 

ers::DefaultStream::DefaultStream bool  verbose = false  ) 
 

ers::DefaultStream::~DefaultStream  ) 
 


Member Function Documentation

ers::Stream::operator std::string  )  const [inherited]
 

ers::Stream::operator std::string  )  const [inherited]
 

00035                                     {
00036     std::ostringstream stream ; 
00037     print_to(stream); 
00038     return stream.str(); 
00039 } // to string 

virtual void ers::Stream::print_to std::ostream stream  )  const [virtual, inherited]
 

Reimplemented in ers::FIFOStream, ers::FilterStream, ers::HumanStream, ers::FIFOStream, ers::FilterStream, and ers::HumanStream.

void ers::Stream::print_to std::ostream stream  )  const [virtual, inherited]
 

Reimplemented in ers::FIFOStream, ers::FilterStream, ers::HumanStream, ers::FIFOStream, ers::FilterStream, and ers::HumanStream.

00059                                                  {
00060     stream << NULL_STREAM_KEY << ':' ; 
00061 } // print_to

virtual Issue* ers::Stream::receive  )  [virtual, inherited]
 

Receives an issue from the stream.

Reimplemented in ers::FIFOStream, and ers::FIFOStream.

ers::Issue * ers::Stream::receive  )  [virtual, inherited]
 

Receives an issue from the stream.

Reads an isssue on the stream

Returns:
the issue that has been read
Note:
This implementation always returns a null pointer

Reimplemented in ers::FIFOStream, and ers::FIFOStream.

00055                              {
00056     return 0 ; 
00057 } // receive

void ers::DefaultStream::send const Issue ptr  )  [virtual]
 

Sends an issue into the stream.

Sends the issue to the stream.

Parameters:
i the issue to send
Note:
This implementation silently discards the Issue

Reimplemented from ers::Stream.

void ers::DefaultStream::send const Issue issue_ptr  )  [virtual]
 

We print the stream in a semi-tabbed mode. The message is first printed out, then a list of all properties.

Parameters:
issue_ptr reference to the issue to print
Note:
The format produced by this class is subject to change!

Reimplemented from ers::Stream.

00045                                                   {
00046     ERS_PRE_CHECK_PTR(issue_ptr); 
00047     try {
00048         const string_map_type *table = issue_ptr->get_value_table(); 
00049         const std::string & message_str = issue_ptr->get_value(Issue::MESSAGE_KEY) ;
00050         const std::string & severity_str = issue_ptr->get_value(Issue::SEVERITY_KEY) ;
00051         const std::string & position_str = issue_ptr->get_value(Issue::SOURCE_POSITION_KEY) ; 
00052         const std::string & date_str = issue_ptr->get_value(Issue::TIME_KEY); 
00053         
00054         std::ostream & out = issue_ptr->severity() < warning ? std::cout : std::cerr;
00055         
00056         out << severity_str << " at " << position_str << " (" << date_str << "): " << message_str << std::endl ; 
00057         if (m_verbose) {
00058             out << "-----------" << std::endl ; 
00059             for(string_map_type::const_iterator pos = table->begin();pos!=table->end();++pos) {
00060                 const std::string &key = pos->first ; 
00061                 const std::string &value = pos->second ; 
00062                 out << key << "=\t\"" << value << '\"' << std::endl ;
00063             } // for
00064                 out << "-----------" << std::endl ; 
00065         } // if long format
00066     } catch (std::ios_base::failure &ex) {
00067         throw ers::Issue(ERS_HERE,ers::error,&ex);
00068     } // catch generic I/O errors
00069    
00070 } // send


Member Data Documentation

const char* const ers::DefaultStream::KEY [static]
 

const char *const ers::DefaultStream::KEY = "default" [static]
 

The key for this stream is default the URI field is ignored

bool ers::DefaultStream::m_verbose [protected]
 

const char* const ers::Stream::NULL_STREAM_KEY [static, inherited]
 

Key for discard stream

const char *const ers::Stream::NULL_STREAM_KEY = "null" [static, inherited]
 

Key for discard stream

const char* const ers::DefaultStream::VERBOSE_KEY [static]
 

const char *const ers::DefaultStream::VERBOSE_KEY = "verbose" [static]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 19:19:29 2011 for BOSS6.5.5 by  doxygen 1.3.9.1