Doxygen Source Code Documentation
thd_idcode.c File Reference
#include "mrilib.h"#include <time.h>#include "thd.h"Go to the source code of this file.
| Functions | |
| void | MCW_hash_idcode (char *hstring, THD_3dim_dataset *dset) | 
| Variables | |
| MCW_idcode | MCW_new_idcode (void) | 
Function Documentation
| 
 | ||||||||||||
| Replace the string part of the ID code with a deterministic hash. ------------------------------------------------------------------------- Definition at line 36 of file thd_idcode.c. References free, THD_3dim_dataset::idcode, ISVALID_DSET, MCW_IDSIZE, MCW_strncpy, MCW_idcode::str, and UNIQ_hashcode(). Referenced by THD_open_1D(), THD_open_3D(), THD_open_analyze(), THD_open_ctfmri(), THD_open_ctfsam(), THD_open_minc(), THD_open_mpeg(), and THD_open_nifti(). 
 00037 {
00038    char *hhh , *rp , rpath[2048] ;
00039    if( hstring == NULL || *hstring == '\0' && !ISVALID_DSET(dset) ) return ;
00040    rp = realpath( hstring , rpath ) ; if( rp == NULL ) rp = hstring ;
00041    hhh = UNIQ_hashcode(rp) ;
00042    MCW_strncpy( dset->idcode.str+3, hhh+3, MCW_IDSIZE-3 ); free((void *)hhh);
00043    return ;
00044 }
 | 
Variable Documentation
| 
 | 
| Routine to return a (hopefully) unique ID code to be used to identify a dataset to other datasets. ------------------------------------------------------------------------- Definition at line 16 of file thd_idcode.c. 
 00017 {
00018    MCW_idcode newid ;
00019    time_t tnow ;
00020    int nn ;
00021 
00022    UNIQ_idcode_fill( newid.str ) ;  /* thd_md5.c */
00023 
00024    tnow = time(NULL) ;
00025    MCW_strncpy( newid.date , ctime(&tnow) , MCW_IDDATE ) ;
00026    nn = strlen(newid.date) ;
00027    if( nn > 0 && newid.date[nn-1] == '\n' ) newid.date[nn-1] = '\0' ;
00028 
00029    return newid ;
00030 }
 | 
 
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
 
 
 
 
       
	   
	   
	   
	  