Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

lstallo.c File Reference

#include <stdlib.h>
#include "idliste.h"
#include "idprint.h"

Go to the source code of this file.

Functions

void _IdFreeElement (PLIST_ELEMENT p, int d)
 Destruction of an element of a list.

void _IdLstFree (PLIST *lst)
 Destruction of a list.

PLIST_ELEMENT _IdLstAllocElement (void)
 Allocation of an element.

PLIST IdLstAlloc (void)
 Allocation of a list.

PLIST_ELEMENT IdLstSearchElemObj (PLIST pl, void *obj)
 Get an element from a list.

PLIST_ELEMENT IdLstFindElem (PLIST pl, int(*UserCompareFonc)(PLIST_ELEMENT, void *), void *key)
 Get an element from a list by using a comparison key.

void _IdLstDestroyNoControl (PLIST *lst, VOID_FUNCTION_VOIDP_POINTER foncDestr)
 Destruction of a list AND the OBJECTS it refers to.

void IdLstClear (PLIST lst)
 Deletion of the elements of a list BUT not the OBJECTS it refers to.

void IdLstDestroyElemNoControl (PLIST lst, PLIST_ELEMENT elem, VOID_FUNCTION_VOIDP_POINTER foncDestr)
 Deletion of an element of a list AND the refering object.

PLIST IdLstCopy (PLIST lst)
 Duplication of a list AND it's elements BUT NOT the refered objects.


Function Documentation

void _IdFreeElement PLIST_ELEMENT  p,
int  d
 

Destruction of an element of a list.

Warning:
Destruction only works for LINKED lists. Binary trees should be destructed by hand...
Parameters:
p List from which the element is desctructed
d Code targeted for destruction of binary trees (UNUSED)

Definition at line 54 of file lstallo.c.

References d, _elem::Next, and _elem::Pred.

Referenced by _IdLstFree().

PLIST_ELEMENT _IdLstAllocElement void   ) 
 

Allocation of an element.

Returns:
Allocated element

Definition at line 103 of file lstallo.c.

References IdErrPrintf().

void _IdLstDestroyNoControl PLIST lst,
VOID_FUNCTION_VOIDP_POINTER  foncDestr
 

Destruction of a list AND the OBJECTS it refers to.

Warning:
Make sure the given destruction function corresponds to the type of objects that are stored in this list...
Parameters:
lst List to destruct.
foncDestr Pointer to destruction function of a pointed object.

Definition at line 207 of file lstallo.c.

References _IdLstFree(), IdLstFirst, IdLstNext, and IdLstPtrObj.

void _IdLstFree PLIST lst  ) 
 

Destruction of a list.

Parameters:
lst List to desctruct.

Definition at line 70 of file lstallo.c.

References _IdFreeElement(), _IdLstPrivate, IdLstList, IdLstNbElems, _elem::Next, and _elem::Pred.

Referenced by _IdLstDestroyNoControl().

PLIST IdLstAlloc void   ) 
 

Allocation of a list.

Warning:
One should test the returned value before using it...
Returns:
On succes, return a pointeur the first free element of the allocated list. On failure, return 0.

Definition at line 121 of file lstallo.c.

References PRIVATE_LIST::_fichier, PRIVATE_LIST::_message, IdErrPrintf(), LST, and PRIVATE_LIST::Type.

Referenced by IdDcmHdrAlloc().

void IdLstClear PLIST  lst  ) 
 

Deletion of the elements of a list BUT not the OBJECTS it refers to.

Parameters:
lst List from which to delete.
Warning:
If no other reference exists to the pointed object then this creates a memory leak...
Parameters:
lst List to destruct.

Definition at line 231 of file lstallo.c.

References IdLstFirst, IdLstNext, and IdLstRemoveElem().

PLIST IdLstCopy PLIST  lst  ) 
 

Duplication of a list AND it's elements BUT NOT the refered objects.

Parameters:
lst List to duplicate from.
Returns:
Pointeur to the duplicated list.

Definition at line 276 of file lstallo.c.

References PRIVATE_LIST::_fichier, PRIVATE_LIST::_message, IdErrPrintf(), IdLstAddLast, IdLstFirst, IdLstNext, IdLstPtrObj, LST, and PRIVATE_LIST::Type.

void IdLstDestroyElemNoControl PLIST  lst,
PLIST_ELEMENT  elem,
VOID_FUNCTION_VOIDP_POINTER  foncDestr
 

Deletion of an element of a list AND the refering object.

Warning:
If no other reference exists to the pointed object then this creates a memory leak. Also, make sure the given destruction function corresponds to the type of objects that are stored in this list.
Parameters:
lst List from which to delete.
foncDestr Pointer to destruction function of a pointed object.

Definition at line 256 of file lstallo.c.

References IdLstPtrObj, and IdLstRemoveElem().

PLIST_ELEMENT IdLstFindElem PLIST  pl,
int(*  UserCompareFonc)(PLIST_ELEMENT, void *),
void *  key
 

Get an element from a list by using a comparison key.

Parameters:
pl List among which to search.
UserCompareFonc Pointer to caller provided comparison function. If pointer is void then the comparison function is defaulted to equality (FIXME IDODUDE: equality of what???) This function is not aware of the structure of the pointed object and what the key represents.It belongs to the caller to pay attention to the given comparison function pointer and to make sure it corresponds to the structure of key arguement.
key Pointer to comparison key. This function is not aware of the size and type of the key. It belongs to the caller to pay attention to the given pointer and make sure it designates a memory location where the function finds the necessary 'pieces' of information...
Returns:
On succes, return a pointeur to the searched element (that itself points to object obj) among the given list. On failure, return 0.

Definition at line 183 of file lstallo.c.

References IdLstFirst, _elem::Next, and PLIST_ELEMENT.

PLIST_ELEMENT IdLstSearchElemObj PLIST  pl,
void *  obj
 

Get an element from a list.

Parameters:
pl List among which to search.
obj Object corresponding to the element that we search.
Returns:
On succes, return a pointeur to the searched element among list. On failure, return 0.

Definition at line 147 of file lstallo.c.

References IdLstFirst, _elem::Next, and _elem::Object.


Generated on Wed Oct 19 09:28:36 2005 for SIMRI3D by doxygen 1.3.7