ucx
UAP Common Extensions
Loading...
Searching...
No Matches
Macros | Typedefs
collection.h File Reference

Common definitions for various collection implementations. More...

#include "allocator.h"
#include "iterator.h"

Go to the source code of this file.

Macros

#define CX_STORE_POINTERS   0
 Special constant used for creating collections that are storing pointers.
 
#define CX_COLLECTION_MEMBERS
 Use this macro to declare common members for a collection structure.
 
#define cx_invoke_simple_destructor(c, e)    (c)->simple_destructor((c)->store_pointer ? (*((void **) (e))) : (e))
 Invokes the simple destructor function for a specific element.
 
#define cx_invoke_advanced_destructor(c, e)
 Invokes the advanced destructor function for a specific element.
 
#define cx_invoke_destructor(c, e)
 Invokes all available destructor functions for a specific element.
 

Typedefs

typedef int(* cx_compare_func) (void const *left, void const *right)
 A comparator function comparing two collection elements.
 

Detailed Description

Common definitions for various collection implementations.

Author
Mike Becker
Olaf Wintermann
Version
3.0

Macro Definition Documentation

◆ cx_invoke_advanced_destructor

#define cx_invoke_advanced_destructor (   c,
 
)
Value:
(c)->advanced_destructor((c)->destructor_data, \
(c)->store_pointer ? (*((void **) (e))) : (e))

Invokes the advanced destructor function for a specific element.

Usually only used by collection implementations. There should be no need to invoke this macro manually.

Parameters
cthe collection
ethe element

◆ cx_invoke_destructor

#define cx_invoke_destructor (   c,
 
)
Value:
if ((c)->simple_destructor) cx_invoke_simple_destructor(c,e); \
if ((c)->advanced_destructor) cx_invoke_advanced_destructor(c,e)
#define cx_invoke_advanced_destructor(c, e)
Invokes the advanced destructor function for a specific element.
Definition: collection.h:102
#define cx_invoke_simple_destructor(c, e)
Invokes the simple destructor function for a specific element.
Definition: collection.h:90

Invokes all available destructor functions for a specific element.

Usually only used by collection implementations. There should be no need to invoke this macro manually.

Parameters
cthe collection
ethe element

◆ cx_invoke_simple_destructor

#define cx_invoke_simple_destructor (   c,
 
)     (c)->simple_destructor((c)->store_pointer ? (*((void **) (e))) : (e))

Invokes the simple destructor function for a specific element.

Usually only used by collection implementations. There should be no need to invoke this macro manually.

Parameters
cthe collection
ethe element