Options
[HMap]

Functions

int u_hmap_opts_new (u_hmap_opts_t **opts)
 Create new hmap options.
void u_hmap_opts_free (u_hmap_opts_t *opts)
 Deallocate hmap options.
void u_hmap_opts_init (u_hmap_opts_t *opts)
 Initialise hmap options.
int u_hmap_opts_copy (u_hmap_opts_t *to, u_hmap_opts_t *from)
 Copy options.
void u_hmap_opts_dbg (u_hmap_opts_t *opts)
 Debug options.
int u_hmap_opts_set_size (u_hmap_opts_t *opts, int sz)
 Set initial size of hmap's dynamic array.
int u_hmap_opts_set_max (u_hmap_opts_t *opts, int max)
 Set maximum number of elements.
int u_hmap_opts_set_type (u_hmap_opts_t *opts, u_hmap_type_t type)
 Set type of hmap.
int u_hmap_opts_set_option (u_hmap_opts_t *opts, int option)
 Set option in options mask (hmap_easy interface cannot operate on U_HMAP_OPTS_OWNSDATA).
int u_hmap_opts_unset_option (u_hmap_opts_t *opts, int option)
 Unset option in options mask (hmap_easy interface cannot operate on U_HMAP_OPTS_OWNSDATA).
int u_hmap_opts_set_hashfunc (u_hmap_opts_t *opts, size_t(*f_hash)(const void *key, size_t buckets))
 Set a custom hash function.
int u_hmap_opts_set_compfunc (u_hmap_opts_t *opts, int(*f_comp)(const void *k1, const void *k2))
 Set a custom key comparison function.
int u_hmap_opts_set_freefunc (u_hmap_opts_t *opts, void(*f_free)(u_hmap_o_t *obj))
 Set a custom object free function (not available for hmap_easy interface).
int u_hmap_opts_set_strfunc (u_hmap_opts_t *opts, u_string_t *(*f_str)(u_hmap_o_t *obj))
 Set a custom string representation for objects.
int u_hmap_opts_set_key_type (u_hmap_opts_t *opts, u_hmap_options_datatype_t type)
 Set type for keys (not available for hmap_easy interface).
int u_hmap_opts_set_key_sz (u_hmap_opts_t *opts, size_t sz)
 Set size of keys (not available for hmap_easy interface, only valid for U_HMAP_OPTS_DATATYPE_OPAQUE key type).
int u_hmap_opts_set_key_freefunc (u_hmap_opts_t *opts, void(*f_free)(const void *key))
 Set free function for keys (not available for hmap_easy interface).
int u_hmap_opts_set_val_type (u_hmap_opts_t *opts, u_hmap_options_datatype_t type)
 Set type of values.
int u_hmap_opts_set_val_sz (u_hmap_opts_t *opts, size_t sz)
 Set size of values (only valid for U_HMAP_OPTS_DATATYPE_OPAQUE key type).
int u_hmap_opts_set_val_freefunc (u_hmap_opts_t *opts, void(*f_free)(void *val))
 Set free function for values.

Function Documentation

int u_hmap_opts_copy ( u_hmap_opts_t *  to,
u_hmap_opts_t *  from 
)

Perform a deep copy of options object from to to.

Parameters:
to destination options
from source options
Return values:
U_HMAP_ERR_NONE on success
U_HMAP_ERR_FAIL on failure

Definition at line 1162 of file srcs/toolbox/hmap.c.

Referenced by u_hmap_easy_new(), and u_hmap_new().

void u_hmap_opts_dbg ( u_hmap_opts_t *  opts  ) 

Print out information on option settings.

Parameters:
opts options object

Definition at line 1181 of file srcs/toolbox/hmap.c.

References U_HMAP_OPTS_NO_OVERWRITE, and U_HMAP_OPTS_OWNSDATA.

Referenced by u_hmap_new().

void u_hmap_opts_free ( u_hmap_opts_t *  opts  ) 

Deallocate hmap options object opts.

Parameters:
opts hmap options

Definition at line 1112 of file srcs/toolbox/hmap.c.

References u_free().

Referenced by u_hmap_free(), and u_json_index().

void u_hmap_opts_init ( u_hmap_opts_t *  opts  ) 

Set allocated hmap options to default values

Parameters:
opts hmap options object

Definition at line 1126 of file srcs/toolbox/hmap.c.

References U_HMAP_OPTS_DATATYPE_POINTER, U_HMAP_OPTS_DATATYPE_STRING, U_HMAP_OPTS_NO_OVERWRITE, U_HMAP_OPTS_OWNSDATA, U_HMAP_PCY_NONE, and U_HMAP_TYPE_CHAIN.

Referenced by u_hmap_easy_new(), and u_hmap_opts_new().

int u_hmap_opts_new ( u_hmap_opts_t **  opts  ) 

Create a new hmap options object and save its pointer to *opts. The fields within the object can be manipulated publicly according to the description in the header file.

Parameters:
opts on success contains the hmap options object
Return values:
U_HMAP_ERR_NONE on success
U_HMAP_ERR_FAIL on failure

Definition at line 1086 of file srcs/toolbox/hmap.c.

References u_hmap_opts_init(), and u_zalloc().

Referenced by u_hmap_new(), and u_json_index().

int u_hmap_opts_set_max ( u_hmap_opts_t *  opts,
int  max 
)

This limit is used only if a discard policy has been set via u_hmap_opts_set_policy(); otherwise the hmap is simply resized.

Definition at line 1222 of file srcs/toolbox/hmap.c.


←Products
© 2005-2012 - KoanLogic S.r.l. - All rights reserved