Public Member Functions | Protected Member Functions | Protected Attributes
ecl::Error Class Reference

The primary error handler for ecl libraries. More...

#include <handlers.hpp>

List of all members.

Public Member Functions

 Error (const ErrorFlag &flag=UnknownError)
 Configure the return type with an error flag.
virtual ErrorFlag flag () const
 The flag identifying the error identified with this error handler.
virtual void operator= (const ErrorFlag &error)
virtual void print (const char *loc)
 Print a location dependant message to standard out.
virtual const char * what () const
 A simple string verbosely representing the error that is handled.

Protected Member Functions

virtual const char * argNotSupportedErrorString () const
virtual const char * blockingErrorString () const
virtual const char * busyErrorString () const
virtual const char * closeErrorString () const
virtual const char * configurationErrorString () const
virtual const char * connectErrorString () const
virtual const char * connectionRefusedString () const
virtual const char * constructorErrorString () const
virtual const char * conversionErrorString () const
virtual const char * destructorErrorString () const
virtual const char * interruptedErrorString () const
virtual const char * invalidArgErrorString () const
virtual const char * invalidObjectErrorString () const
virtual const char * isLockedErrorString () const
virtual const char * isTimeOutErrorString () const
virtual const char * memoryErrorString () const
virtual const char * noErrorString () const
virtual const char * notFoundErrorString () const
virtual const char * notInitialisedErrorString () const
virtual const char * notSupportedErrorString () const
virtual const char * openErrorString () const
virtual const char * outOfRangeErrorString () const
virtual const char * outOfResourcesErrorString () const
virtual const char * permissionsErrorString () const
virtual const char * raiiErrorString () const
virtual const char * readErrorString () const
virtual const char * systemFailureErrorString () const
virtual const char * unknownErrorString () const
virtual const char * usageErrorString () const
virtual const char * writeErrorString () const

Protected Attributes

ErrorFlag error_flag

Detailed Description

The primary error handler for ecl libraries.

This class is mostly used as the return type for ecl functions to indicate errors.

 Error f(const int &i) {
    if ( i == 3 ) {
        return Error(NoError);
    else {
        return Error(OutOfRangeError);
    }
 }

 // code

 Error error = f(5);
 if ( error.flag() != NoError ) {
     std::cout << error.what() << std::endl; // OR
     error.print(LOC);   // for a verbose message with code location added.
 }

Alternatively the class can be inherited and the verbose messages overloaded. Refer to the TimeError class in ecl_time_lite for an example.

Definition at line 58 of file handlers.hpp.


Constructor & Destructor Documentation

ecl::Error::Error ( const ErrorFlag &  flag = UnknownError) [inline]

Configure the return type with an error flag.

Parameters:
flag: the type of error that is to be returned.

Definition at line 65 of file handlers.hpp.


Member Function Documentation

virtual const char* ecl::Error::argNotSupportedErrorString ( ) const [inline, protected, virtual]

Definition at line 155 of file handlers.hpp.

virtual const char* ecl::Error::blockingErrorString ( ) const [inline, protected, virtual]

Definition at line 160 of file handlers.hpp.

virtual const char* ecl::Error::busyErrorString ( ) const [inline, protected, virtual]

Definition at line 157 of file handlers.hpp.

virtual const char* ecl::Error::closeErrorString ( ) const [inline, protected, virtual]

Definition at line 144 of file handlers.hpp.

virtual const char* ecl::Error::configurationErrorString ( ) const [inline, protected, virtual]

Definition at line 146 of file handlers.hpp.

virtual const char* ecl::Error::connectErrorString ( ) const [inline, protected, virtual]

Definition at line 147 of file handlers.hpp.

virtual const char* ecl::Error::connectionRefusedString ( ) const [inline, protected, virtual]

Definition at line 166 of file handlers.hpp.

virtual const char* ecl::Error::constructorErrorString ( ) const [inline, protected, virtual]

Definition at line 140 of file handlers.hpp.

virtual const char* ecl::Error::conversionErrorString ( ) const [inline, protected, virtual]

Definition at line 142 of file handlers.hpp.

virtual const char* ecl::Error::destructorErrorString ( ) const [inline, protected, virtual]

Definition at line 141 of file handlers.hpp.

virtual ErrorFlag ecl::Error::flag ( ) const [inline, virtual]

The flag identifying the error identified with this error handler.

Returns:
ErrorFlag : the error flag.

Definition at line 71 of file handlers.hpp.

virtual const char* ecl::Error::interruptedErrorString ( ) const [inline, protected, virtual]

Definition at line 159 of file handlers.hpp.

virtual const char* ecl::Error::invalidArgErrorString ( ) const [inline, protected, virtual]

Definition at line 145 of file handlers.hpp.

virtual const char* ecl::Error::invalidObjectErrorString ( ) const [inline, protected, virtual]

Definition at line 162 of file handlers.hpp.

virtual const char* ecl::Error::isLockedErrorString ( ) const [inline, protected, virtual]

Definition at line 163 of file handlers.hpp.

virtual const char* ecl::Error::isTimeOutErrorString ( ) const [inline, protected, virtual]

Definition at line 164 of file handlers.hpp.

virtual const char* ecl::Error::memoryErrorString ( ) const [inline, protected, virtual]

Definition at line 152 of file handlers.hpp.

virtual const char* ecl::Error::noErrorString ( ) const [inline, protected, virtual]

Definition at line 138 of file handlers.hpp.

virtual const char* ecl::Error::notFoundErrorString ( ) const [inline, protected, virtual]

Definition at line 165 of file handlers.hpp.

virtual const char* ecl::Error::notInitialisedErrorString ( ) const [inline, protected, virtual]

Definition at line 150 of file handlers.hpp.

virtual const char* ecl::Error::notSupportedErrorString ( ) const [inline, protected, virtual]

Definition at line 156 of file handlers.hpp.

virtual const char* ecl::Error::openErrorString ( ) const [inline, protected, virtual]

Definition at line 143 of file handlers.hpp.

virtual void ecl::Error::operator= ( const ErrorFlag &  error) [inline, virtual]

Definition at line 72 of file handlers.hpp.

virtual const char* ecl::Error::outOfRangeErrorString ( ) const [inline, protected, virtual]

Definition at line 139 of file handlers.hpp.

virtual const char* ecl::Error::outOfResourcesErrorString ( ) const [inline, protected, virtual]

Definition at line 158 of file handlers.hpp.

virtual const char* ecl::Error::permissionsErrorString ( ) const [inline, protected, virtual]

Definition at line 151 of file handlers.hpp.

virtual void ecl::Error::print ( const char *  loc) [inline, virtual]

Print a location dependant message to standard out.

Usage:

 Error error = f(5);
 if ( error.flag() != NoError ) {
     error.print(LOC);
 }
Parameters:
loc: use with the LOC macro.

Definition at line 93 of file handlers.hpp.

virtual const char* ecl::Error::raiiErrorString ( ) const [inline, protected, virtual]

Definition at line 154 of file handlers.hpp.

virtual const char* ecl::Error::readErrorString ( ) const [inline, protected, virtual]

Definition at line 148 of file handlers.hpp.

virtual const char* ecl::Error::systemFailureErrorString ( ) const [inline, protected, virtual]

Definition at line 161 of file handlers.hpp.

virtual const char* ecl::Error::unknownErrorString ( ) const [inline, protected, virtual]

Definition at line 167 of file handlers.hpp.

virtual const char* ecl::Error::usageErrorString ( ) const [inline, protected, virtual]

Definition at line 153 of file handlers.hpp.

virtual const char* ecl::Error::what ( ) const [inline, virtual]

A simple string verbosely representing the error that is handled.

Returns:
const char* : verbose representation of the error.

Definition at line 102 of file handlers.hpp.

virtual const char* ecl::Error::writeErrorString ( ) const [inline, protected, virtual]

Definition at line 149 of file handlers.hpp.


Member Data Documentation

ErrorFlag ecl::Error::error_flag [protected]

Definition at line 169 of file handlers.hpp.


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


ecl_errors
Author(s): Daniel Stonier (d.stonier@gmail.com)
autogenerated on Thu Jan 2 2014 11:11:33