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

kernomfic.c

Go to the documentation of this file.
00001 /************************************************************************* 00002 * $Id: kernomfic.c,v 1.1 2005/09/09 08:22:51 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 /************************************************************************* 00037 * 00038 * Description : Gestion des noms de fichier stockes dans les objets 00039 * 00040 **************************************************************************/ 00041 #include <string.h> // For strlen 00042 #include <stdlib.h> 00043 #include "idima.h" 00044 #include "idvol.h" 00045 #include "idsig.h" 00046 #include "idprint.h" 00047 #include "idseq.h" 00048 #include "idcnt.h" 00049 #include "idcnt3d.h" 00050 00051 00052 /* FUNCTION DESCRIPTION ************************************************** 00053 * * 00054 * * IdGetFileName (fonction) 00055 * * 00056 * * RESUME: recupere le nom de fichier stocke ds un objet 00057 * * 00058 * * DESCRIPTION: recupere le nom de fichier stocke ds un objet 00059 * * 00060 * * SYNTAXE: char *nomFichier = IdGetFileName(void *objet); 00061 * * 00062 * * RETOUR: type : char * 00063 * * role : pointeur sur le nom du fichier. 0 si l'objet ne 00064 * * provient pas d'un fichier ou en cas d'erreur sur obj. 00065 * * 00066 * * PARAMETRES: 00067 * * nom : objet 00068 * * type : void * 00069 * * role : pointeur sur un objet libido provenant d'un fichier 00070 * * 00071 * * FICHIER: nomfic.c 00072 * * 00073 * * EXEMPLE: 00074 * * 00075 * ******************************************************** END DESCRIPTION */ 00076 00077 char *IdGetFileName(void *obj) 00078 { 00079 if (obj) 00080 switch (IdLibidoType(obj)) { 00081 case IMA: 00082 return (_IdImaPrivate(obj)->_fichier); 00083 case VOL: 00084 return (_IdVolPrivate(obj)->_fichier); 00085 case SIG: 00086 return (_IdSigPrivate(obj)->_fichier); 00087 case CNT: 00088 return (_IdCntPrivate(obj)->_fichier); 00089 case SEQ: 00090 return (_IdSeqPrivate(obj)->_fichier); 00091 case CNT3D: 00092 return (_IdCntPrivate(obj)->_fichier); 00093 } 00094 00095 return ((char *) NULL); 00096 } 00097 00098 /* FUNCTION DESCRIPTION ************************************************** 00099 * 00100 * IdSetFileName (fonction) 00101 * 00102 * RESUME: positionne le nom de fichier d'un objet libido 00103 * 00104 * DESCRIPTION: positionne le nom de fichier d'un objet libido 00105 * 00106 * SYNTAXE: int retCode = IdSetFileName(void *obj, char *nomFich); 00107 * 00108 * RETOUR: type : entier 00109 * role : indicateur d'erreur 00110 * 00111 * PARAMETRES: 00112 * nom : obj 00113 * type : void * 00114 * role : pointeur sur l'objet libido 00115 * 00116 * nom : nf 00117 * type : char * 00118 * role : nom de fichier 00119 * 00120 * FICHIER: nomfic.c 00121 * 00122 * EXEMPLE: 00123 * 00124 * ******************************************************** END DESCRIPTION */ 00125 00126 int IdSetFileName(void *obj, char *nf) 00127 { 00128 if (obj) 00129 switch (IdLibidoType(obj)) { 00130 case IMA: 00131 if (_IdImaPrivate(obj)->_fichier) 00132 free((_IdImaPrivate(obj)->_fichier)); 00133 if (nf == 0) 00134 break; /* JPR */ 00135 _IdImaPrivate(obj)->_fichier = 00136 (char *) malloc(strlen(nf) + 1); 00137 strcpy(_IdImaPrivate(obj)->_fichier, nf); 00138 return (1); 00139 00140 case VOL: 00141 if (_IdVolPrivate(obj)->_fichier) 00142 free((_IdVolPrivate(obj)->_fichier)); 00143 if (nf == 0) 00144 break; /* JPR */ 00145 _IdVolPrivate(obj)->_fichier = 00146 (char *) malloc(strlen(nf) + 1); 00147 strcpy(_IdVolPrivate(obj)->_fichier, nf); 00148 return (1); 00149 00150 case SIG: 00151 if (_IdSigPrivate(obj)->_fichier) 00152 free((_IdSigPrivate(obj)->_fichier)); 00153 if (nf == 0) 00154 break; /* JPR */ 00155 _IdSigPrivate(obj)->_fichier = 00156 (char *) malloc(strlen(nf) + 1); 00157 strcpy(_IdSigPrivate(obj)->_fichier, nf); 00158 return (1); 00159 00160 case CNT: 00161 if (_IdCntPrivate(obj)->_fichier) 00162 free((_IdCntPrivate(obj)->_fichier)); 00163 if (nf == 0) 00164 break; /* JPR */ 00165 _IdCntPrivate(obj)->_fichier = 00166 (char *) malloc(strlen(nf) + 1); 00167 strcpy(_IdCntPrivate(obj)->_fichier, nf); 00168 return (1); 00169 00170 case CNT3D: 00171 if (_IdCnt3DPrivate(obj)->_fichier) 00172 free((_IdCnt3DPrivate(obj)->_fichier)); 00173 if (nf == 0) 00174 break; /* JPR */ 00175 _IdCnt3DPrivate(obj)->_fichier = 00176 (char *) malloc(strlen(nf) + 1); 00177 strcpy(_IdCnt3DPrivate(obj)->_fichier, nf); 00178 return (1); 00179 00180 case SEQ: 00181 if (_IdSeqPrivate(obj)->_fichier) 00182 free((_IdSeqPrivate(obj)->_fichier)); 00183 if (nf == 0) 00184 break; 00185 _IdSeqPrivate(obj)->_fichier = 00186 (char *) malloc(strlen(nf) + 1); 00187 strcpy(_IdSeqPrivate(obj)->_fichier, nf); 00188 return (1); 00189 } 00190 return (0); 00191 } 00192 00193 00194 /* FUNCTION DESCRIPTION ************************************************** 00195 * 00196 * IdGetMessage (fonction) 00197 * 00198 * RESUME: recupere le 'message' stocke ds un objet 00199 * 00200 * DESCRIPTION: recupere le nom de fichier stocke ds un objet 00201 * 00202 * SYNTAXE: char *message = IdGetMessage(void *objet); 00203 * 00204 * RETOUR: type : char * 00205 * role : pointeur sur le 'message'. 0 si pas de 'message' 00206 * ou en cas d'erreur sur obj. 00207 * PARAMETRES: 00208 * nom : objet 00209 * type : void * 00210 * role : pointeur sur un objet libido 00211 * 00212 * FICHIER: nomfic.c 00213 * 00214 * EXEMPLE: 00215 * 00216 * ******************************************************** END DESCRIPTION */ 00217 00218 00219 char *IdGetMessage(void *obj) 00220 { 00221 if (obj) 00222 switch (IdLibidoType(obj)) { 00223 case IMA: 00224 return (_IdImaPrivate(obj)->_message); 00225 case VOL: 00226 return (_IdVolPrivate(obj)->_message); 00227 case SIG: 00228 return (_IdSigPrivate(obj)->_message); 00229 case SEQ: 00230 return (_IdSeqPrivate(obj)->_message); 00231 case CNT: 00232 return (_IdCntPrivate(obj)->_message); 00233 case CNT3D: 00234 return (_IdCnt3DPrivate(obj)->_message); 00235 default: 00236 // IdPrintf("IdGetMessage : l'objet passe n'a pas un type LibIDO connu\n"); 00237 return((char *)NULL); 00238 } 00239 00240 return (0); 00241 } 00242 00243 /* FUNCTION DESCRIPTION ************************************************** 00244 * 00245 * IdSetMessage (fonction) 00246 * 00247 * RESUME: positionne le 'message' dans un objet LibIDO 00248 * 00249 * DESCRIPTION: positionne le 'message' dans un objet LibIDO 00250 * 00251 * SYNTAXE: int retCode = IdSetMessage(void *obj,char *nomFich); 00252 * 00253 * RETOUR: type : entier 00254 * role : indicateur d'erreur 00255 * 00256 * PARAMETRES: 00257 * nom : obj 00258 * type : void * 00259 * role : pointeur sur l'objet libido 00260 * 00261 * nom : nf 00262 * type : char * 00263 * role : 'message' 00264 * 00265 * FICHIER: nomfic.c 00266 * 00267 * EXEMPLE: 00268 * 00269 * ******************************************************** END DESCRIPTION */ 00270 00271 int IdSetMessage(void *obj, char *nf) 00272 { 00273 if (obj) 00274 switch (IdLibidoType(obj)) { 00275 case IMA: 00276 if (_IdImaPrivate(obj)->_message) 00277 free((_IdImaPrivate(obj)->_message)); 00278 if (nf == 0) 00279 break; 00280 _IdImaPrivate(obj)->_message = 00281 (char *) malloc(strlen(nf) + 1); 00282 strcpy(_IdImaPrivate(obj)->_message, nf); 00283 return (1); 00284 case VOL: 00285 if (_IdVolPrivate(obj)->_message) 00286 free((_IdVolPrivate(obj)->_message)); 00287 if (nf == 0) 00288 break; 00289 _IdVolPrivate(obj)->_message = 00290 (char *) malloc(strlen(nf) + 1); 00291 strcpy(_IdVolPrivate(obj)->_message, nf); 00292 return (1); 00293 case SIG: 00294 if (_IdSigPrivate(obj)->_message) 00295 free((_IdSigPrivate(obj)->_message)); 00296 if (nf == 0) 00297 break; 00298 _IdSigPrivate(obj)->_message = 00299 (char *) malloc(strlen(nf) + 1); 00300 strcpy(_IdSigPrivate(obj)->_message, nf); 00301 return (1); 00302 case SEQ: 00303 if (_IdSeqPrivate(obj)->_message) 00304 free((_IdSeqPrivate(obj)->_message)); 00305 if (nf == 0) 00306 break; 00307 _IdSeqPrivate(obj)->_message = 00308 (char *) malloc(strlen(nf) + 1); 00309 strcpy(_IdSeqPrivate(obj)->_message, nf); 00310 return (1); 00311 case CNT: 00312 if (_IdCntPrivate(obj)->_message) 00313 free((_IdCntPrivate(obj)->_message)); 00314 if (nf == 0) 00315 break; 00316 _IdCntPrivate(obj)->_message = 00317 (char *) malloc(strlen(nf) + 1); 00318 strcpy(_IdCntPrivate(obj)->_message, nf); 00319 return (1); 00320 case CNT3D: 00321 if (_IdCnt3DPrivate(obj)->_message) 00322 free((_IdCnt3DPrivate(obj)->_message)); 00323 if (nf == 0) 00324 break; 00325 _IdCnt3DPrivate(obj)->_message = 00326 (char *) malloc(strlen(nf) + 1); 00327 strcpy(_IdCnt3DPrivate(obj)->_message, nf); 00328 return (1); 00329 00330 00331 } 00332 return (0); 00333 }

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