cu/bistptr.h: Bi-Strength Pointer
[Utilities]

Data Structures

struct  cu_bistptr_t

Functions

cu_bool_t cu_bistptr_is_weak (cu_bistptr_t *bsp)
cu_bool_t cu_bistptr_is_strong (cu_bistptr_t *bsp)
void * cu_bistptr_get_weak (cu_bistptr_t *bsp)
void * cu_bistptr_get_strong (cu_bistptr_t *bsp)
void * cu_bistptr_get (cu_bistptr_t *bsp)
void cu_bistptr_init_weak (cu_bistptr_t *bsp, void *obj)
void cu_bistptr_init_strong (cu_bistptr_t *bsp, void *obj)
void cu_bistptr_deinit (cu_bistptr_t *bsp)
void cu_bistptr_assign_weak (cu_bistptr_t *bsp, void *obj)
void cu_bistptr_assign_strong (cu_bistptr_t *bsp, void *obj)

Detailed Description

This header implements a discriminated union of a strong and a weak pointer, but with the restriction that all pointers stored must be even, e.g. due to alignment.

See also:
cu/weakptr.h: Weak Pointers "cu/weakptr.h"

Function Documentation

void cu_bistptr_assign_strong ( cu_bistptr_t bsp,
void *  obj 
)

Reinitialise bsp to hold a strong pointer to obj.

Precondition:
obj is aligned to an even address.
void cu_bistptr_assign_weak ( cu_bistptr_t bsp,
void *  obj 
)

Reinitialise bsp to hold a weak pointer to obj.

Precondition:
obj is aligned to an even address and points to or inside collectable memory.
void cu_bistptr_deinit ( cu_bistptr_t bsp  ) 

Deininialise bsp. If bsp holds a weak pointer, this unregisters the corresponding disappearing link.

void* cu_bistptr_get ( cu_bistptr_t bsp  ) 

Returns the pointer stored in bsp, independent of strength.

void* cu_bistptr_get_strong ( cu_bistptr_t bsp  ) 

Returns the strong pointer of bsp.

Precondition:
cu_bistptr_is_strong(ptr)
void* cu_bistptr_get_weak ( cu_bistptr_t bsp  ) 

Returns the weak pointer held by bsp.

Precondition:
cu_bistptr_is_weak(ptr)
void cu_bistptr_init_strong ( cu_bistptr_t bsp,
void *  obj 
)

Initialise bsp to a strong pointer to obj.

Precondition:
obj is aligned to an even address.
void cu_bistptr_init_weak ( cu_bistptr_t bsp,
void *  obj 
)

Initialise bsp to a weak pointer to obj.

Precondition:
obj is aligned to an even address and points to or inside collectable memory.
cu_bool_t cu_bistptr_is_strong ( cu_bistptr_t bsp  ) 

The complement of cu_bistptr_is_weak, for symmetry.

cu_bool_t cu_bistptr_is_weak ( cu_bistptr_t bsp  ) 

True iff bsp is a weak pointer. The NULL pointer counts as strong.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.