multovl  1.3
Multiple overlaps of genomic regions
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
multovl::Errors Class Reference

Simple facility to keep track of errors and warnings. More...

#include "errors.hh"

Public Member Functions

 Errors (const std::string &errprefix="ERROR", const std::string &warnprefix="WARNING")
 
void add_error (const std::string &msg)
 
void add_warning (const std::string &msg)
 
Errorsoperator+= (const Errors &another)
 
unsigned int error_count () const
 
unsigned int warning_count () const
 
bool ok () const
 
bool perfect () const
 
std::string last_error () const
 
std::ostream & print (std::ostream &outf, bool warnings=true) const
 
void clear ()
 Tell the calling object to forget all errors and warnings seen so far.
 

Detailed Description

Simple facility to keep track of errors and warnings.

Constructor & Destructor Documentation

multovl::Errors::Errors ( const std::string &  errprefix = "ERROR",
const std::string &  warnprefix = "WARNING" 
)
explicit

Init the Errors object.

Parameters
errprefixstring to prefix the error messages with, default "ERROR"
warnprefixstring to prefix the warning messages with, default "WARNING"

Member Function Documentation

void multovl::Errors::add_error ( const std::string &  msg)

Adds an error message to the calling object.

Parameters
msgthe error message. Does nothing if /msg/ is empty.
void multovl::Errors::add_warning ( const std::string &  msg)

Adds a warning to the calling object.

Parameters
msgthe warning message. Does nothing if /msg/ is empty.
unsigned int multovl::Errors::error_count ( ) const
inline
Returns
the number of errors seen so far.
std::string multovl::Errors::last_error ( ) const
inline
Returns
the last error encountered or the empty string if everything was fine.
bool multovl::Errors::ok ( ) const
inline
Returns
true if there have been no errors. There may have been warnings, though.
Errors& multovl::Errors::operator+= ( const Errors another)

Adds the content of another Errors object to the calling object.

Parameters
anotherError object.
Returns
the calling object.
bool multovl::Errors::perfect ( ) const
inline
Returns
true if there have been neither errors nor warnings. Isn't that nice? :-)
std::ostream& multovl::Errors::print ( std::ostream &  outf,
bool  warnings = true 
) const

Prints the messages to an output stream, one per line.

Parameters
outfthe output stream
warningsif true, then print the warnings as well (this is the default)
unsigned int multovl::Errors::warning_count ( ) const
inline
Returns
the number of warnings seen so far.

The documentation for this class was generated from the following file: