⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simple_list.h

📁 Path MPICH-V for MPICH the MPI Implementation
💻 H
字号:
/**@file simple_list.h define the general list functions and structure. */#ifndef SIMPLE_LIST#define SIMPLE_LIST#include "debug.h"#include <stdlib.h>/** An element of a simple list.  */typedef struct __SELEMENT{  struct __SELEMENT* pNext;  /**< pointer to the next element */  void*              data;   /**< pointer to the data */} sElement_t;/** linked list structures and defines. */typedef struct __ll_t{  sElement_t* head; /**< head of the list */  sElement_t* tail; /**< tail of the list */  int size;         /**< number of element in the list */} LinkedList_t;/** add element to the head of list. * @param pll : pointer to a list * @param data : pointer to data to add * @return : data */void* ll_add_head( LinkedList_t* pll, void* data );/** add element to the tail of list. * @param pll : pointer to a list * @param data : pointer to data to add * @return : data */void* ll_add_tail( LinkedList_t* pll, void* data );/** add a data in linked list, sorted by function given in argument. * @param pll : pointer to a linked list * @param data : pointer to the data to add * @param comparator : function (void*->void*->int) * @return : void* */void* ll_add_sorted( LinkedList_t *pll,void *data, int (*comparator)(void *,void *));/** remove head element of list. * @param pll : pointer to a list * @return : data of the removed element */void* ll_remove_head( LinkedList_t* pll );/** remove element of list having specified data. * @param pll : pointer to a list * @param data : pointer to data * @return : data of the removed element */void* ll_remove( LinkedList_t* pll, void* data );/** remove element of list if fct(data,param). * @param pll : pointer to a list * @param fct : comparaison function * @param param : paramto compare with * @return : data of the removed element */void *ll_remove_by_key( LinkedList_t* pll,  int (*fct)(void*, void *), void *param);void *ll_find_by_key( LinkedList_t* pll,  int (*fct)(void*, void *), void *param);/** apply a function to all element of a list. * @param pll : pointer to a list * @param fct : function void* -> void* * @return void*/void ll_dump( LinkedList_t* pll, void (*fct)(void*) );/** create a new list (calloc if NULL pointer). * @param pList : pointer to a list */LinkedList_t* ll_create( LinkedList_t* pList );/** test if list is empty * @param pll : a list * @return 1 if list is empty, 0 else */#define ll_is_empty(pll) (((LinkedList_t*)pll)->head == NULL )void* ll_add_sorted( LinkedList_t *pll,void *data, int (*comparator)(void *,void *));/** free an element of linked list. * @param element : element of a LinkedList_t * @return void */voidfree_ll_elem (sElement_t * element);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -