Next: conditions objects, Previous: conditions intro, Up: conditions [Contents][Index]
All the following definitions are accessible from the header file ccexceptions.h.
Structure type representing exceptional–condition object–type descriptors; it holds a table of function pointers to handle exceptional–condition objects. It has the following fields:
cce_descriptor_t const * parentPointer to the descriptor that is parent of this one in the tree hierarchy. This pointer is set to
NULL only for the root condition descriptor, See Predefined root condition
descriptor.
cce_condition_final_fun_t * deletePointer to function releasing the exceptional–condition object’s memory block itself. This pointer
can be NULL, meaning that: the object is statically allocated.
cce_condition_final_fun_t * finalPointer to function releasing all the dynamic resources associated to the exceptional–condition
object. This pointer can be NULL, meaning that: there are no dynamic resources.
cce_condition_static_message_fun_t * static_messagePointer to function returning a statically allocated ASCIIZ string describing the exceptional–condition.
Release all the dynamic resources associated to C; leave untouched the memory block holding
the cce_condition_t instance itself.
Release the memory block referenced by C, if appropriate. If the structure is allocated with
malloc(), the delete function can just be:
void
my_condition_delete_stuff (my_condition_stuff_t * C)
{
free(C);
}
Return a statically allocated ASCIIZ string describing the exceptional–condition. A static message must always be defined; another client–defined function can build a dynamic and more descriptive message.
For example, an instance of this function can be:
char const *
my_condition_static_message_stuff (my_condition_stuff_t const * C)
{
return "error doing stuff";
}
Establish if two condition descriptors are child and ancestor. Return true if child is
equal to ancestor or ancestor is in the hierarchy of child’s ancestors; otherwise
return false.
This generic macro dispatches its expansion according to its argument’s type:
cce_descriptor_t.
cce_descriptor_t.
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.
Expand into the name of a function that we can use to set the parent of a descriptor to the given TYPE descriptor.
Expand into:
&((EXCEPTIONAL_CONDITION_DESCRIPTOR_VARIABLE).descriptor)
Given an exceptional-condition descriptor struct defined as:
typedef struct descr_t descr_t;
struct descr_t {
cce_descriptor_t descriptor;
};
descr_t my_descriptor_descr = { ... };
this macro is used as:
cce_descriptor_pointer(my_descriptor_descr)
to expand into:
&((my_descriptor_descr).descriptor)
Next: conditions objects, Previous: conditions intro, Up: conditions [Contents][Index]
This document describes version 0.9.0-devel.3 of CCExceptions.