Concord - C Discord API library
A Discord API wrapper library written in C
anomap.h File Reference
#include <stddef.h>
#include <stdbool.h>
Include dependency graph for anomap.h:

Go to the source code of this file.

Data Structures

struct  anomap_item_changed
 

Macros

#define ANOMAP_H
 
#define ANOMAP_DECLARE_COMPARE_FUNCTION(function_name, data_type)
 

Typedefs

typedef void anomap_on_item_changed(struct anomap *map, struct anomap_item_changed *item_changed)
 

Enumerations

enum  anomap_operation {
  anomap_insert = 1 << 0 , anomap_update = 1 << 1 , anomap_upsert = anomap_insert | anomap_update , anomap_delete = 1 << 2 ,
  anomap_getval = 1 << 3
}
 

Functions

struct anomap * anomap_create (size_t key_size, size_t val_size, int(*cmp)(const void *, const void *))
 
void anomap_destroy (struct anomap *map)
 
void anomap_set_on_item_changed (struct anomap *map, anomap_on_item_changed *on_changed, void *data)
 
size_t anomap_length (struct anomap *map)
 
void anomap_clear (struct anomap *map)
 
bool anomap_index_of (struct anomap *map, void *key, size_t *index)
 
bool anomap_at_index (struct anomap *map, size_t index, void *key, void *val)
 
enum anomap_operation anomap_do (struct anomap *map, enum anomap_operation operation, void *key, void *val)
 
size_t anomap_copy_range (struct anomap *map, size_t from_index, size_t to_index, void *keys, void *vals)
 
size_t anomap_delete_range (struct anomap *map, size_t from_index, size_t to_index, void *keys, void *vals)
 

Macro Definition Documentation

◆ ANOMAP_H

#define ANOMAP_H

◆ ANOMAP_DECLARE_COMPARE_FUNCTION

#define ANOMAP_DECLARE_COMPARE_FUNCTION (   function_name,
  data_type 
)
Value:
static int \
function_name(const void *a, const void *b) { \
if (*(data_type *)a == *(data_type *)b) return 0; \
return *(data_type *)a > *(data_type *)b ? 1 : -1; \
}

Typedef Documentation

◆ anomap_on_item_changed

typedef void anomap_on_item_changed(struct anomap *map, struct anomap_item_changed *item_changed)

Enumeration Type Documentation

◆ anomap_operation

Enumerator
anomap_insert 
anomap_update 
anomap_upsert 
anomap_delete 
anomap_getval 

Function Documentation

◆ anomap_create()

struct anomap * anomap_create ( size_t  key_size,
size_t  val_size,
int(*)(const void *, const void *)  cmp 
)

◆ anomap_destroy()

void anomap_destroy ( struct anomap *  map)

◆ anomap_set_on_item_changed()

void anomap_set_on_item_changed ( struct anomap *  map,
anomap_on_item_changed on_changed,
void *  data 
)

◆ anomap_length()

size_t anomap_length ( struct anomap *  map)

◆ anomap_clear()

void anomap_clear ( struct anomap *  map)

◆ anomap_index_of()

bool anomap_index_of ( struct anomap *  map,
void *  key,
size_t *  index 
)

◆ anomap_at_index()

bool anomap_at_index ( struct anomap *  map,
size_t  index,
void *  key,
void *  val 
)

◆ anomap_do()

enum anomap_operation anomap_do ( struct anomap *  map,
enum anomap_operation  operation,
void *  key,
void *  val 
)

◆ anomap_copy_range()

size_t anomap_copy_range ( struct anomap *  map,
size_t  from_index,
size_t  to_index,
void *  keys,
void *  vals 
)

◆ anomap_delete_range()

size_t anomap_delete_range ( struct anomap *  map,
size_t  from_index,
size_t  to_index,
void *  keys,
void *  vals 
)