[Dcmlib] [New feature] LEGACY/DEPRECATION mechanism

Mathieu Malaterre mathieu.malaterre at kitware.com
Tue Jul 19 16:52:49 CEST 2005


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
}

into

#ifndef GDCM_LEGACY_REMOVE
void bla::foo()
{
  GDCM_LEGACY_REPLACED_BODY(bal::foo(), "1.2",
                            bla::superdupperfoo());

  // code
}
#endif


   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




More information about the Dcmlib mailing list