SimGrid  3.20
Versatile Simulation of Distributed Systems
dynar.h File Reference
#include <string.h>
#include <xbt/base.h>
#include <xbt/function_types.h>

Classes

struct  xbt_dynar_s
 

Macros

#define xbt_dynar_get_as(dynar, idx, type)
 Quick retrieval of scalar content. More...
 
#define xbt_dynar_set_as(dynar, idx, type, val)
 Quick setting of scalar content. More...
 
#define xbt_dynar_getlast_as(dynar, type)
 Quick retrieval of scalar content. More...
 
#define xbt_dynar_getfirst_as(dynar, type)
 Quick retrieval of scalar content. More...
 
#define xbt_dynar_insert_at_as(dynar, idx, type, value)
 Quick insertion of scalar content. More...
 
#define xbt_dynar_push_as(dynar, type, value)
 Quick insertion of scalar content. More...
 
#define xbt_dynar_pop_as(dynar, type)
 Quick removal of scalar content. More...
 
#define xbt_dynar_foreach(_dynar, _cursor, _data)
 Iterates over the whole dynar. More...
 
#define xbt_dynar_foreach_ptr(_dynar, _cursor, _ptr)
 

Typedefs

typedef struct xbt_dynar_sxbt_dynar_t
 Dynar data type (opaque type) More...
 
typedef struct xbt_dynar_s s_xbt_dynar_t
 

Functions

xbt_dynar_t xbt_dynar_new (const unsigned long elm_size, void_f_pvoid_t const free_f)
 Constructor. More...
 
void xbt_dynar_init (xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f)
 Initialize a dynar structure that was not malloc'ed This can be useful to keep temporary dynars on the stack. More...
 
void xbt_dynar_free (xbt_dynar_t *dynar)
 Destructor. More...
 
void xbt_dynar_free_voidp (void *dynar)
 free a dynar passed as void* (handy to store dynar in dynars or dict) More...
 
void xbt_dynar_free_container (xbt_dynar_t *dynar)
 Destructor of the structure not touching to the content. More...
 
void xbt_dynar_free_data (xbt_dynar_t dynar)
 Destroy a dynar that was created with xbt_dynar_init. More...
 
void xbt_dynar_shrink (xbt_dynar_t dynar, int empty_slots)
 Shrink the dynar by removing empty slots at the end of the internal array. More...
 
void xbt_dynar_dump (xbt_dynar_t dynar)
 
void xbt_dynar_get_cpy (const xbt_dynar_t dynar, const unsigned long idx, void *const dst)
 Retrieve a copy of the Nth element of a dynar. More...
 
void xbt_dynar_set (xbt_dynar_t dynar, const int idx, const void *src)
 Set the Nth element of a dynar (expanded if needed). More...
 
void xbt_dynar_replace (xbt_dynar_t dynar, const unsigned long idx, const void *object)
 Set the Nth element of a dynar (expanded if needed). More...
 
void xbt_dynar_insert_at (xbt_dynar_t const dynar, const int idx, const void *src)
 Set the Nth dynar's element, expanding the dynar and sliding the previous values to the right. More...
 
void xbt_dynar_remove_at (xbt_dynar_t const dynar, const int idx, void *const dst)
 Remove the Nth dynar's element, sliding the previous values to the left. More...
 
void xbt_dynar_remove_n_at (xbt_dynar_t const dynar, const unsigned int n, const int idx)
 Remove a slice of the dynar, sliding the rest of the values to the left. More...
 
unsigned int xbt_dynar_search (xbt_dynar_t const dynar, void *elem)
 Returns the position of the element in the dynar. More...
 
signed int xbt_dynar_search_or_negative (xbt_dynar_t const dynar, void *const elem)
 Returns the position of the element in the dynar (or -1 if not found) More...
 
int xbt_dynar_member (xbt_dynar_t const dynar, void *elem)
 Returns a boolean indicating whether the element is part of the dynar. More...
 
void xbt_dynar_sort (xbt_dynar_t const dynar, int_f_cpvoid_cpvoid_t compar_fn)
 Sorts a dynar according to the function compar_fn More...
 
xbt_dynar_t xbt_dynar_sort_strings (xbt_dynar_t dynar)
 Sorts a dynar of strings (ie, char* data) More...
 
int xbt_dynar_compare (xbt_dynar_t d1, xbt_dynar_t d2, int(*compar)(const void *, const void *))
 Compare two dynars. More...
 
voidxbt_dynar_to_array (xbt_dynar_t dynar)
 Transform a dynar into a nullptr terminated array. More...
 
unsigned long xbt_dynar_length (const xbt_dynar_t dynar)
 Count of dynar's elements. More...
 
int xbt_dynar_is_empty (const xbt_dynar_t dynar)
 check if a dynar is empty More...
 
void xbt_dynar_reset (xbt_dynar_t const dynar)
 Frees the content and set the size to 0. More...
 
void xbt_dynar_merge (xbt_dynar_t *d1, xbt_dynar_t *d2)
 Merge dynar d2 into d1. More...
 
void xbt_dynar_push (xbt_dynar_t const dynar, const void *src)
 Add an element at the end of the dynar. More...
 
void xbt_dynar_pop (xbt_dynar_t const dynar, void *const dst)
 Get and remove the last element of the dynar. More...
 
void xbt_dynar_unshift (xbt_dynar_t const dynar, const void *src)
 Add an element at the begining of the dynar. More...
 
void xbt_dynar_shift (xbt_dynar_t const dynar, void *const dst)
 Get and remove the first element of the dynar. More...
 
void xbt_dynar_map (const xbt_dynar_t dynar, void_f_pvoid_t const op)
 Apply a function to each member of a dynar. More...
 
voidxbt_dynar_set_at_ptr (const xbt_dynar_t dynar, const unsigned long idx)
 
voidxbt_dynar_get_ptr (const xbt_dynar_t dynar, const unsigned long idx)
 Retrieve a pointer to the Nth element of a dynar. More...
 
voidxbt_dynar_insert_at_ptr (xbt_dynar_t const dynar, const int idx)
 Make room for a new element, and return a pointer to it. More...
 
voidxbt_dynar_push_ptr (xbt_dynar_t const dynar)
 Make room at the end of the dynar for a new element, and return a pointer to it. More...
 
voidxbt_dynar_pop_ptr (xbt_dynar_t const dynar)
 Mark the last dynar's element as unused and return a pointer to it. More...
 
void xbt_dynar_cursor_rm (xbt_dynar_t dynar, unsigned int *const cursor)
 Removes and free the entry pointed by the cursor. More...
 
static int _xbt_dynar_cursor_get (const xbt_dynar_t dynar, unsigned int idx, void *const dst)