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

idliste.h

Go to the documentation of this file.
00001 /************************************************************************* 00002 * $Id: idliste.h,v 1.1 2005/09/09 08:22:35 bellet Exp $ 00003 ************************************************************************** 00004 This software is governed by the CeCILL license under French law and 00005 abiding by the rules of distribution of free software. You can use, 00006 modify and/ or redistribute the software under the terms of the CeCILL 00007 license as circulated by CEA, CNRS and INRIA at the following URL 00008 "http://www.cecill.info". 00009 00010 As a counterpart to the access to the source code and rights to copy, 00011 modify and redistribute granted by the license, users are provided only 00012 with a limited warranty and the software's author, the holder of the 00013 economic rights, and the successive licensors have only limited 00014 liability. 00015 00016 In this respect, the user's attention is drawn to the risks associated 00017 with loading, using, modifying and/or developing or reproducing the 00018 software by the user in light of its specific status of free software, 00019 that may mean that it is complicated to manipulate, and that also 00020 therefore means that it is reserved for developers and experienced 00021 professionals having in-depth computer knowledge. Users are therefore 00022 encouraged to load and test the software's suitability as regards their 00023 requirements in conditions enabling the security of their systems and/or 00024 data to be ensured and, more generally, to use and operate it in the 00025 same conditions as regards security. 00026 00027 The fact that you are presently reading this means that you have had 00028 knowledge of the CeCILL license and that you accept its terms. 00029 00030 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 00031 l'Image). All rights reserved. See License.txt for details. 00032 00033 Version 1.0 05/09/2005 00034 *************************************************************************/ 00035 00036 #ifndef __IDLISTE_H__ 00037 #define __IDLISTE_H__ 00038 #include "idgen.h" 00039 00040 /* 00041 * Declarations permettant d'utiliser le type LIST of IDO 00042 */ 00043 00044 /* modes d'ajout ou de retrait a une liste */ 00045 /* 1 seul possible */ 00046 00047 #define LST_MODE 0x0f 00048 #define LST_BEG 0x0 /* au debut de la liste */ 00049 #define LST_END 0x1 /* a la fin de la liste */ 00050 #define LST_ELEM 0x2 /* apres un element */ 00051 #define LST_ELEM_AV 0x4 /* AVANT un element */ /*JPR */ 00052 00053 /* OU possible sur les valeurs suivantes ex: LST_BEG | LST_PRED | LST_NEXT */ 00054 /* la liaison NEXT et en fait toujours realisee */ 00055 00056 #define LST_NEXT 0x10 /* au champ Pred de l'element */ 00057 #define LST_PRED 0x20 /* au champ Next de l'element 00058 pour arbre binaire */ 00059 #define LST_BIDIR 0x40 /* liste bidirect. */ 00060 00061 00062 00063 00064 /* Types de liste */ 00065 00066 /* structure LIST */ 00067 00068 typedef struct _elem{ 00069 int Numero; 00070 int TypeElem; /* Utile pour les objets PARAM */ 00071 void *Object; 00072 struct _elem *Next; /* En fait, un PLIST_ELEMENT */ 00073 struct _elem *Pred; /* En fait, un PLIST_ELEMENT */ 00074 } LIST_ELEMENT; 00075 00076 typedef LIST_ELEMENT *PLIST_ELEMENT; 00077 00078 typedef PLIST_ELEMENT PLIST , *PPLIST; 00079 00080 typedef struct { 00081 int NbElems; 00082 PLIST_ELEMENT First; 00083 PLIST_ELEMENT Last; /* inutilise pour un Arbre */ 00084 int Numero; /* A quoi sert-il ici ??? */ 00085 char *_message,*_fichier; 00086 int Type; /* LST */ /* IMPERATIVEMENT DERNIER DE LA STRUCTURE */ 00087 } PRIVATE_LIST; 00088 00089 #define _IdLstPrivate(lst) (((PRIVATE_LIST*)(lst))-1) 00090 00091 #include "idliste-restricted.h" 00092 00093 00094 /* Bazard Laurent Belatrech */ 00095 #ifndef SWIG 00096 #define IdLstNumero(lst) (_IdLstPrivate(lst)->Numero) 00097 #define IdLstMessage(lst) (_IdLstPrivate(lst)->_message) 00098 #define IdLstFichier(lst) (_IdLstPrivate(lst)->_fichier) 00099 #else 00100 int IdLstNumero(PLIST); 00101 char * IdLstMessage(PLIST); 00102 char * IdLstFichier(PLIST); 00103 #endif 00104 00105 00106 00107 00108 void IdLstClear(PLIST lst); 00109 PLIST IdLstCopy(PLIST lst); 00110 00111 00112 00113 #ifndef SWIG 00114 #define IdLstNbElems(l) ( _IdLstPrivate(l)->NbElems) 00115 #define IdLstNbObjects(l) ( _IdLstPrivate(l)->NbElems) 00116 #define IdLstType(l) ( _IdLstPrivate(l)->Type) 00117 #define IdLstGetTypeObj(el) ( (el)->TypeElem) 00118 #define IdLstSetTypeObj(el, type) ( (el)->TypeElem) = (type) 00119 #define IdLstFirst(l) ( _IdLstPrivate(l)->First) 00120 #define IdLstList(l) ( _IdLstPrivate(l)->First) 00121 00122 /* compatibilite avec anciennes versions JPR */ 00123 #define IdLstLast(l) ( _IdLstPrivate(l)->Last) 00124 00125 #define IdLstNext(el) ( ((el) )->Next) 00126 #define IdLstPrevious(el) ( ((el) )->Pred) 00127 #define IdLstPtrObj(el) ( ((el))->Object) 00128 #define IdLstAddFirst(list,obj) \ 00129 IdLstAddElement((list),((void *)obj),LST_BEG|LST_BIDIR,NULL) 00130 #define IdLstAddLast(list,obj) \ 00131 IdLstAddElement((list),((void *)obj),LST_END|LST_BIDIR,NULL) 00132 #endif 00133 00134 #ifdef SWIG 00135 int IdLstNbElems (PLIST); 00136 int IdLstNbObjects (PLIST); 00137 int IdLstType (PLIST); 00138 int IdLstGetTypeObj (PLIST_ELEMENT); 00139 void IdLstSetTypeObj(PLIST_ELEMENT,int); 00140 PLIST_ELEMENT IdLstFirst(PLIST); 00141 PLIST_ELEMENT IdLstList (PLIST); 00142 PLIST_ELEMENT IdLstLast (PLIST); 00143 PLIST_ELEMENT IdLstNext (PLIST_ELEMENT); 00144 PLIST_ELEMENT IdLstPrevious(PLIST_ELEMENT); 00145 void * IdLstPtrObj (PLIST_ELEMENT); 00146 int IdLstAddFirst (PLIST, void *); 00147 int IdLstAddLast (PLIST, void *); 00148 #endif 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 /* FUNCTION DESCRIPTION ************************************************** 00160 00161 IdLstNbElems (macro) 00162 00163 RESUME: Retourne le nombre d'elements de la liste 00164 00165 DESCRIPTION: Retourne le nombre d'elements de la liste 00166 00167 SYNTAXE: int nbElem = IdLstNbElems(PLIST liste); 00168 00169 RETOUR: type : int 00170 role : nombre d'element de la liste 00171 00172 PARAMETRES: 00173 nom : liste 00174 type : PLIST 00175 role : liste ou arbre binaire 00176 00177 FICHIER: idliste.h 00178 00179 ******************************************************** END DESCRIPTION */ 00180 00181 /* FUNCTION DESCRIPTION ************************************************** 00182 00183 IdLstType (macro) 00184 00185 RESUME: Retourne le type de la liste (inutilise actuellement) 00186 00187 DESCRIPTION: Retourne le type de la liste (inutilise actuellement) 00188 00189 SYNTAXE: int typList = IdLstType(PLIST liste); 00190 00191 RETOUR: type : int 00192 role : type de la liste 00193 00194 PARAMETRES: 00195 nom : liste 00196 type : PLIST 00197 role : liste ou arbre binaire 00198 00199 FICHIER: idliste.h 00200 00201 ******************************************************** END DESCRIPTION */ 00202 00203 /* FUNCTION DESCRIPTION ************************************************** 00204 00205 IdLstGetTypeObj (macro) 00206 00207 RESUME: Retourne le type de l'Objet pointe par l'Element 00208 00209 DESCRIPTION: Retourne le type de l'Objet pointe par l'Element 00210 00211 SYNTAXE: int typObj = IdLstGetTypeObj(PLIST_ELEMENT element); 00212 00213 RETOUR: type : int 00214 role : type de l'Objet pointe par l'Element 00215 00216 PARAMETRES: 00217 nom : elem 00218 type : PLIST_ELEMENT 00219 role : Element de liste 00220 00221 FICHIER: idliste.h 00222 00223 ******************************************************** END DESCRIPTION */ 00224 00225 /* FUNCTION DESCRIPTION ************************************************** 00226 00227 IdLstSetTypeObj (macro) 00228 00229 RESUME: Positionne le type de l'Objet pointe par l'Element 00230 00231 DESCRIPTION: Positionne le type de l'Objet pointe par l'Element 00232 (Sous la responsabilite de l'utilisateur) 00233 00234 SYNTAXE: void IdLstSetTypeObj(PLIST_ELEMENT element, int typeObj); 00235 00236 RETOUR: type : void 00237 role : 00238 00239 PARAMETRES: 00240 nom : elem 00241 type : PLIST_ELEMENT 00242 role : Element de liste 00243 00244 nom : type 00245 role : Type de l'objet 00246 00247 FICHIER: idliste.h 00248 00249 ******************************************************** END DESCRIPTION */ 00250 00251 /* FUNCTION DESCRIPTION ************************************************** 00252 00253 IdLstFirst (macro) 00254 00255 RESUME: retourne le pointeur sur le premier element de la liste 00256 00257 DESCRIPTION: retourne le pointeur sur le premier element de la liste 00258 00259 SYNTAXE: PLIST_ELEMENT elt = IdLstFirst(PLIST liste); 00260 00261 RETOUR: type : PLIST_ELEMENT 00262 role : pointeur sur le premier element de la liste 00263 00264 PARAMETRES: 00265 nom : liste 00266 type : PLIST 00267 role : liste 00268 00269 FICHIER: idliste.h 00270 00271 ******************************************************** END DESCRIPTION */ 00272 00273 /* FUNCTION DESCRIPTION ************************************************** 00274 00275 IdLstLast (macro) 00276 00277 RESUME: retourne le pointeur sur le dernier element de la liste 00278 00279 DESCRIPTION: retourne le pointeur sur le dernier element de la liste 00280 00281 SYNTAXE: PLIST_ELEMENT elt = IdLstLast(PLIST liste); 00282 00283 RETOUR: type : PLIST_ELEMENT 00284 role : pointeur sur le premier element de la liste 00285 00286 PARAMETRES: 00287 nom : liste 00288 type : PLIST 00289 role : liste 00290 00291 FICHIER: idliste.h 00292 00293 ******************************************************** END DESCRIPTION */ 00294 00295 00296 /* FUNCTION DESCRIPTION ************************************************** 00297 00298 IdLstNext (macro) 00299 00300 RESUME: retourne le pointeur sur l'element suivant de la liste 00301 00302 DESCRIPTION: retourne le pointeur sur l'element suivant de la liste 00303 00304 SYNTAXE: PLIST_ELEMENT elt = IdLstNext(PLIST_ELEMENT elem); 00305 00306 RETOUR: type : PLIST_ELEMENT 00307 role : pointeur sur l'element suivant de la liste 00308 00309 PARAMETRES: 00310 nom : el 00311 type : PLIST_ELEMENT 00312 role : element de la liste dont on veut le suivant. 00313 00314 FICHIER: idliste.h 00315 00316 ******************************************************** END DESCRIPTION */ 00317 00318 /* FUNCTION DESCRIPTION ************************************************** 00319 00320 IdLstPrevious (macro) 00321 00322 RESUME: retourne le pointeur sur l'element precedant de la liste 00323 00324 DESCRIPTION: retourne le pointeur sur l'element precedant de la liste 00325 00326 SYNTAXE: PLIST_ELEMENT elt = IdLstNext(PLIST_ELEMENT elem); 00327 00328 RETOUR: type : PLIST_ELEMENT 00329 role : pointeur sur l'element precedant de la liste 00330 00331 PARAMETRES: 00332 nom : el 00333 type : PLIST_ELEMENT 00334 role : element de la liste dont on veut le precedant. 00335 00336 FICHIER: idliste.h 00337 00338 ******************************************************** END DESCRIPTION */ 00339 00340 /* FUNCTION DESCRIPTION ************************************************** 00341 00342 IdLstPtrObj (macro) 00343 00344 RESUME: retourne le pointeur sur l'objet reference ds l'element 00345 00346 DESCRIPTION: retourne le pointeur sur l'objet reference ds l'element 00347 00348 SYNTAXE: void * objet = IdLstPtrObj(PLIST liste); 00349 00350 RETOUR: type : void * 00351 role : pointeur sur l'objet reference ds l'element 00352 00353 PARAMETRES: 00354 nom : el 00355 type : PLIST_ELEMENT 00356 role : element de la liste dont on veut objet reference 00357 00358 FICHIER: idliste.h 00359 00360 ******************************************************** END DESCRIPTION */ 00361 00362 /* FUNCTION DESCRIPTION ************************************************** 00363 00364 IdLstAddFirst (macro) 00365 00366 RESUME: Creation et ajout d'un element en tete d'une liste bidirectionnelle 00367 00368 DESCRIPTION: Creation et ajout d'un element en tete d'une liste bidirectionnelle 00369 00370 SYNTAXE: int retCode = IdLstAddFirst(PLIST liste, void *objet); 00371 00372 RETOUR: type : int 00373 role : Indication d'erreur (inactif actuellement) 00374 00375 PARAMETRES: 00376 nom : liste 00377 type : PLIST 00378 role : Liste a laquelle l'element nouveau doit etre rajoute 00379 00380 nom : objet 00381 type : void * 00382 role : objet a lier a l'element (champ Object de la liste) 00383 00384 FICHIER: idliste.h 00385 00386 ******************************************************** END DESCRIPTION */ 00387 00388 /* FUNCTION DESCRIPTION ************************************************** 00389 00390 IdLstAddLast (macro) 00391 00392 RESUME: Creation et ajout d'un element en queue d'une liste bidirectionnelle 00393 00394 DESCRIPTION: Creation et ajout d'un element en queue d'une liste bidirectionnelle 00395 00396 SYNTAXE: int retCode = IdLstAddLast(PLISTE liste, void *objet); 00397 00398 RETOUR: type : int 00399 role : Indication d'erreur (inactif actuellement) 00400 00401 PARAMETRES: 00402 nom : liste 00403 type : PLIST 00404 role : Liste a laquelle l'element nouveau doit etre rajoute 00405 00406 nom : objet 00407 type : void * 00408 role : objet a lier a l'element (champ Object de la liste) 00409 00410 FICHIER: idliste.h 00411 00412 ******************************************************** END DESCRIPTION */ 00413 00414 00415 /* FUNCTION DESCRIPTION ************************************************** 00416 00417 IdLstFree (macro) 00418 00419 RESUME: liberation de la memoire occupee par une liste. 00420 00421 DESCRIPTION: liberation de la memoire occupee par une liste. Les objets 00422 lies a la liste ne sont pas liberes. 00423 Au retour le pointeur liste est mis a zero. 00424 00425 SYNTAXE: void IdLstFree(PLISTE liste); 00426 00427 RETOUR: type : rien 00428 role : 00429 00430 PARAMETRES: 00431 nom : liste 00432 type : PLIST 00433 role : liste a liberer 00434 00435 FICHIER: idliste.h 00436 00437 ******************************************************** END DESCRIPTION */ 00438 00439 /* prototypes fonctions LIST */ 00440 00441 #ifndef SWIG 00442 #define IdLstFree(l) _IdLstFree( (PLIST*)&(l) ) 00443 #define IdLstDestroyNoControl(l,f) _IdLstDestroyNoControl( (PLIST*)&(l),(f) ) 00444 00445 #else 00446 void IdLstFree(PLIST); 00447 void IdLstDestroyNoControl(PLIST, VOID_FUNCTION_VOIDP_POINTER); 00448 #endif 00449 00450 PLIST IdLstAlloc (void); 00451 PLIST_ELEMENT IdLstSearchElemObj (PLIST, void *); 00452 00453 typedef int (*INT_FUNCTION_PLISTELEMENT_VOIDP_POINTER)(PLIST_ELEMENT,void*); 00454 00455 PLIST_ELEMENT IdLstFindElem (PLIST, 00456 INT_FUNCTION_PLISTELEMENT_VOIDP_POINTER, 00457 void *); 00458 void IdLstDestroyElemNoControl (PLIST, PLIST_ELEMENT, 00459 VOID_FUNCTION_VOIDP_POINTER ); 00460 00461 /* a l'attention de ceux qui se tromperaient ds le nom */ 00462 00463 #ifndef SWIG 00464 #define IdLstFindElemObj(a,b,c) IdLstFindElem( (a),(b),(c) ) 00465 00466 #else 00467 PLIST_ELEMENT IdLstFindElemObj (PLIST, INT_FUNCTION_POINTER, void *); 00468 #endif 00469 00470 int IdLstRemoveFirst (PLIST); 00471 int IdLstRemoveLast (PLIST); 00472 int IdLstRemoveElem (PLIST, PLIST_ELEMENT); 00473 00474 #ifndef SWIG 00475 #define IdLstAddAfter(list,obj,el) \ 00476 IdLstAddElement((list),((void *)obj),LST_ELEM|LST_BIDIR,(el) ) 00477 00478 #define IdLstAddBefore(list,obj,el) \ 00479 IdLstAddElement((list),((void *)obj),LST_ELEM_AV|LST_BIDIR,(el) ) 00480 00481 #else 00482 int IdLstAddAfter(PLIST,void *,PLIST_ELEMENT); 00483 int IdLstAddBefore(PLIST,void *,PLIST_ELEMENT); 00484 #endif 00485 00486 00487 /************************************************************************/ 00488 00489 /* Fonctions internes */ 00490 00491 00492 00493 00494 /************************************************************************/ 00495 00496 #endif 00497 00498

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