![]() |
API参考
|
linked list 更多...

类 | |
| struct | BslListNode |
| struct | BslList |
宏定义 | |
| #define | BSL_LIST_FREE(pList, pFreeFunc) |
类型定义 | |
| typedef struct BslListNode | BslListNode |
| typedef struct BslList | BslList |
| typedef int32_t(* | BSL_LIST_PFUNC_CMP) (const void *, const void *) |
| typedef void(* | BSL_LIST_PFUNC_FREE) (void *) |
| typedef void *(* | BSL_LIST_PFUNC_DUP) (const void *) |
枚举 | |
| enum | BslListPosition { BSL_LIST_POS_BEFORE , BSL_LIST_POS_AFTER , BSL_LIST_POS_BEGIN , BSL_LIST_POS_END } |
linked list
| #define BSL_LIST_FREE | ( | pList, | |
| pFreeFunc ) |
Delete all the nodes in the list and then frees the header
| typedef int32_t(* BSL_LIST_PFUNC_CMP) (const void *, const void *) |
This is a pointer to the list comparison function used in BSL_LIST_Search function. It takes two pointers and compares them based on a criteria. If the two are equal a zero is returned. If the first should preceed the second, a negative is returned. Else a positive value is returned.
| typedef void *(* BSL_LIST_PFUNC_DUP) (const void *) |
This is a pointer to the Copy function. The copy function takes a pointer to data structure to be freed and must return void.
| typedef void(* BSL_LIST_PFUNC_FREE) (void *) |
This is a pointer to the free function. The free function takes a pointer to data structure to be freed and must return void.
| enum BslListPosition |
the enum for specifying whether to add the element before/after the current element. It is used in BSL_LIST_AddElement() @datastruct BSL_LIST_POS_BEFORE Indication to to add the element before the current element. @datastruct BSL_LIST_POS_AFTER Indication to to add the element after the current element. @datastruct BSL_LIST_POS_BEGIN Indication to to add the element at the beginning of the list. @datastruct BSL_LIST_POS_END Indication to to add the element at the end of the list.
| int32_t BSL_LIST_AddElement | ( | BslList * | pList, |
| void * | pData, | ||
| BslListPosition | enPosition ) |
This function creates a new node before, after or at the begining or end of the current node. If the list was already NULL, the node will be added as the only node.The current pointer is changed to point to the newly added node in the list. If the current pointer is NULL then this operation fails.
| pList | [IN] The list |
| pData | [IN] The element to be added |
| enPosition | [IN] Whether the element is to be added before or after the list |
| The | error code. |
| BSL_SUCCESS | If successful. |
This function is used to concatenate list 2 to list 1.
| pDestList | [IN] The list to which the 2nd list is to be concatenated to. |
| pSrcList | [IN] The list which is to be concatenated. |
| BslList* | The concatenated list. [BslList*] |
| BslList * BSL_LIST_Copy | ( | BslList * | pSrcList, |
| BSL_LIST_PFUNC_DUP | pFuncCpy, | ||
| BSL_LIST_PFUNC_FREE | pfFreeFunc ) |
This function dups a list by copying the list by creating a copy of list and returns the destinaton list pointer.
| pSrcList | [IN] The list |
| pFuncCpy | [IN] The dup function for the data in the node |
| pfFreeFunc | [IN] The pointer to the free function for the data in the node of data |
| BslList* | The duplicated List pointer [BslList*] |
| BslList* | If dup failed or memory allocation fails.[NULL] |
| void * BSL_LIST_Curr | ( | const BslList * | pstList | ) |
This function returns the data of the current element in the list.
| pstList | [IN] Input list |
| void* | Data at the current element in the list [void*] |
| void* | If the current element does not exist in the list [NULL] |
| void* | If memory allocation fails. [NULL] |
| void BSL_LIST_DeleteAll | ( | BslList * | pList, |
| BSL_LIST_PFUNC_FREE | pfFreeFunc ) |
This function deletes all the nodes of the list but does not delete the list header.
| pList | [IN] The list |
| pfFreeFunc | [IN] The freefunction to free the data pointer in each node |
| void BSL_LIST_DeleteAllAfterSort | ( | BslList * | pList | ) |
Delete all the nodes in the list. But it does not delete the data pointers inside the list nodes. It is used only after sort to delete the input list to the sort function.
| pList | [IN] The list. |
| void BSL_LIST_DeleteCurrent | ( | BslList * | pList, |
| BSL_LIST_PFUNC_FREE | pfFreeFunc ) |
This function deletes the current element of list.
| pList | [IN] The list |
| pfFreeFunc | [IN] The pointer to the free function of data |
| void BSL_LIST_DeleteNode | ( | BslList * | pstList, |
| const BslListNode * | pstListNode, | ||
| BSL_LIST_PFUNC_FREE | pfFreeFunc ) |
This function deletes the matching input node from the input list.
| pstList | [IN] The list. |
| pstListNode | [IN] The current reference node. |
| pfFreeFunc | [IN] The pointer to the free function of data. |
| void BSL_LIST_DetachCurrent | ( | BslList * | pList | ) |
This function detaches the current element from the list, the current node will be freed, but the data contained in the current node will not be freed.Also the pList->first, pList->curr and pList->last will be appropriately updated. If the current node is the last node, then pList->curr will point to its previous node after detachment, else it will point to its next node.
| pList | [IN] The list |
| void BSL_LIST_DetachNode | ( | BslList * | pstList, |
| BslListNode ** | pstListNode ) |
This function detaches the matching input node from the input list. The node will be freed but, the data contained in the node will not be freed, and also the pList->first, pList->curr, and pList->last will be appropriately updated. If the matching node is the last node, then pList->curr will point to its previous node after detachment, else it will point to its next node.
| pstList | [IN] The list. |
| pstListNode | [in/out] when it is input parameter, it is the list node to be detached. |
| void * BSL_LIST_First | ( | BslList * | pstList | ) |
This function returns the data at the first element of the list.
| pstList | [IN] the list |
| void* | Data at the first element of the list [void*] |
| void* | If the first element does not exist [NULL] |
| BslListNode * BSL_LIST_FirstNode | ( | const BslList * | list | ) |
This function returns the first element of the list.
| list | [IN] The list. |
| BslListNode* | first element of the list [BslListNode*] |
| BslListNode* | If the first element does not exist [NULL] |
| void BSL_LIST_FreeWithoutData | ( | BslList * | pstList | ) |
This function is used to free the Asn list.
| pstList | [IN] list Pointer to the Asn list which has to be freed |
| void | This function does not return any value. |
| void * BSL_LIST_GetData | ( | const BslListNode * | pstNode | ) |
This function returns the data of the passed list node.
| pstNode | [IN] The node. |
| void* | Data of the passed list node. [void*] |
| void* | If the data is not present in the list node. [NULL] |
| int32_t BSL_LIST_GetElmtIndex | ( | const void * | elmt, |
| BslList * | pstList ) |
This function returns the index (starting a 0 for the first element) of the given element in the given list. Returns -1, if the element is not in the list. Assumes that the list node contains a single pointer.
| elmt | [IN] The element whose index is to be retrieved |
| pstList | [IN] The list to which the element belongs to |
| int32_t | The index of the specified element in the given list [int32_t] |
| int32_t | If the element is not found in the list [-1] |
| void * BSL_LIST_GetIndexNode | ( | uint32_t | ulIndex, |
| BslList * | pList ) |
This function returns the node at the given index in the list, starting at 0.
| pList | [IN] The list |
| ulIndex | [IN] The index in the list |
| Void* | The element which was found [Void*] |
| Void* | If none found [NULL] |
| int32_t BSL_LIST_GetMaxElements | ( | void | ) |
This function returns the max allowed elements in BSL_LIST.
| int32_t | Max configured elements in BSL_LIST |
| uint32_t BSL_LIST_GetMaxQsortCount | ( | void | ) |
This function returns the MAX qsort Size
| uint32_t | Returns the max qsort Size. |
| BslListNode * BSL_LIST_GetNextNode | ( | const BslList * | pstList, |
| const BslListNode * | pstListNode ) |
This function advances the current reference pointer by one and returns the new current node. If the current reference pointer is off the list, the new current node will be the first node of the list (unless the list is NULL).
| pstList | [IN] The list. |
| pstListNode | [IN] The list node. |
| BslListNode* | Pointer to next element in the list. [void*] |
| BslListNode* | If the next element does not exist. [NULL] |
| BslListNode * BSL_LIST_GetPrevNode | ( | const BslListNode * | pstListNode | ) |
This function backs up the current reference pointer by one and returns the new current node.
| pstListNode | [IN] The list node. |
| BslListNode* | Pointer to the previous element in the list |
| BslListNode* | If the previous element does not exist[NULL] |
| void * BSL_LIST_Last | ( | BslList * | pstList | ) |
This function returns the data at the last element of the list.
| pstList | [IN] The list |
| void* | Data at the last element of the list [void*] |
| void* | If the last element does not exist [NULL] |
| BslList * BSL_LIST_New | ( | int32_t | dataSize | ) |
This function is used to create a new list.
| dataSize | [IN] Size of the data inside the list node |
| BslList* | An NULL list [BslList*] |
| void * BSL_LIST_Next | ( | BslList * | pstList | ) |
This function advances the current pointer by one and returns the data address of the new current node. If the current pointer is off the list, the new current node will be the first node of the list (unless the list is NULL).
| pstList | [IN] The list |
| void* | Pointer to the next element in the list [void*] |
| void* | If the next element does not exist [NULL] |
| void * BSL_LIST_Prev | ( | BslList * | pstList | ) |
backs up the current pointer by one and returns the data address of the new current node. If the current pointer is off the list, the new current node will be the last node of the list (unless the list is NULL).
| pstList | [IN] The list |
| void* | Pointer to the previous element in the list [void*] |
| void* | If the previous element does not exist[NULL] |
| void BSL_LIST_RevList | ( | BslList * | pstList | ) |
This function is used to reverse the linked list.
| pstList | [IN] Pointer to the list which has to be reversed |
| void | This function does not return any value. |
| void * BSL_LIST_Search | ( | BslList * | pList, |
| const void * | pSearchFor, | ||
| BSL_LIST_PFUNC_CMP | pSearcher, | ||
| int32_t * | pstErr ) |
This function searches a list based on the comparator function supplied (3rd param). The second param is given to the comparator as its second param and each data item on the list is given as its first param while searching. The comparator must return 0 to indicate a match.
| pList | [IN] The list |
| pSearchFor | [IN] The element to be searched |
| pSearcher | [IN] The pointer to the comparison function of data |
| Void* | The element which was found [Void*] |
| Void* | If none found [NULL] |
| int32_t BSL_LIST_SetMaxElements | ( | int32_t | iMaxElements | ) |
This function sets the max element in BSL_LIST.Default value is 10000000 (10 Million).
| iMaxElements | [IN] Max allowed element in BSL_LIST. It should be in range[0xffff, 0xfffffff] |
| BSL_INVALID_ARG | If input falls outside the range. |
| BSL_SUCCESS | If successful. |
| int32_t BSL_LIST_SetMaxQsortCount | ( | uint32_t | uiQsortSize | ) |
This function set the max qsort Size.Default value is 100000
| uiQsortSize | [IN] Max Buff Size. it should in range of [10000, 67108864] Default value is 100000 |
| int32_t | BSL_SUCCESS on success BSL_INVALID_ARG on Failure. |
| BslList * BSL_LIST_Sort | ( | BslList * | pList, |
| BSL_LIST_PFUNC_CMP | pfCmp ) |
This function sorts the list using the comparison function provided.
| pList | [IN] The list |
| pfCmp | [IN] The comparison function |
| BslList* | If unsuccessful [NULL] |
| BslList* | If successful [The destination sorted list] |