Blame src/simclist.h

Packit 9f0df5
/*
Packit 9f0df5
 * Copyright (c) 2007,2008 Mij <mij@bitchx.it>
Packit 9f0df5
 *
Packit 9f0df5
 * Permission to use, copy, modify, and distribute this software for any
Packit 9f0df5
 * purpose with or without fee is hereby granted, provided that the above
Packit 9f0df5
 * copyright notice and this permission notice appear in all copies.
Packit 9f0df5
 *
Packit 9f0df5
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
Packit 9f0df5
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
Packit 9f0df5
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
Packit 9f0df5
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
Packit 9f0df5
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
Packit 9f0df5
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
Packit 9f0df5
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Packit 9f0df5
 */
Packit 9f0df5
Packit 9f0df5
Packit 9f0df5
/*
Packit 9f0df5
 * SimCList library. See http://mij.oltrelinux.com/devel/simclist
Packit 9f0df5
 */
Packit 9f0df5
Packit 9f0df5
Packit 9f0df5
#ifndef SIMCLIST_H
Packit 9f0df5
#define SIMCLIST_H
Packit 9f0df5
Packit 9f0df5
#ifdef __cplusplus
Packit 9f0df5
extern "C" {
Packit 9f0df5
#endif
Packit 9f0df5
Packit 9f0df5
#include <inttypes.h>
Packit 9f0df5
#include <errno.h>
Packit 9f0df5
#include <sys/types.h>
Packit 9f0df5
Packit 9f0df5
#ifndef SIMCLIST_NO_DUMPRESTORE
Packit 9f0df5
#   ifndef _WIN32
Packit 9f0df5
#       include <sys/time.h>    /* list_dump_info_t's struct timeval */
Packit 9f0df5
#   else
Packit 9f0df5
#       include <time.h>
Packit 9f0df5
#   endif
Packit 9f0df5
#endif
Packit 9f0df5
Packit 9f0df5
Packit 9f0df5
/* Be friend of both C90 and C99 compilers */
Packit 9f0df5
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
Packit 9f0df5
    /* "inline" and "restrict" are keywords */
Packit 9f0df5
#else
Packit 9f0df5
#   define inline           /* inline */
Packit 9f0df5
#   define restrict         /* restrict */
Packit 9f0df5
#endif
Packit 9f0df5
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * Type representing list hashes.
Packit 9f0df5
 *
Packit 9f0df5
 * This is a signed integer value.
Packit 9f0df5
 */
Packit 9f0df5
typedef int32_t list_hash_t;
Packit 9f0df5
Packit 9f0df5
#ifndef SIMCLIST_NO_DUMPRESTORE
Packit 9f0df5
typedef struct {
Packit 9f0df5
    uint16_t version;           /* dump version */
Packit 9f0df5
    struct timeval timestamp;   /* when the list has been dumped, seconds since UNIX epoch */
Packit 9f0df5
    uint32_t list_size;
Packit 9f0df5
    uint32_t list_numels;
Packit 9f0df5
    list_hash_t list_hash;      /* hash of the list when dumped, or 0 if invalid */
Packit 9f0df5
    uint32_t dumpsize;
Packit 9f0df5
    int consistent;             /* 1 if the dump is verified complete/consistent; 0 otherwise */
Packit 9f0df5
} list_dump_info_t;
Packit 9f0df5
#endif
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * a comparator of elements.
Packit 9f0df5
 *
Packit 9f0df5
 * A comparator of elements is a function that:
Packit 9f0df5
 *      -# receives two references to elements a and b
Packit 9f0df5
 *      -# returns {<0, 0, >0} if (a > b), (a == b), (a < b) respectively
Packit 9f0df5
 *
Packit 9f0df5
 * It is responsability of the function to handle possible NULL values.
Packit 9f0df5
 */
Packit 9f0df5
typedef int (*element_comparator)(const void *a, const void *b);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * a seeker of elements.
Packit 9f0df5
 *
Packit 9f0df5
 * An element seeker is a function that:
Packit 9f0df5
 *      -# receives a reference to an element el
Packit 9f0df5
 *      -# receives a reference to some indicator data
Packit 9f0df5
 *      -# returns non-0 if the element matches the indicator, 0 otherwise
Packit 9f0df5
 *
Packit 9f0df5
 * It is responsability of the function to handle possible NULL values in any
Packit 9f0df5
 * argument.
Packit 9f0df5
 */
Packit 9f0df5
typedef int (*element_seeker)(const void *el, const void *indicator);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * an element lenght meter.
Packit 9f0df5
 *
Packit 9f0df5
 * An element meter is a function that:
Packit 9f0df5
 *      -# receives the reference to an element el
Packit 9f0df5
 *      -# returns its size in bytes
Packit 9f0df5
 *
Packit 9f0df5
 * It is responsability of the function to handle possible NULL values.
Packit 9f0df5
 */
Packit 9f0df5
typedef size_t (*element_meter)(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * a function computing the hash of elements.
Packit 9f0df5
 *
Packit 9f0df5
 * An hash computing function is a function that:
Packit 9f0df5
 *      -# receives the reference to an element el
Packit 9f0df5
 *      -# returns a hash value for el
Packit 9f0df5
 *
Packit 9f0df5
 * It is responsability of the function to handle possible NULL values.
Packit 9f0df5
 */
Packit 9f0df5
typedef list_hash_t (*element_hash_computer)(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * a function for serializing an element.
Packit 9f0df5
 *
Packit 9f0df5
 * A serializer function is one that gets a reference to an element,
Packit 9f0df5
 * and returns a reference to a buffer that contains its serialization
Packit 9f0df5
 * along with the length of this buffer.
Packit 9f0df5
 * It is responsability of the function to handle possible NULL values,
Packit 9f0df5
 * returning a NULL buffer and a 0 buffer length.
Packit 9f0df5
 *
Packit 9f0df5
 * These functions have 3 goals:
Packit 9f0df5
 *  -# "freeze" and "flatten" the memory representation of the element
Packit 9f0df5
 *  -# provide a portable (wrt byte order, or type size) representation of the element, if the dump can be used on different sw/hw combinations
Packit 9f0df5
 *  -# possibly extract a compressed representation of the element
Packit 9f0df5
 *
Packit 9f0df5
 * @param el                reference to the element data
Packit 9f0df5
 * @param serialize_buffer  reference to fill with the length of the buffer
Packit 9f0df5
 * @return                  reference to the buffer with the serialized data
Packit 9f0df5
 */
Packit 9f0df5
typedef void *(*element_serializer)(const void *restrict el, uint32_t *restrict serializ_len);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * a function for un-serializing an element.
Packit 9f0df5
 *
Packit 9f0df5
 * An unserializer function accomplishes the inverse operation of the
Packit 9f0df5
 * serializer function.  An unserializer function is one that gets a
Packit 9f0df5
 * serialized representation of an element and turns it backe to the original
Packit 9f0df5
 * element. The serialized representation is passed as a reference to a buffer
Packit 9f0df5
 * with its data, and the function allocates and returns the buffer containing
Packit 9f0df5
 * the original element, and it sets the length of this buffer into the
Packit 9f0df5
 * integer passed by reference.
Packit 9f0df5
 *
Packit 9f0df5
 * @param data              reference to the buffer with the serialized representation of the element
Packit 9f0df5
 * @param data_len          reference to the location where to store the length of the data in the buffer returned
Packit 9f0df5
 * @return                  reference to a buffer with the original, unserialized representation of the element
Packit 9f0df5
 */
Packit 9f0df5
typedef void *(*element_unserializer)(const void *restrict data, uint32_t *restrict data_len);
Packit 9f0df5
Packit 9f0df5
/* [private-use] list entry -- olds actual user datum */
Packit 9f0df5
struct list_entry_s {
Packit 9f0df5
    void *data;
Packit 9f0df5
Packit 9f0df5
    /* doubly-linked list service references */
Packit 9f0df5
    struct list_entry_s *next;
Packit 9f0df5
    struct list_entry_s *prev;
Packit 9f0df5
};
Packit 9f0df5
Packit 9f0df5
/* [private-use] list attributes */
Packit 9f0df5
struct list_attributes_s {
Packit 9f0df5
    /* user-set routine for comparing list elements */
Packit 9f0df5
    element_comparator comparator;
Packit 9f0df5
    /* user-set routing for seeking elements */
Packit 9f0df5
    element_seeker seeker;
Packit 9f0df5
    /* user-set routine for determining the length of an element */
Packit 9f0df5
    element_meter meter;
Packit 9f0df5
    int copy_data;
Packit 9f0df5
    /* user-set routine for computing the hash of an element */
Packit 9f0df5
    element_hash_computer hasher;
Packit 9f0df5
    /* user-set routine for serializing an element */
Packit 9f0df5
    element_serializer serializer;
Packit 9f0df5
    /* user-set routine for unserializing an element */
Packit 9f0df5
    element_unserializer unserializer;
Packit 9f0df5
};
Packit 9f0df5
Packit 9f0df5
/** list object */
Packit 9f0df5
typedef struct {
Packit 9f0df5
    struct list_entry_s *head_sentinel;
Packit 9f0df5
    struct list_entry_s *tail_sentinel;
Packit 9f0df5
    struct list_entry_s *mid;
Packit 9f0df5
Packit 9f0df5
    unsigned int numels;
Packit 9f0df5
Packit 9f0df5
    /* array of spare elements */
Packit 9f0df5
    struct list_entry_s **spareels;
Packit 9f0df5
    unsigned int spareelsnum;
Packit 9f0df5
Packit 9f0df5
#ifdef SIMCLIST_WITH_THREADS
Packit 9f0df5
    /* how many threads are currently running */
Packit 9f0df5
    unsigned int threadcount;
Packit 9f0df5
#endif
Packit 9f0df5
Packit 9f0df5
    /* service variables for list iteration */
Packit 9f0df5
    int iter_active;
Packit 9f0df5
    unsigned int iter_pos;
Packit 9f0df5
    struct list_entry_s *iter_curentry;
Packit 9f0df5
Packit 9f0df5
    /* list attributes */
Packit 9f0df5
    struct list_attributes_s attrs;
Packit 9f0df5
} list_t;
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * initialize a list object for use.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     must point to a user-provided memory location
Packit 9f0df5
 * @return      0 for success. -1 for failure
Packit 9f0df5
 */
Packit 9f0df5
int list_init(list_t *restrict l);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * completely remove the list from memory.
Packit 9f0df5
 *
Packit 9f0df5
 * This function is the inverse of list_init(). It is meant to be called when
Packit 9f0df5
 * the list is no longer going to be used. Elements and possible memory taken
Packit 9f0df5
 * for internal use are freed.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to destroy
Packit 9f0df5
 */
Packit 9f0df5
void list_destroy(list_t *restrict l);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * set the comparator function for list elements.
Packit 9f0df5
 *
Packit 9f0df5
 * Comparator functions are used for searching and sorting. If NULL is passed
Packit 9f0df5
 * as reference to the function, the comparator is disabled.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param comparator_fun    pointer to the actual comparator function
Packit 9f0df5
 * @return      0 if the attribute was successfully set; -1 otherwise
Packit 9f0df5
 *
Packit 9f0df5
 * @see element_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_attributes_comparator(list_t *restrict l, element_comparator comparator_fun);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * set a seeker function for list elements.
Packit 9f0df5
 *
Packit 9f0df5
 * Seeker functions are used for finding elements. If NULL is passed as reference
Packit 9f0df5
 * to the function, the seeker is disabled.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param seeker_fun    pointer to the actual seeker function
Packit 9f0df5
 * @return      0 if the attribute was successfully set; -1 otherwise
Packit 9f0df5
 *
Packit 9f0df5
 * @see element_seeker()
Packit 9f0df5
 */
Packit 9f0df5
int list_attributes_seeker(list_t *restrict l, element_seeker seeker_fun);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * require to free element data when list entry is removed (default: don't free).
Packit 9f0df5
 *
Packit 9f0df5
 * [ advanced preference ]
Packit 9f0df5
 *
Packit 9f0df5
 * By default, when an element is removed from the list, it disappears from
Packit 9f0df5
 * the list by its actual data is not free()d. With this option, every
Packit 9f0df5
 * deletion causes element data to be freed.
Packit 9f0df5
 *
Packit 9f0df5
 * It is responsability of this function to correctly handle NULL values, if
Packit 9f0df5
 * NULL elements are inserted into the list.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l             list to operate
Packit 9f0df5
 * @param metric_fun    pointer to the actual metric function
Packit 9f0df5
 * @param copy_data     0: do not free element data (default); non-0: do free
Packit 9f0df5
 * @return          0 if the attribute was successfully set; -1 otherwise
Packit 9f0df5
 *
Packit 9f0df5
 * @see element_meter()
Packit 9f0df5
 * @see list_meter_int8_t()
Packit 9f0df5
 * @see list_meter_int16_t()
Packit 9f0df5
 * @see list_meter_int32_t()
Packit 9f0df5
 * @see list_meter_int64_t()
Packit 9f0df5
 * @see list_meter_uint8_t()
Packit 9f0df5
 * @see list_meter_uint16_t()
Packit 9f0df5
 * @see list_meter_uint32_t()
Packit 9f0df5
 * @see list_meter_uint64_t()
Packit 9f0df5
 * @see list_meter_float()
Packit 9f0df5
 * @see list_meter_double()
Packit 9f0df5
 * @see list_meter_string()
Packit 9f0df5
 */
Packit 9f0df5
int list_attributes_copy(list_t *restrict l, element_meter metric_fun, int copy_data);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * set the element hash computing function for the list elements.
Packit 9f0df5
 *
Packit 9f0df5
 * [ advanced preference ]
Packit 9f0df5
 *
Packit 9f0df5
 * An hash can be requested depicting the list status at a given time. An hash
Packit 9f0df5
 * only depends on the elements and their order. By default, the hash of an
Packit 9f0df5
 * element is only computed on its reference. With this function, the user can
Packit 9f0df5
 * set a custom function computing the hash of an element. If such function is
Packit 9f0df5
 * provided, the list_hash() function automatically computes the list hash using
Packit 9f0df5
 * the custom function instead of simply referring to element references.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l             list to operate
Packit 9f0df5
 * @param hash_computer_fun pointer to the actual hash computing function
Packit 9f0df5
 * @return              0 if the attribute was successfully set; -1 otherwise
Packit 9f0df5
 *
Packit 9f0df5
 * @see element_hash_computer()
Packit 9f0df5
 */
Packit 9f0df5
int list_attributes_hash_computer(list_t *restrict l, element_hash_computer hash_computer_fun);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * set the element serializer function for the list elements.
Packit 9f0df5
 *
Packit 9f0df5
 * [ advanced preference ]
Packit 9f0df5
 *
Packit 9f0df5
 * Serialize functions are used for dumping the list to some persistent
Packit 9f0df5
 * storage.  The serializer function is called for each element; it is passed
Packit 9f0df5
 * a reference to the element and a reference to a size_t object. It will
Packit 9f0df5
 * provide (and return) the buffer with the serialization of the element and
Packit 9f0df5
 * fill the size_t object with the length of this serialization data.
Packit 9f0df5
 *
Packit 9f0df5
 * @param   l   list to operate
Packit 9f0df5
 * @param   serializer_fun  pointer to the actual serializer function
Packit 9f0df5
 * @return      0 if the attribute was successfully set; -1 otherwise
Packit 9f0df5
 *
Packit 9f0df5
 * @see     element_serializer()
Packit 9f0df5
 * @see     list_dump_filedescriptor()
Packit 9f0df5
 * @see     list_restore_filedescriptor()
Packit 9f0df5
 */
Packit 9f0df5
int list_attributes_serializer(list_t *restrict l, element_serializer serializer_fun);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * set the element unserializer function for the list elements.
Packit 9f0df5
 *
Packit 9f0df5
 * [ advanced preference ]
Packit 9f0df5
 *
Packit 9f0df5
 * Unserialize functions are used for restoring the list from some persistent
Packit 9f0df5
 * storage. The unserializer function is called for each element segment read
Packit 9f0df5
 * from the storage; it is passed the segment and a reference to an integer.
Packit 9f0df5
 * It shall allocate and return a buffer compiled with the resumed memory
Packit 9f0df5
 * representation of the element, and set the integer value to the length of
Packit 9f0df5
 * this buffer.
Packit 9f0df5
 *
Packit 9f0df5
 * @param   l       list to operate
Packit 9f0df5
 * @param   unserializer_fun    pointer to the actual unserializer function
Packit 9f0df5
 * @return      0 if the attribute was successfully set; -1 otherwise
Packit 9f0df5
 *
Packit 9f0df5
 * @see     element_unserializer()
Packit 9f0df5
 * @see     list_dump_filedescriptor()
Packit 9f0df5
 * @see     list_restore_filedescriptor()
Packit 9f0df5
 */
Packit 9f0df5
int list_attributes_unserializer(list_t *restrict l, element_unserializer unserializer_fun);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * append data at the end of the list.
Packit 9f0df5
 *
Packit 9f0df5
 * This function is useful for adding elements with a FIFO/queue policy.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param data  pointer to user data to append
Packit 9f0df5
 *
Packit 9f0df5
 * @return      1 for success. < 0 for failure
Packit 9f0df5
 */
Packit 9f0df5
int list_append(list_t *restrict l, const void *data);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * insert data in the head of the list.
Packit 9f0df5
 *
Packit 9f0df5
 * This function is useful for adding elements with a LIFO/Stack policy.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param data  pointer to user data to append
Packit 9f0df5
 *
Packit 9f0df5
 * @return      1 for success. < 0 for failure
Packit 9f0df5
 */
Packit 9f0df5
int list_prepend(list_t *restrict l, const void *restrict data);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * extract the element in the top of the list.
Packit 9f0df5
 *
Packit 9f0df5
 * This function is for using a list with a FIFO/queue policy.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @return      reference to user datum, or NULL on errors
Packit 9f0df5
 */
Packit 9f0df5
void *list_fetch(list_t *restrict l);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * retrieve an element at a given position.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param pos   [0,size-1] position index of the element wanted
Packit 9f0df5
 * @return      reference to user datum, or NULL on errors
Packit 9f0df5
 */
Packit 9f0df5
void *list_get_at(const list_t *restrict l, unsigned int pos);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * return the maximum element of the list.
Packit 9f0df5
 *
Packit 9f0df5
 * @warning Requires a comparator function to be set for the list.
Packit 9f0df5
 *
Packit 9f0df5
 * Returns the maximum element with respect to the comparator function output.
Packit 9f0df5
 * 
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @return      the reference to the element, or NULL
Packit 9f0df5
 */
Packit 9f0df5
void *list_get_max(const list_t *restrict l);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * return the minimum element of the list.
Packit 9f0df5
 *
Packit 9f0df5
 * @warning Requires a comparator function to be set for the list.
Packit 9f0df5
 *
Packit 9f0df5
 * Returns the minimum element with respect to the comparator function output.
Packit 9f0df5
 *
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @return      the reference to the element, or NULL
Packit 9f0df5
 */
Packit 9f0df5
void *list_get_min(const list_t *restrict l);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * retrieve and remove from list an element at a given position.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param pos   [0,size-1] position index of the element wanted
Packit 9f0df5
 * @return      reference to user datum, or NULL on errors
Packit 9f0df5
 */
Packit 9f0df5
void *list_extract_at(list_t *restrict l, unsigned int pos);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * insert an element at a given position.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param data  reference to data to be inserted
Packit 9f0df5
 * @param pos   [0,size-1] position index to insert the element at
Packit 9f0df5
 * @return      positive value on success. Negative on failure
Packit 9f0df5
 */
Packit 9f0df5
int list_insert_at(list_t *restrict l, const void *data, unsigned int pos);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * expunge the first found given element from the list.
Packit 9f0df5
 *
Packit 9f0df5
 * Inspects the given list looking for the given element; if the element
Packit 9f0df5
 * is found, it is removed. Only the first occurence is removed.
Packit 9f0df5
 * If a comparator function was not set, elements are compared by reference.
Packit 9f0df5
 * Otherwise, the comparator is used to match the element.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param data  reference of the element to search for
Packit 9f0df5
 * @return      0 on success. Negative value on failure
Packit 9f0df5
 *
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 * @see list_delete_at()
Packit 9f0df5
 */
Packit 9f0df5
int list_delete(list_t *restrict l, const void *data);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * expunge an element at a given position from the list.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param pos   [0,size-1] position index of the element to be deleted
Packit 9f0df5
 * @return      0 on success. Negative value on failure
Packit 9f0df5
 */
Packit 9f0df5
int list_delete_at(list_t *restrict l, unsigned int pos);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * expunge an array of elements from the list, given their position range.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param posstart  [0,size-1] position index of the first element to be deleted
Packit 9f0df5
 * @param posend    [posstart,size-1] position of the last element to be deleted
Packit 9f0df5
 * @return      the number of elements successfully removed on success, <0 on error
Packit 9f0df5
 */
Packit 9f0df5
int list_delete_range(list_t *restrict l, unsigned int posstart, unsigned int posend);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * clear all the elements off of the list.
Packit 9f0df5
 *
Packit 9f0df5
 * The element datums will not be freed.
Packit 9f0df5
 *
Packit 9f0df5
 * @see list_delete_range()
Packit 9f0df5
 * @see list_size()
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @return      the number of elements removed on success, <0 on error
Packit 9f0df5
 */
Packit 9f0df5
int list_clear(list_t *restrict l);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * inspect the number of elements in the list.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @return      number of elements currently held by the list
Packit 9f0df5
 */
Packit 9f0df5
unsigned int list_size(const list_t *restrict l);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * inspect whether the list is empty.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @return      0 iff the list is not empty
Packit 9f0df5
 * 
Packit 9f0df5
 * @see list_size()
Packit 9f0df5
 */
Packit 9f0df5
int list_empty(const list_t *restrict l);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * find the position of an element in a list.
Packit 9f0df5
 *
Packit 9f0df5
 * @warning Requires a comparator function to be set for the list.
Packit 9f0df5
 *
Packit 9f0df5
 * Inspects the given list looking for the given element; if the element
Packit 9f0df5
 * is found, its position into the list is returned.
Packit 9f0df5
 * Elements are inspected comparing references if a comparator has not been
Packit 9f0df5
 * set. Otherwise, the comparator is used to find the element.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param data  reference of the element to search for
Packit 9f0df5
 * @return      position of element in the list, or <0 if not found
Packit 9f0df5
 * 
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 * @see list_get_at()
Packit 9f0df5
 */
Packit 9f0df5
int list_locate(const list_t *restrict l, const void *data);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * returns an element given an indicator.
Packit 9f0df5
 *
Packit 9f0df5
 * @warning Requires a seeker function to be set for the list.
Packit 9f0df5
 *
Packit 9f0df5
 * Inspect the given list looking with the seeker if an element matches
Packit 9f0df5
 * an indicator. If such element is found, the reference to the element
Packit 9f0df5
 * is returned.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param indicator indicator data to pass to the seeker along with elements
Packit 9f0df5
 * @return      reference to the element accepted by the seeker, or NULL if none found
Packit 9f0df5
 */
Packit 9f0df5
void *list_seek(list_t *restrict l, const void *indicator);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * inspect whether some data is member of the list.
Packit 9f0df5
 *
Packit 9f0df5
 * @warning Requires a comparator function to be set for the list.
Packit 9f0df5
 *
Packit 9f0df5
 * By default, a per-reference comparison is accomplished. That is,
Packit 9f0df5
 * the data is in list if any element of the list points to the same
Packit 9f0df5
 * location of data.
Packit 9f0df5
 * A "semantic" comparison is accomplished, otherwise, if a comparator
Packit 9f0df5
 * function has been set previously, with list_attributes_comparator();
Packit 9f0df5
 * in which case, the given data reference is believed to be in list iff
Packit 9f0df5
 * comparator_fun(elementdata, userdata) == 0 for any element in the list.
Packit 9f0df5
 * 
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param data  reference to the data to search
Packit 9f0df5
 * @return      0 iff the list does not contain data as an element
Packit 9f0df5
 *
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_contains(const list_t *restrict l, const void *data);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * concatenate two lists
Packit 9f0df5
 *
Packit 9f0df5
 * Concatenates one list with another, and stores the result into a
Packit 9f0df5
 * user-provided list object, which must be different from both the
Packit 9f0df5
 * lists to concatenate. Attributes from the original lists are not
Packit 9f0df5
 * cloned.
Packit 9f0df5
 * The destination list referred is threated as virgin room: if it
Packit 9f0df5
 * is an existing list containing elements, memory leaks will happen.
Packit 9f0df5
 * It is OK to specify the same list twice as source, for "doubling"
Packit 9f0df5
 * it in the destination.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l1    base list
Packit 9f0df5
 * @param l2    list to append to the base
Packit 9f0df5
 * @param dest  reference to the destination list
Packit 9f0df5
 * @return      0 for success, -1 for errors
Packit 9f0df5
 */
Packit 9f0df5
int list_concat(const list_t *l1, const list_t *l2, list_t *restrict dest);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * sort list elements.
Packit 9f0df5
 *
Packit 9f0df5
 * @warning Requires a comparator function to be set for the list.
Packit 9f0df5
 *
Packit 9f0df5
 * Sorts the list in ascending or descending order as specified by the versus
Packit 9f0df5
 * flag. The algorithm chooses autonomously what algorithm is best suited for
Packit 9f0df5
 * sorting the list wrt its current status.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param versus positive: order small to big; negative: order big to small
Packit 9f0df5
 * @return      0 iff sorting was successful
Packit 9f0df5
 *
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_sort(list_t *restrict l, int versus);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * start an iteration session.
Packit 9f0df5
 *
Packit 9f0df5
 * This function prepares the list to be iterated.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @return 		0 if the list cannot be currently iterated. >0 otherwise
Packit 9f0df5
 * 
Packit 9f0df5
 * @see list_iterator_stop()
Packit 9f0df5
 */
Packit 9f0df5
int list_iterator_start(list_t *restrict l);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * return the next element in the iteration session.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @return		element datum, or NULL on errors
Packit 9f0df5
 */
Packit 9f0df5
void *list_iterator_next(list_t *restrict l);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * inspect whether more elements are available in the iteration session.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @return      0 iff no more elements are available.
Packit 9f0df5
 */
Packit 9f0df5
int list_iterator_hasnext(const list_t *restrict l);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * end an iteration session.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @return      0 iff the iteration session cannot be stopped
Packit 9f0df5
 */
Packit 9f0df5
int list_iterator_stop(list_t *restrict l);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * return the hash of the current status of the list.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param hash  where the resulting hash is put
Packit 9f0df5
 *
Packit 9f0df5
 * @return      0 for success; <0 for failure
Packit 9f0df5
 */
Packit 9f0df5
int list_hash(const list_t *restrict l, list_hash_t *restrict hash);
Packit 9f0df5
Packit 9f0df5
#ifndef SIMCLIST_NO_DUMPRESTORE
Packit 9f0df5
/**
Packit 9f0df5
 * get meta informations on a list dump on filedescriptor.
Packit 9f0df5
 *
Packit 9f0df5
 * [ advanced function ]
Packit 9f0df5
 *
Packit 9f0df5
 * Extracts the meta information from a SimCList dump located in a file
Packit 9f0df5
 * descriptor. The file descriptor must be open and positioned at the
Packit 9f0df5
 * beginning of the SimCList dump block.
Packit 9f0df5
 *
Packit 9f0df5
 * @param fd        file descriptor to get metadata from
Packit 9f0df5
 * @param info      reference to a dump metainformation structure to fill
Packit 9f0df5
 * @return          0 for success; <0 for failure
Packit 9f0df5
 *
Packit 9f0df5
 * @see list_dump_filedescriptor()
Packit 9f0df5
 */
Packit 9f0df5
int list_dump_getinfo_filedescriptor(int fd, list_dump_info_t *restrict info);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * get meta informations on a list dump on file.
Packit 9f0df5
 *
Packit 9f0df5
 * [ advanced function ]
Packit 9f0df5
 *
Packit 9f0df5
 * Extracts the meta information from a SimCList dump located in a file.
Packit 9f0df5
 *
Packit 9f0df5
 * @param filename  filename of the file to fetch from
Packit 9f0df5
 * @param info      reference to a dump metainformation structure to fill
Packit 9f0df5
 * @return          0 for success; <0 for failure
Packit 9f0df5
 *
Packit 9f0df5
 * @see list_dump_filedescriptor()
Packit 9f0df5
 */
Packit 9f0df5
int list_dump_getinfo_file(const char *restrict filename, list_dump_info_t *restrict info);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * dump the list into an open, writable file descriptor.
Packit 9f0df5
 *
Packit 9f0df5
 * This function "dumps" the list to a persistent storage so it can be
Packit 9f0df5
 * preserved across process terminations.
Packit 9f0df5
 * When called, the file descriptor must be open for writing and positioned
Packit 9f0df5
 * where the serialized data must begin. It writes its serialization of the
Packit 9f0df5
 * list in a form which is portable across different architectures. Dump can
Packit 9f0df5
 * be safely performed on stream-only (non seekable) descriptors. The file
Packit 9f0df5
 * descriptor is not closed at the end of the operations.
Packit 9f0df5
 *
Packit 9f0df5
 * To use dump functions, either of these conditions must be satisfied:
Packit 9f0df5
 *      -# a metric function has been specified with list_attributes_copy()
Packit 9f0df5
 *      -# a serializer function has been specified with list_attributes_serializer()
Packit 9f0df5
 *
Packit 9f0df5
 * If a metric function has been specified, each element of the list is dumped
Packit 9f0df5
 * as-is from memory, copying it from its pointer for its length down to the
Packit 9f0df5
 * file descriptor. This might have impacts on portability of the dump to
Packit 9f0df5
 * different architectures.
Packit 9f0df5
 *
Packit 9f0df5
 * If a serializer function has been specified, its result for each element is
Packit 9f0df5
 * dumped to the file descriptor.
Packit 9f0df5
 *
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param fd    file descriptor to write to
Packit 9f0df5
 * @param len   location to store the resulting length of the dump (bytes), or NULL
Packit 9f0df5
 *
Packit 9f0df5
 * @return      0 if successful; -1 otherwise
Packit 9f0df5
 *
Packit 9f0df5
 * @see element_serializer()
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 * @see list_attributes_serializer()
Packit 9f0df5
 */
Packit 9f0df5
int list_dump_filedescriptor(const list_t *restrict l, int fd, size_t *restrict len);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * dump the list to a file name.
Packit 9f0df5
 *
Packit 9f0df5
 * This function creates a filename and dumps the current content of the list
Packit 9f0df5
 * to it. If the file exists it is overwritten. The number of bytes written to
Packit 9f0df5
 * the file can be returned in a specified argument.
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to operate
Packit 9f0df5
 * @param filename    filename to write to
Packit 9f0df5
 * @param len   location to store the resulting length of the dump (bytes), or NULL
Packit 9f0df5
 *
Packit 9f0df5
 * @return      0 if successful; -1 otherwise
Packit 9f0df5
 *
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 * @see element_serializer()
Packit 9f0df5
 * @see list_attributes_serializer()
Packit 9f0df5
 * @see list_dump_filedescriptor()
Packit 9f0df5
 * @see list_restore_file()
Packit 9f0df5
 *
Packit 9f0df5
 * This function stores a representation of the list 
Packit 9f0df5
 */
Packit 9f0df5
int list_dump_file(const list_t *restrict l, const char *restrict filename, size_t *restrict len);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * restore the list from an open, readable file descriptor to memory.
Packit 9f0df5
 *
Packit 9f0df5
 * This function is the "inverse" of list_dump_filedescriptor(). It restores
Packit 9f0df5
 * the list content from a (open, read-ready) file descriptor to memory. An
Packit 9f0df5
 * unserializer might be needed to restore elements from the persistent
Packit 9f0df5
 * representation back into memory-consistent format. List attributes can not
Packit 9f0df5
 * be restored and must be set manually.
Packit 9f0df5
 *
Packit 9f0df5
 * @see list_dump_filedescriptor()
Packit 9f0df5
 * @see list_attributes_serializer()
Packit 9f0df5
 * @see list_attributes_unserializer()
Packit 9f0df5
 *
Packit 9f0df5
 * @param l     list to restore to
Packit 9f0df5
 * @param fd    file descriptor to read from.
Packit 9f0df5
 * @param len   location to store the length of the dump read (bytes), or NULL
Packit 9f0df5
 * @return      0 if successful; -1 otherwise
Packit 9f0df5
 */
Packit 9f0df5
int list_restore_filedescriptor(list_t *restrict l, int fd, size_t *restrict len);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * restore the list from a file name.
Packit 9f0df5
 *
Packit 9f0df5
 * This function restores the content of a list from a file into memory. It is
Packit 9f0df5
 * the inverse of list_dump_file().
Packit 9f0df5
 *
Packit 9f0df5
 * @see element_unserializer()
Packit 9f0df5
 * @see list_attributes_unserializer()
Packit 9f0df5
 * @see list_dump_file()
Packit 9f0df5
 * @see list_restore_filedescriptor()
Packit 9f0df5
 *
Packit 9f0df5
 * @param l         list to restore to
Packit 9f0df5
 * @param filename  filename to read data from
Packit 9f0df5
 * @param len       location to store the length of the dump read (bytes), or NULL
Packit 9f0df5
 * @return          0 if successful; -1 otherwise
Packit 9f0df5
 */
Packit 9f0df5
int list_restore_file(list_t *restrict l, const char *restrict filename, size_t *len);
Packit 9f0df5
#endif
Packit 9f0df5
Packit 9f0df5
/* ready-made comparators, meters and hash computers */
Packit 9f0df5
                                /* comparator functions */
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made comparator for int8_t elements.
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_comparator_int8_t(const void *a, const void *b);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made comparator for int16_t elements.
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_comparator_int16_t(const void *a, const void *b);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made comparator for int32_t elements.
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_comparator_int32_t(const void *a, const void *b);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made comparator for int64_t elements.
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_comparator_int64_t(const void *a, const void *b);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made comparator for uint8_t elements.
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_comparator_uint8_t(const void *a, const void *b);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made comparator for uint16_t elements.
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_comparator_uint16_t(const void *a, const void *b);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made comparator for uint32_t elements.
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_comparator_uint32_t(const void *a, const void *b);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made comparator for uint64_t elements.
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_comparator_uint64_t(const void *a, const void *b);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made comparator for float elements.
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_comparator_float(const void *a, const void *b);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made comparator for double elements.
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_comparator_double(const void *a, const void *b);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made comparator for string elements.
Packit 9f0df5
 * @see list_attributes_comparator()
Packit 9f0df5
 */
Packit 9f0df5
int list_comparator_string(const void *a, const void *b);
Packit 9f0df5
Packit 9f0df5
                                /*          metric functions        */
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made metric function for int8_t elements.
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 */
Packit 9f0df5
size_t list_meter_int8_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made metric function for int16_t elements.
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 */
Packit 9f0df5
size_t list_meter_int16_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made metric function for int32_t elements.
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 */
Packit 9f0df5
size_t list_meter_int32_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made metric function for int64_t elements.
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 */
Packit 9f0df5
size_t list_meter_int64_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made metric function for uint8_t elements.
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 */
Packit 9f0df5
size_t list_meter_uint8_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made metric function for uint16_t elements.
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 */
Packit 9f0df5
size_t list_meter_uint16_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made metric function for uint32_t elements.
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 */
Packit 9f0df5
size_t list_meter_uint32_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made metric function for uint64_t elements.
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 */
Packit 9f0df5
size_t list_meter_uint64_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made metric function for float elements.
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 */
Packit 9f0df5
size_t list_meter_float(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made metric function for double elements.
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 */
Packit 9f0df5
size_t list_meter_double(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made metric function for string elements.
Packit 9f0df5
 * @see list_attributes_copy()
Packit 9f0df5
 */
Packit 9f0df5
size_t list_meter_string(const void *el);
Packit 9f0df5
Packit 9f0df5
                                /*          hash functions          */
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made hash function for int8_t elements.
Packit 9f0df5
 * @see list_attributes_hash_computer()
Packit 9f0df5
 */
Packit 9f0df5
list_hash_t list_hashcomputer_int8_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made hash function for int16_t elements.
Packit 9f0df5
 * @see list_attributes_hash_computer()
Packit 9f0df5
 */
Packit 9f0df5
list_hash_t list_hashcomputer_int16_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made hash function for int32_t elements.
Packit 9f0df5
 * @see list_attributes_hash_computer()
Packit 9f0df5
 */
Packit 9f0df5
list_hash_t list_hashcomputer_int32_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made hash function for int64_t elements.
Packit 9f0df5
 * @see list_attributes_hash_computer()
Packit 9f0df5
 */
Packit 9f0df5
list_hash_t list_hashcomputer_int64_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made hash function for uint8_t elements.
Packit 9f0df5
 * @see list_attributes_hash_computer()
Packit 9f0df5
 */
Packit 9f0df5
list_hash_t list_hashcomputer_uint8_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made hash function for uint16_t elements.
Packit 9f0df5
 * @see list_attributes_hash_computer()
Packit 9f0df5
 */
Packit 9f0df5
list_hash_t list_hashcomputer_uint16_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made hash function for uint32_t elements.
Packit 9f0df5
 * @see list_attributes_hash_computer()
Packit 9f0df5
 */
Packit 9f0df5
list_hash_t list_hashcomputer_uint32_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made hash function for uint64_t elements.
Packit 9f0df5
 * @see list_attributes_hash_computer()
Packit 9f0df5
 */
Packit 9f0df5
list_hash_t list_hashcomputer_uint64_t(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made hash function for float elements.
Packit 9f0df5
 * @see list_attributes_hash_computer()
Packit 9f0df5
 */
Packit 9f0df5
list_hash_t list_hashcomputer_float(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made hash function for double elements.
Packit 9f0df5
 * @see list_attributes_hash_computer()
Packit 9f0df5
 */
Packit 9f0df5
list_hash_t list_hashcomputer_double(const void *el);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * ready-made hash function for string elements.
Packit 9f0df5
 * @see list_attributes_hash_computer()
Packit 9f0df5
 */
Packit 9f0df5
list_hash_t list_hashcomputer_string(const void *el);
Packit 9f0df5
Packit 9f0df5
#ifdef __cplusplus
Packit 9f0df5
}
Packit 9f0df5
#endif
Packit 9f0df5
Packit 9f0df5
#endif
Packit 9f0df5