libamxc  1.10.3
C Generic Data Containers
amxc_set.h File Reference

Ambiorix set API header file. More...

#include <amxc/amxc_common.h>
#include <amxc/amxc_llist.h>

Go to the source code of this file.

Data Structures

struct  _flag
 The flag structure. More...
 
struct  _set
 The set structure. More...
 

Typedefs

typedef struct _set amxc_set_t
 
typedef void(* amxc_set_alert_t) (amxc_set_t *set, const char *flag, bool value, void *priv)
 Flag set alert handler type. More...
 
typedef struct _flag amxc_flag_t
 The flag structure. More...
 

Functions

int amxc_set_new (amxc_set_t **set, bool counted)
 Allocates a set. More...
 
void amxc_set_delete (amxc_set_t **set)
 Frees a set. More...
 
int amxc_set_init (amxc_set_t *const set, bool counted)
 Initializes a set. More...
 
void amxc_set_clean (amxc_set_t *const set)
 Cleans a set. More...
 
amxc_set_tamxc_set_copy (const amxc_set_t *const set)
 Copies a set. More...
 
void amxc_set_reset (amxc_set_t *set)
 Reset or empty a set, i.e. clear all flags. More...
 
int amxc_set_parse (amxc_set_t *set, const char *str)
 Parses a space-separated string of flags and adds them to the set. More...
 
char * amxc_set_to_string (const amxc_set_t *const set)
 Converts a set to a space-separated string of flags. More...
 
char * amxc_set_to_string_sep (const amxc_set_t *const set, const char *sep)
 Converts a set to a separated string of flags. More...
 
void amxc_set_add_flag (amxc_set_t *set, const char *flag)
 Adds a flag to a set, or increases the flag counter. More...
 
void amxc_set_remove_flag (amxc_set_t *set, const char *flag)
 Removes a flag from a set or decreases the flag counter. More...
 
bool amxc_set_has_flag (const amxc_set_t *const set, const char *flag)
 Check if a set contains a flag. More...
 
uint32_t amxc_set_get_count (const amxc_set_t *const set, const char *flag)
 Get a flag counter. More...
 
void amxc_set_union (amxc_set_t *const set, const amxc_set_t *const operand)
 Joins two sets. More...
 
void amxc_set_intersect (amxc_set_t *const set, const amxc_set_t *const operand)
 Intersect a set with another set. More...
 
void amxc_set_subtract (amxc_set_t *const set, const amxc_set_t *const operand)
 Subtract a set from another set. More...
 
bool amxc_set_is_equal (const amxc_set_t *const set1, const amxc_set_t *const set2)
 Compare two sets. More...
 
void amxc_set_alert_cb (amxc_set_t *set, amxc_set_alert_t handler, void *priv)
 Install a set alert callback function. More...
 
void amxc_set_symmetric_difference (amxc_set_t *const set, const amxc_set_t *const operand)
 Calculates the symmetric difference of two sets. More...
 

Detailed Description

Ambiorix set API header file.

Definition in file amxc_set.h.

Typedef Documentation

◆ amxc_set_alert_t

typedef void(* amxc_set_alert_t) (amxc_set_t *set, const char *flag, bool value, void *priv)

Flag set alert handler type.

If a set alert handler is installed on a set, this handler is called every time a flag is set or cleared from the set.

Parameters
setThe set that is modified.
flagThe flag that is set/cleared.
valueTrue if the flag was set, false if it was cleared.
privprivate data void pointer provided to flagset_alert().
Remarks
The handler is called right AFTER the flag is set or cleared.
See also
amxc_set_alert()

Definition at line 107 of file amxc_set.h.

◆ amxc_set_t

typedef struct _set amxc_set_t

Definition at line 1 of file amxc_set.h.