DCMTK: OFerror_code Class Reference

DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
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.
| OFerror_code (int code, const OFerror_category &category)
| Constructs an error code from the given arguments.
void | assign (int code, const OFerror_category &category)
| Replaces the contents with the given error code and category.
void | clear ()
| Sets the error code to value 0 (success) and the category to OFsystem_category().
int | value () const
| Obtains the actual error code.
const OFerror_category & | category () const
| Obtains the category linked to this error code.
OFString | message () const
| Constructs an explanatory string for this error code using the linked error category.

## Private Attributes
int | m_Code
| holds the error value.
const OFerror_category * | m_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:

Expression | Meaning
--- | ---
`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().

Referenced by message().

## ◆ OFerror_code() [2/2]

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

Constructs an error code from the given arguments.

Parameters

  code | the actual error code.
  category | a reference to the OFerror_category that shall be used.

References category().

## 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

  code | the actual error code.
  category | a reference to the OFerror_category that shall be used.

References category().

## ◆ category()

const OFerror_category & OFerror_code::category | ( |  | ) | const

Obtains the category linked to this error code.

Returns
  a reference to the linked error category.

Referenced by OFerror_code(), and assign().

## ◆ 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.

References OFerror_code().

## ◆ 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:

- ofstd/include/dcmtk/ofstd/oferror.h

Generated on for DCMTK Version 3.7.0 by Doxygen 1.16.1