Next: , Previous: , Up: conditions   [Contents][Index]


6.13 The errno exceptional–condition object

The errno exceptional–condition object–type has the purpose of describing an exceptional condition caused by a system function setting errno. This exceptional–condition object–type is not meant to be subtyped.

All the following definitions are accessible from the header file ccexceptions.h.

Struct Typedef: cce_descriptor_errno_t

Structure type representing the exceptional–condition object–type descriptor. This descriptor has the descriptor cce_descriptor_runtime_error_t as parent. It has the following public fields:

cce_descriptor_t descriptor

Core values of the exceptional–condition object–type descriptor.

Struct Typedef: cce_condition_errno_t

Structure type representing an errno exceptional–condition object, signalled by a system function by setting errno to a non–zero value. It has the following public fields:

cce_condition_runtime_error_t runtime_error

Core values of the exceptional–condition object–type descriptor.

int errnum

The value of errno.

char const * message

A statically allocated ASCIIZ string describing the error.

Function: cce_condition_t const * cce_condition_new_errno (int errnum)

Given the errno code errnum, return a pointer to the exceptional–condition object associated to it.

If errnum is zero: return a pointer to an exceptional–condition object representing a successful operation. If errnum is not a valid errno code for the underlying platform: return a pointer to an exceptional–condition object representing an invalid code.

Function: cce_condition_t const * cce_condition_new_errno_clear (void)

Consume the current value of errno and return the return value of cce_condition_new_errno() applied to it. Before returning: errno is reset to zero.

Function: bool cce_condition_is_errno (cce_condition_t const * C)

Return true if the exceptional–condition object referenced by C is of type cce_condition_errno_t or it is derived from it; otherwise return false.

Function: bool cce_condition_is_errno_with_code (cce_condition_t const * C, int errnum)

Return true if the exceptional–condition object referenced by C is of type cce_condition_errno_t, or it is derived from it, and its error code equals errnum; otherwise return false.

Facilities to derive an exceptional–condition object subtype

When deriving a subtype from cce_condition_errno_t we need the following functions.

Function: void cce_descriptor_set_parent_to(cce_descriptor_errno_t) (cce_descriptor_t * D)

Mutate the exceptional–condition object–type descriptor referenced by D so that its parent is the descriptor of cce_descriptor_errno_t. We should call this function in the initialisation module of the derived type.

Function: void cce_condition_init_errno (cce_condition_errno_t * C, int errum)

Initialise an already allocated exceptional–condition object. We should call this function from the initialisation function of the derived type.

Structure field getters

Function: int cce_condition_ref_errno_errnum (cce_condition_t const * C)

Return the value of the field errnum in the exceptional–condition object referenced by C, which must be of type cce_condition_errno_t

Function: char const * cce_condition_ref_errno_message (cce_condition_t const * C)

Return the value of the field message in the exceptional–condition object referenced by C, which must be of type cce_condition_errno_t


Next: , Previous: , Up: conditions   [Contents][Index]

This document describes version 0.9.0-devel.3 of CCExceptions.