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


6.3 Exceptional-condition objects

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

Struct Typedef: cce_condition_t

Type of structure representing an exceptional–condition object. It has the following public fields:

cce_descriptor_t const * descriptor

Pointer to the descriptor of the exceptional–condition object–type.

Function: void cce_condition_init (cce_condition_t * C, cce_descriptor_t const * D)

Initialise the core fields of an already allocated condition object. The argument D must be a pointer to the descriptor: it is stored in the object referenced by C. This function is usually called from a type–specific constructor function.

Function: void cce_condition_final (cce_condition_t * C)

Usually we do not need to call this function directly; rather, we should use cce_condition_delete().

Traverse, from leaf to root, the hierarchy of descriptors for the type of the exceptional–condition object referenced by C: apply to C the final functions referenced by the descriptors’ functions tables. The finalisation functions are applied from leaf to root.

Function: void cce_condition_delete (cce_condition_t * C)

Apply cce_condition_final() to C; then apply to C the delete function referenced by the descriptor’s functions table.

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

Apply to C the static_message function referenced by its descriptor’s functions table.

Function: bool cce_condition_is (cce_condition_t const * C, cce_descriptor_t const * D)

Determine if an object is of a selected object–type. Return true if the object referenced by C is an instance of the type whose descriptor is referenced by D, or an instance of a type that is an ancestor of such descriptor; otherwise return false.

Generic Macro: cce_condition_t * cce_condition (X)

This generic macro dispatches its expansion according to its argument’s type:

This generic macro performs compile–time type–checking so that the cast operation is applied only on values of suitable types; we can apply this macro to pointers to all the types defined by CCExceptions for which it makes sense.

This macro allows us to compare pointers without raising a warning:

cce_condition_errno_t * A = ...;
cce_condition_t *       B = ...;

/* This raises a warning: */
A == B;

/* This does not raise a warning: */
cce_condition(A) == cce_condition(B);

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

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