SheafSystem  0.0.0.0
sheaf::error_message Class Reference

A message to report error conditions. More...

#include <error_message.h>

Public Types

enum  level_type {
  UNSPECIFIED = 0, INFORMATION, WARNING, SEVERE_ERROR,
  FATAL_ERROR, LEVEL_TYPE_UB
}
 The set of predefined error levels. More...
 

Public Member Functions

 error_message ()
 Default constructor. More...
 
 error_message (const error_message &xother)
 Copy constructor. More...
 
error_messageoperator= (const error_message &xother)
 Assignment operator. More...
 
virtual ~error_message ()
 Destructor. More...
 
 error_message (level_type xlevel, const std::string &xsource, const std::string &xtext)
 Creates an instance with level xlevel, source xsource, and text xtext. More...
 
 error_message (level_type xlevel, const std::string &xfile, int xline, const std::string &xtext)
 Creates an instance with level xlevel, source file xfile, source line number xline, and text xtext. More...
 
std::string source () const
 The source of this message. More...
 
std::string text () const
 The text of this message. More...
 
level_type level () const
 The level of this message. More...
 
void post (bool xforce_exit=false) const
 Registers this message with the message handling subsystem. More...
 

Static Public Member Functions

static const std::string & level_name (level_type xlevel)
 The name of level xlevel. More...
 

Detailed Description

A message to report error conditions.

Definition at line 37 of file error_message.h.

Member Enumeration Documentation

◆ level_type

The set of predefined error levels.

Definition at line 69 of file error_message.h.

Constructor & Destructor Documentation

◆ error_message() [1/4]

sheaf::error_message::error_message ( )

Default constructor.

Postcondition

Definition at line 35 of file error_message.cc.

Referenced by error_message(), and ~error_message().

◆ error_message() [2/4]

sheaf::error_message::error_message ( const error_message xother)

Copy constructor.

Postcondition

Definition at line 63 of file error_message.cc.

References level(), operator=(), and text().

◆ ~error_message()

sheaf::error_message::~error_message ( )
virtual

Destructor.

Definition at line 113 of file error_message.cc.

References error_message().

Referenced by operator=().

◆ error_message() [3/4]

sheaf::error_message::error_message ( level_type  xlevel,
const std::string &  xsource,
const std::string &  xtext 
)

Creates an instance with level xlevel, source xsource, and text xtext.

Precondition
  • xlevel != LEVEL_TYPE_UB
  • !xsource.empty()
  • !xtext.empty()
Postcondition

Definition at line 134 of file error_message.cc.

References error_message().

◆ error_message() [4/4]

sheaf::error_message::error_message ( level_type  xlevel,
const std::string &  xfile,
int  xline,
const std::string &  xtext 
)

Creates an instance with level xlevel, source file xfile, source line number xline, and text xtext.

Precondition
  • xlevel != LEVEL_TYPE_UB
  • !xfile.empty()
Postcondition

Definition at line 163 of file error_message.cc.

References source().

Member Function Documentation

◆ level()

sheaf::error_message::level_type sheaf::error_message::level ( ) const

The level of this message.

Definition at line 215 of file error_message.cc.

References post().

Referenced by error_message(), sheaf::operator<<(), operator=(), and text().

◆ level_name()

const std::string & sheaf::error_message::level_name ( level_type  xlevel)
static

The name of level xlevel.

Precondition
  • (0 <= xlevel ) && (xlevel < LEVEL_TYPE_UB)
Postcondition
  • !result.empty()

Definition at line 255 of file error_message.cc.

Referenced by post().

◆ operator=()

sheaf::error_message & sheaf::error_message::operator= ( const error_message xother)

Assignment operator.

Postcondition

Definition at line 86 of file error_message.cc.

References level(), source(), text(), and ~error_message().

Referenced by error_message().

◆ post()

void sheaf::error_message::post ( bool  xforce_exit = false) const

Registers this message with the message handling subsystem.

Hack:
just print the message and quit if the error is severe enough.

Definition at line 223 of file error_message.cc.

References level_name().

Referenced by level().

◆ source()

std::string sheaf::error_message::source ( ) const

The source of this message.

Definition at line 199 of file error_message.cc.

References text().

Referenced by error_message(), sheaf::operator<<(), and operator=().

◆ text()

std::string sheaf::error_message::text ( ) const

The text of this message.

Definition at line 207 of file error_message.cc.

References level().

Referenced by error_message(), sheaf::operator<<(), operator=(), and source().


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