[Dcmlib] [New feature] LEGACY/DEPRECATION mechanism

Jean-Pierre ROUX jean-pierre.roux at creatis.insa-lyon.fr
Tue Jul 19 18:50:26 CEST 2005


At 10:52 -0400 19/07/05, Mathieu Malaterre wrote:
>Hello,
>
>   I have just finished integrating the deprecation mechanism VTK 
>uses into GDCM. Here is how it works.
>   On visual studio 6 and above, as well as on gcc 3.x and above 
>there is an attribute you can specify to the function that let you 
>mark as deprecated, therefore you can get compile time warning when 
>you use such deprecated functions (instead of run time warnings). 
>This make it very convienent to detect old API at compile time.
>
>   For developpers, you have to change in the header file:
>
>void foo();
>
>into
>
>GDCM_LEGACY(void foo());
>
>  in the implementation file:
>
>void bla::foo()
>{
>  // code
>}


--> I would like, at compile time, to warn user of DicomDir 
constructor not to write any longer:

gdcm::DicomDir *d = new gdcm::DicomDir(name, true); // explore the 
'name' root directory
or
gdcm::DicomDir *d = new gdcm::DicomDir(name, false); // use the 'name' DICOMDIR

but
gdcm::DicomDir *d = new gdcm::DicomDir();
d->SetDirectoryName(rootDirectoryname); // explore a root directory
d->SetLoadMode(load mode user wants, for parsing file headers);
d->Load();

or
gdcm::DicomDir *d = new gdcm::DicomDir();
d->SetDirectoryName(existingDicomdirFilename); // parse the DICOMDIR object
d->Load();

Actually, *everywhere* I'd like to warn users is this kind of case.
Is it any exention for the following syntax?

>#ifndef GDCM_LEGACY_REMOVE
>void bla::foo()
>{
>  GDCM_LEGACY_REPLACED_BODY(bal::foo(), "1.2",
>                            bla::superdupperfoo());
>  // code
>}
>#endif




Thx.
JPRx



>
>   For users:
>   You have access to two options to compile GDCM with:
>  - GDCM_LEGACY_REMOVE:
>    You want to be on the cutting edge of gdcm devlpment and always 
>follow the new fancy features. Therefore you are compiling gdcm lib 
>*without* any old functionality. And therefore you'll get tons of 
>compile time error if you ever turn it on and use old functions.
>
>  - GDCM_LEGACY_SILENT:
>  You have a thousands of line of code developed against gdcm X, but 
>you need some new feature from gdcm CVS (or release X+1), there you 
>don't want no warnings about deprecated method. This will let you 
>use the next release without any warnings or errors.
>
>Mathieu
>
>_______________________________________________
>Dcmlib mailing list
>Dcmlib at creatis.insa-lyon.fr
>http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib

   Jean-Pierre ROUX
   CREATIS - CNRS UMR 5515, INSERM U 630
   Laboratoire de Radiologie Experimentale
   Hopital Cardiologique
   28 Avenue du Doyen LEPINE
   B.P. Lyon-Montchat
   69394 Lyon Cedex 03
 
   Tel      : (+33) 04 72 35 74 12
   Fax      : (+33) 04 72 68 49 16
   URL      : http://www.creatis.univ-lyon1.fr
   e-mail   : jpr at creatis.univ-lyon1.fr
								   



More information about the Dcmlib mailing list