3D-ICE 3.0.0
Data Structures | Typedefs | Functions
list_template.h File Reference
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  ListTypeListNode_t
 
struct  ListTypeList_t
 

Typedefs

typedef struct ListTypeListNode_t ListTypeListNode_t
 
typedef struct ListTypeList_t ListTypeList_t
 

Functions

void ListName_list_init (ListTypeList_t *list)
 
void ListName_list_copy (ListTypeList_t *dst, ListTypeList_t *src)
 
void ListName_list_destroy (ListTypeList_t *list)
 
ListTypeListNode_tListName_list_begin (ListTypeList_t *list)
 
ListTypeListNode_tListName_list_end (ListTypeList_t *list)
 
ListTypeListNode_tListName_list_next (ListTypeListNode_t *node)
 
ListTypeListNode_tListName_list_prev (ListTypeListNode_t *node)
 
ListType_t * ListName_list_data (ListTypeListNode_t *node)
 
void ListName_list_insert_begin (ListTypeList_t *list, ListType_t *data)
 
void ListName_list_insert_end (ListTypeList_t *list, ListType_t *data)
 
ListType_t * ListName_list_find (ListTypeList_t *list, ListType_t *data)
 
void ListName_list_print (ListTypeList_t *list, FILE *stream, String_t prefix)
 

Typedef Documentation

◆ ListTypeList_t

Definition of the type ListTypeListNode_t

Definition at line 140 of file list_template.h.

◆ ListTypeListNode_t

Definition of the type ListTypeListNode_t

Definition at line 138 of file list_template.h.

Function Documentation

◆ ListName_list_begin()

ListTypeListNode_t * ListName_list_begin ( ListTypeList_t list)

Returns the first node in the list

Parameters
listthe address of the list
Returns
a pointer to the first node in the list
NULL if the list is empty

◆ ListName_list_copy()

void ListName_list_copy ( ListTypeList_t dst,
ListTypeList_t src 
)

Copies the structure src into dst , as an assignement

The function destroys the content of dst and then makes the copy

Parameters
dstthe address of the left term sructure (destination)
srcthe address of the right term structure (source)

◆ ListName_list_data()

ListType_t * ListName_list_data ( ListTypeListNode_t node)

Returns the data stored by a node in the list

Parameters
nodethe pointer to the node
Returns
a pointer to the data stored in node

◆ ListName_list_destroy()

void ListName_list_destroy ( ListTypeList_t list)

Destroys the content of the fields of the structure list

The function releases any dynamic memory used by the structure and resets its state calling TTT_list_init .

Parameters
listthe address of the structure to destroy

◆ ListName_list_end()

ListTypeListNode_t * ListName_list_end ( ListTypeList_t list)

Returns the last node in the list

Parameters
listthe address of the list
Returns
a pointer to the last node in the list
NULL if the list is empty

◆ ListName_list_find()

ListType_t * ListName_list_find ( ListTypeList_t list,
ListType_t *  data 
)

Finds an elemnt in the list

Parameters
listthe address of the list
datathe address of the data to find
Returns
a pointer to the data, if found
NULL if the list does not contain data

◆ ListName_list_init()

void ListName_list_init ( ListTypeList_t list)

Inits the fields of the list structure with default values

Parameters
listthe address of the structure to initalize

◆ ListName_list_insert_begin()

void ListName_list_insert_begin ( ListTypeList_t list,
ListType_t *  data 
)

Inserts new data at the beginning of the list

The function creates a new node to be added at the beginning of the list. Then, it makes a local copy of data .

Parameters
listthe address of the list
datathe address of the data to insert

◆ ListName_list_insert_end()

void ListName_list_insert_end ( ListTypeList_t list,
ListType_t *  data 
)

Inserts new data at the end of the list

The function creates a new node to be added at the end of the list. Then, it makes a local copy of data .

Parameters
listthe address of the list
datathe address of the data to insert

◆ ListName_list_next()

ListTypeListNode_t * ListName_list_next ( ListTypeListNode_t node)

Returns the next node in the list

Parameters
nodethe pointer to the current position
Returns
a pointer to the node in the list that follows node
NULL if the next node does not exist

◆ ListName_list_prev()

ListTypeListNode_t * ListName_list_prev ( ListTypeListNode_t node)

Returns the previous node in the list

Parameters
nodethe pointer to the current position
Returns
a pointer to the node in the list that precede node
NULL if the previous node does not exist

◆ ListName_list_print()

void ListName_list_print ( ListTypeList_t list,
FILE *  stream,
String_t  prefix 
)

Prints the content of the list

Parameters
listthe address of the list to print
streamthe output stream (must be already open)
prefixa string to be printed as prefix at the beginning of each line