cdcontainers  0.1.1
Library of data containers and collections for C programming language.
Functions

Functions

enum cdc_stat cdc_map_ctor (const struct cdc_map_table *table, struct cdc_map **m, struct cdc_data_info *info)
 Constructs an empty map. More...
 
enum cdc_stat cdc_map_ctorl (const struct cdc_map_table *table, struct cdc_map **m, struct cdc_data_info *info,...)
 Constructs a map, initialized by an variable number of pointers on cdc_pair's(first - key, and the second - value). The last item must be CDC_END. More...
 
enum cdc_stat cdc_map_ctorv (const struct cdc_map_table *table, struct cdc_map **m, struct cdc_data_info *info, va_list args)
 Constructs a map, initialized by args. The last item must be CDC_END. More...
 
void cdc_map_dtor (struct cdc_map *m)
 Destroys the map. More...
 

Detailed Description

Function Documentation

◆ cdc_map_ctor()

enum cdc_stat cdc_map_ctor ( const struct cdc_map_table table,
struct cdc_map **  m,
struct cdc_data_info info 
)

Constructs an empty map.

Parameters
[in]table- table of a map implementation. It can be cdc_map_avl, cdc_map_splay, cdc_map_map, cdc_map_htable.
[out]m- cdc_map
[in]info- cdc_data_info
Returns
CDC_STATUS_OK in a successful case or other value indicating an error.

Example of map constracting with hash table implementation:

struct cdc_map *map = NULL;
...
// handle error
}

◆ cdc_map_ctorl()

enum cdc_stat cdc_map_ctorl ( const struct cdc_map_table table,
struct cdc_map **  m,
struct cdc_data_info info,
  ... 
)

Constructs a map, initialized by an variable number of pointers on cdc_pair's(first - key, and the second - value). The last item must be CDC_END.

Parameters
[in]table- table of a map implementation. It can be cdc_map_avl, cdc_map_splay, cdc_map_map, cdc_map_htable.
[out]m- cdc_map
[in]info- cdc_data_info
Returns
CDC_STATUS_OK in a successful case or other value indicating an error.

Example:

struct cdc_map *map = NULL;
...
if (cdc_map_ctorl(cdc_map_avl, &tree, info, &value1, &value2, CDC_END) != CDC_STATUS_OK) {
// handle error
}

◆ cdc_map_ctorv()

enum cdc_stat cdc_map_ctorv ( const struct cdc_map_table table,
struct cdc_map **  m,
struct cdc_data_info info,
va_list  args 
)

Constructs a map, initialized by args. The last item must be CDC_END.

Parameters
[in]table- table of a map implementation. It can be cdc_map_avl, cdc_map_splay, cdc_map_map, cdc_map_htable.
[out]m- cdc_map
[in]info- cdc_data_info
Returns
CDC_STATUS_OK in a successful case or other value indicating an error.

◆ cdc_map_dtor()

void cdc_map_dtor ( struct cdc_map m)

Destroys the map.

Parameters
[in]t- cdc_map