INSEE 05.04.2011
Interconnection Nertworks Simulation and Evaluation Environment
|
00001 #ifndef LIST_H 00002 #define LIST_H 00003 00009 typedef struct _ListElement 00010 { 00011 void *previous; /* Null means first element */ 00012 void *next; /* Null means last element */ 00013 void *pointer; 00014 } listElement; 00015 void DestroyListElement( listElement * ); 00016 listElement *CreateListElement( void * ); 00017 00018 listElement *AddBeforeElement( listElement *, void * ); 00019 listElement *AddAfterElement( listElement *, void * ); 00020 00021 typedef struct _List 00022 { 00023 int emptyList; /* TRUE / FALSE */ 00024 listElement *first; 00025 listElement *last; 00026 listElement *nextInLoop; 00027 } list; 00028 00029 void DestroyList( list ** ); 00030 // Before destroying the list, 00031 // probably, you should destroy the elements the list points to. 00032 // If they are not destroyed, they might be left "dangling" 00033 // if nobody else is pointing to them 00034 list *CreateVoidList(); 00035 00036 void AddFirst( list *, void * ); 00037 void AddLast ( list *, void * ); 00038 void *StartLoop( list * ); 00039 void *GetNext ( list * ); 00040 int IsInList( list * , void * ); 00041 int ElementsInList( list * ); 00042 void RemoveFromList( list *, void *); 00043 void PrintList( list *thisList ); 00044 00045 #endif /* LIST_H */