All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Fields | Related Functions
as_map Struct Reference

Detailed Description

as_map is an interface for Map based data types.

Implementations:

Definition at line 61 of file as_map.h.

#include "as_map.h"

+ Inheritance diagram for as_map:
+ Collaboration diagram for as_map:

Data Fields

uint32_t flags
 
const struct as_map_hooks_s * hooks
 
- Data Fields inherited from as_val
uint32_t count
 
bool free
 
as_val_t type
 

Related Functions

(Note that these are not member functions.)

static int as_map_clear (as_map *map)
 
AS_EXTERN as_mapas_map_cons (as_map *map, bool free, uint32_t flags, const as_map_hooks *hooks)
 
static void as_map_destroy (as_map *map)
 
static bool as_map_foreach (const as_map *map, as_map_foreach_callback callback, void *udata)
 
static as_mapas_map_fromval (const as_val *val)
 
static as_valas_map_get (const as_map *map, const as_val *key)
 
static uint32_t as_map_hashcode (const as_map *map)
 
AS_EXTERN as_mapas_map_init (as_map *map, const as_map_hooks *hooks)
 
static union as_map_iterator_u * as_map_iterator_init (union as_map_iterator_u *it, const as_map *map)
 
static union as_map_iterator_u * as_map_iterator_new (const as_map *map)
 
AS_EXTERN as_mapas_map_new (const as_map_hooks *hooks)
 
static int as_map_remove (as_map *map, const as_val *key)
 
static int as_map_set (as_map *map, const as_val *key, const as_val *val)
 
static void as_map_set_flags (as_map *map, uint32_t flags)
 
static uint32_t as_map_size (const as_map *map)
 
static as_valas_map_toval (const as_map *map)
 

Friends And Related Function Documentation

static int as_map_clear ( as_map map)
related

Remove all entries from the map.

Parameters
mapThe map.
Returns
0 on success. Otherwise an error occurred.

Definition at line 330 of file as_map.h.

AS_EXTERN as_map * as_map_cons ( as_map map,
bool  free,
uint32_t  flags,
const as_map_hooks hooks 
)
related

Utilized by subtypes of as_map to initialize the parent.

Parameters
mapThe map to initialize
freeIf TRUE, then as_map_destory() will free the map.
flagsMap attributes.
hooksImplementaton for the map interface.
Returns
The initialized as_map on success. Otherwise NULL.
static void as_map_destroy ( as_map map)
related

Destroy the as_map and associated resources.

Definition at line 254 of file as_map.h.

static bool as_map_foreach ( const as_map map,
as_map_foreach_callback  callback,
void *  udata 
)
related

Call the callback function for each entry in the map.

Parameters
mapThe map.
callbackThe function to call for each entry.
udataUser-data to be passed to the callback.
Returns
true if iteration completes fully. false if iteration was aborted.

Definition at line 375 of file as_map.h.

static as_map * as_map_fromval ( const as_val val)
related

Convert from an as_val.

Definition at line 424 of file as_map.h.

static as_val * as_map_get ( const as_map map,
const as_val key 
)
related

Get the value for specified key.

Parameters
mapThe map.
keyThe key.
Returns
The value for the specified key on success. Otherwise NULL.

Definition at line 302 of file as_map.h.

static uint32_t as_map_hashcode ( const as_map map)
related

Hash value for the map

Parameters
mapThe map
Returns
The hashcode value of the map.

Definition at line 271 of file as_map.h.

AS_EXTERN as_map * as_map_init ( as_map map,
const as_map_hooks hooks 
)
related

Initialize a stack allocated map.

Parameters
mapStack allocated map to initialize.
hooksImplementation for the map interface.
Returns
On success, the initialized map. Otherwise NULL.
static union as_map_iterator_u * as_map_iterator_init ( union as_map_iterator_u *  it,
const as_map map 
)
related

Initialzies a stack allocated iterator over the given map.

Parameters
mapThe map to iterate.
itThe iterator to initialize.
Returns
On success, the initializes as_iterator. Otherwise NULL.

Definition at line 402 of file as_map.h.

static union as_map_iterator_u * as_map_iterator_new ( const as_map map)
related

Creates and initializes a new heap allocated iterator over the given map.

Parameters
mapThe map to iterate.
Returns
On success, a new as_iterator. Otherwise NULL.

Definition at line 388 of file as_map.h.

AS_EXTERN as_map * as_map_new ( const as_map_hooks hooks)
related

Create and initialize a new heap allocated map.

Parameters
hooksImplementation for the map interface.
Returns
On success, a new map. Otherwise NULL.
static int as_map_remove ( as_map map,
const as_val key 
)
related

Remove the entry specified by the key.

Parameters
mapThe map to remove the entry from.
keyThe key of the entry to be removed.
Returns
0 on success. Otherwise an error occurred.

Definition at line 345 of file as_map.h.

static int as_map_set ( as_map map,
const as_val key,
const as_val val 
)
related

Set the value for specified key.

Parameters
mapThe map.
keyThe key.
valThe value for the key.
Returns
0 on success. Otherwise an error occurred.

Definition at line 317 of file as_map.h.

static void as_map_set_flags ( as_map map,
uint32_t  flags 
)
related

Set map attributes.

Definition at line 355 of file as_map.h.

static uint32_t as_map_size ( const as_map map)
related

Get the number of entries in the map.

Parameters
mapThe map
Returns
The size of the map.

Definition at line 284 of file as_map.h.

static as_val * as_map_toval ( const as_map map)
related

Convert to an as_val.

Definition at line 415 of file as_map.h.

Field Documentation

uint32_t as_map::flags

Information for this instance of as_map.

Definition at line 73 of file as_map.h.

const struct as_map_hooks_s* as_map::hooks

Hooks for subtypes of as_map to implement.

Definition at line 78 of file as_map.h.


The documentation for this struct was generated from the following file: