core/vil/file_formats/vil_nitf2.h
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 #ifndef VIL_NITF2_H
00006 #define VIL_NITF2_H
00007 
00008 #include <vil/vil_stream.h>
00009 
00010 // These typedefs serve to maintain the method signatures' distinction between
00011 // input and output streams, at least until we decide that such distinction is
00012 // no longer useful.
00013 typedef vil_stream vil_nitf2_istream;
00014 typedef vil_stream vil_nitf2_ostream;
00015 
00016 // Some of the integer values stored in nitf 2.x headers can be
00017 // larger than 2^32.  That's why we have vil_nitf2_long_long_formatter.
00018 // We use this typedef so systems that don't have 64 bit integers 
00019 // can still use the class.  Of course they will break if they try to
00020 // read a header that contains a value greater than 2^32.  Fortunately,
00021 // that is somewhat rare.
00022 #include <vxl_config.h>
00023 #if VXL_HAS_INT_64
00024 typedef vxl_int_64 vil_nitf2_long;
00025 #else
00026 typedef vxl_int_32 vil_nitf2_long;
00027 #endif
00028 
00029 // Wrapper class for shared enums and static variables, to avoid circular
00030 // dependencies among classes
00031 //
00032 class vil_nitf2
00033 {
00034  public:
00035   // NITF field data types supported
00036   enum enum_field_type { type_undefined=0,
00037                          type_int, type_long_long, type_double,
00038                          type_char, type_string, type_binary,
00039                          type_location, type_date_time, 
00040                          type_tagged_record_sequence };
00041 
00042   // Controls the level of detail of logging to vcl_cout.
00043   // All errors are logged to vcl_cerr, irrespective of log level.
00044   enum enum_log_level { log_none=0, log_info, log_debug };
00045 
00046   // Logging level for all vil_nitf classes. This could be generalized to an
00047   // array, if different subsets of classes want their own logging levels.
00048   static enum_log_level s_log_level;
00049   /**
00050     * Call this function to flush all of the nitf2 classes statically
00051     * allocated memory.  Usually, you'd want to do this just before
00052     * your application terminates or after you're done using vil_nitf2 
00053     * related classes.  It's not a big deal if you call it too early (or often), 
00054     * the vil_nitf2 classes are smart enough to re-generate these members if
00055     * they are needed later
00056     */
00057   static void cleanup_static_members();
00058 };
00059 
00060 
00061 
00062 
00063 #define VIL_NITF2_LOG(LEVEL) \
00064   if (vil_nitf2::s_log_level < vil_nitf2::LEVEL) ; else vcl_cout
00065 
00066 #endif // VIL_NITF2_H