DCMTK  Version 3.6.6
OFFIS DICOM Toolkit
Public Member Functions | Private Attributes | List of all members
OFerror_code Class Reference

OFerror_code is a platform abstracting wrapper for platform specific error codes. More...

Public Member Functions

 OFerror_code ()
 Default constructor. More...
 
 OFerror_code (int code, const OFerror_category &category)
 Constructs an error code from the given arguments. More...
 
void assign (int code, const OFerror_category &category)
 Replaces the contents with the given error code and category. More...
 
void clear ()
 Sets the error code to value 0 (success) and the category to OFsystem_category().
 
int value () const
 Obtains the actual error code. More...
 
const OFerror_categorycategory () const
 Obtains the category linked to this error code. More...
 
OFString message () const
 Constructs an explanatory string for this error code using the linked error category. More...
 

Private Attributes

int m_Code
 holds the error value.
 
const OFerror_categorym_Category
 holds the error category
 

Detailed Description

OFerror_code is a platform abstracting wrapper for platform specific error codes.

Each OFerror_code object holds an error code originating from the operating system or some low-level interface and a pointer to an object of type OFerror_category, which corresponds to the said interface. The error code values may be not unique across different error categories.

Note
This implementation is meant to be a subset of the C++11's std::error_code that lacks the following features: error condition support, iostream category, future category. See: http://en.cppreference.com/w/cpp/error/error_code to compare OFerror_code against std::error_code.

The following table describes the possible operations on two instances a and b of OFerror_code:

ExpressionMeaning
if(a), while(a), ...
Test whether the error code refers to an error message or means that everything went fine. OFTrue if the object refers to an error, OFFalse otherwise.
a != b
Compares two OFerror_code objects, evaluates to OFTrue if both objects refer to a different error code, that is, if either the code or the category (or both) differ, OFFalse otherwise.
a == b
Compares two OFerror_code objects, evaluates to OFTrue if both objects refer to the same error code, that is, if both the code and the category are equal, OFFalse otherwise.
a < b
Implements a total order on OFerror_code objects. Will return OFTrue if the category of a compares less than to the category of b. Will return OFFalse if the category of b compares less than to the category of a. If both objects refer to the same category, they will be ordered using the actual error code integer.

Constructor & Destructor Documentation

◆ OFerror_code() [1/2]

OFerror_code::OFerror_code ( )

Default constructor.

Initializes an error code with value 0 (success) and category OFsystem_category().

◆ OFerror_code() [2/2]

OFerror_code::OFerror_code ( int  code,
const OFerror_category category 
)

Constructs an error code from the given arguments.

Parameters
codethe actual error code.
categorya reference to the OFerror_category that shall be used.

Member Function Documentation

◆ assign()

void OFerror_code::assign ( int  code,
const OFerror_category category 
)

Replaces the contents with the given error code and category.

Parameters
codethe actual error code.
categorya reference to the OFerror_category that shall be used.

◆ category()

const OFerror_category& OFerror_code::category ( ) const

Obtains the category linked to this error code.

Returns
a reference to the linked error category.

◆ message()

OFString OFerror_code::message ( ) const

Constructs an explanatory string for this error code using the linked error category.

Returns
the error message as an OFString.

◆ value()

int OFerror_code::value ( ) const

Obtains the actual error code.

Returns
the error code as an integer.

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


Generated on Thu Jan 14 2021 for DCMTK Version 3.6.6 by Doxygen 1.8.18