DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
stbllist.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
24 #ifndef _STBLLIST_H
25 
26 #define _STBLLIST_H
27 
28 #include "techtype.h"
29 
30 //---Constant and macro definitions for public use-----------------------------
31 
32 #define CREATE_LINK_LIST_HEADER(list) static LINK_LIST_HEADER list = {NULL, &list, &list}
33 
34 //---Enumerations for public use-----------------------------------------------
35 
36 //---Global type defs for public use-------------------------------------------
37 
38 typedef struct
39 {
40  void *next;
41  void *prev;
43 
44 
45 typedef struct
46 {
47  void *null_next; // this MUST be in the same position as the next field in LINK_LIST_PTR_BLK. It
48  // is used to identify the header from an real block
49  void *first;
50  void *last;
52 
53 //---Global Function prototypes for public use---------------------------------
54 // Initialise the header variables of the linked list
55 // Note: Header space defined (NOT static) but not initlaised.
57 
62 
64 
71 
73 
99 BOOLEAN STB_LLSort(LINK_LIST_HEADER * ll_hdr, S16BIT (*cmp_func)(LINK_LIST_PTR_BLK **, LINK_LIST_PTR_BLK **));
100 
101 #endif // _STBLLIST_H
102 
103 //*****************************************************************************
104 // End of file
105 //*****************************************************************************
void STB_LLAddBlockToEnd(LINK_LIST_HEADER *hdr, LINK_LIST_PTR_BLK *new_blk)
Adds the block identified by the new_blk pointer to the end of the linked list identified by the list...
Definition: stbllist.c:325
LINK_LIST_PTR_BLK * STB_LLGetPrevBlock(LINK_LIST_PTR_BLK *blk)
Returns a pointer to the previous block in the linked list, or NULL if at the start of the list...
Definition: stbllist.c:600
LINK_LIST_PTR_BLK * STB_LLGetBlock(LINK_LIST_HEADER *hdr, U16BIT num)
Returns a pointer to the n-th block in the list.
Definition: stbllist.c:698
U16BIT STB_LLGetNumBlocks(LINK_LIST_HEADER *hdr)
Counts and returns the number of blocks in a linked list.
Definition: stbllist.c:736
LINK_LIST_PTR_BLK * STB_LLGetLastBlock(LINK_LIST_HEADER *hdr)
Returns a pointer to the last block in the linked list, identified by hdr.
Definition: stbllist.c:665
void STB_LLRemoveBlock(LINK_LIST_PTR_BLK *blk)
Removes the block identified by the blk pointer from its linked list.
Definition: stbllist.c:488
LINK_LIST_PTR_BLK * STB_LLGetNextBlock(LINK_LIST_PTR_BLK *blk)
Returns a pointer to the next block in the linked list, or NULL if at the end of the list...
Definition: stbllist.c:566
LINK_LIST_PTR_BLK * STB_LLGetFirstBlock(LINK_LIST_HEADER *hdr)
Returns a pointer to the first block in the linked list, identified by hdr.
Definition: stbllist.c:633
BOOLEAN STB_LLCheckBlockInList(LINK_LIST_HEADER *hdr, LINK_LIST_PTR_BLK *blk)
Checks if the supplied pointer is to a block in the specified list.
Definition: stbllist.c:774
System Wide Global Technical Data Type Definitions.
void STB_LLAddBlockBefore(LINK_LIST_PTR_BLK *blk, LINK_LIST_PTR_BLK *new_blk)
Adds the block identified by the new_blk pointer to the linked list before the block identified by th...
Definition: stbllist.c:403
void STB_LLAddBlockAfter(LINK_LIST_PTR_BLK *blk, LINK_LIST_PTR_BLK *new_blk)
Adds the block identified by the new_blk pointer to the linked list after the block identified by the...
Definition: stbllist.c:447
void STB_LLInitialiseHeader(LINK_LIST_HEADER *hdr)
Initialise the header variables of the linked list.
Definition: stbllist.c:119
Definition: stbllist.h:45
void STB_LLAddBlockToStart(LINK_LIST_HEADER *hdr, LINK_LIST_PTR_BLK *new_blk)
Adds the block identified by the new_blk pointer to the start of the linked list identified by the li...
Definition: stbllist.c:364
BOOLEAN STB_LLSort(LINK_LIST_HEADER *ll_hdr, S16BIT(*cmp_func)(LINK_LIST_PTR_BLK **, LINK_LIST_PTR_BLK **))
Sorts the blocks of a link list object in ascending or descending order NOTE: The order in which the ...
Definition: stbllist.c:161
Definition: stbllist.h:38