core/vil/file_formats/vil_nitf2.cxx
Go to the documentation of this file.
00001 // vil_nitf2: Written by Rob Radtke (rob@) and Harry Voorhees (hlv@) of
00002 // Stellar Science Ltd. Co. (stellarscience.com) for
00003 // Air Force Research Laboratory, 2005.
00004 
00005 #include "vil_nitf2.h"
00006 
00007 // (To enable debug logging, set value to vil_nitf2::log_debug)
00008 vil_nitf2::enum_log_level vil_nitf2::s_log_level = vil_nitf2::log_none;
00009 
00010 #include "vil_nitf2_header.h"
00011 #include "vil_nitf2_field_definition.h"
00012 #include "vil_nitf2_image_subheader.h"
00013 
00014 void vil_nitf2::cleanup_static_members() 
00015 {
00016   // Commented out to test whether this function is needed to avoid reported 
00017   // memory leaks. We'll see what valgrid says.
00018   if( vil_nitf2_header::s_field_definitions_1 ) {
00019     delete vil_nitf2_header::s_field_definitions_1;
00020     vil_nitf2_header::s_field_definitions_1 = 0;
00021   }
00022 
00023   if( vil_nitf2_header::s_field_definitions_20 ) {
00024     delete vil_nitf2_header::s_field_definitions_20;
00025     vil_nitf2_header::s_field_definitions_20 = 0;
00026   }
00027 
00028   if( vil_nitf2_header::s_field_definitions_21 ) {
00029     delete vil_nitf2_header::s_field_definitions_21;
00030     vil_nitf2_header::s_field_definitions_21 = 0;
00031   }
00032 
00033   if( vil_nitf2_image_subheader::s_field_definitions_20 ) {
00034     delete vil_nitf2_image_subheader::s_field_definitions_20;
00035     vil_nitf2_image_subheader::s_field_definitions_20 = 0;
00036   }
00037 
00038   if( vil_nitf2_image_subheader::s_field_definitions_21 ) {
00039     delete vil_nitf2_image_subheader::s_field_definitions_21;
00040     vil_nitf2_image_subheader::s_field_definitions_21 = 0;
00041   }
00042 
00043 }
00044 
00045 class vil_nitf2_auto_cleanup
00046 {
00047 public:
00048    ~vil_nitf2_auto_cleanup()
00049    {
00050      vil_nitf2::cleanup_static_members();
00051    }
00052 };
00053 
00054 static vil_nitf2_auto_cleanup cleanup_object;