1 // vil_nitf2: Written by Rob Radtke (rob@) and Harry Voorhees (hlv@) of 2 // Stellar Science Ltd. Co. (stellarscience.com) for 3 // Air Force Research Laboratory, 2005. 4 5 #ifndef VIL_NITF2_H 6 #define VIL_NITF2_H 7 8 #include <vil/vil_stream.h> 9 10 // These typedefs serve to maintain the method signatures' distinction between 11 // input and output streams, at least until we decide that such distinction is 12 // no longer useful. 13 typedef vil_stream vil_nitf2_istream; 14 typedef vil_stream vil_nitf2_ostream; 15 16 // Some of the integer values stored in nitf 2.x headers can be 17 // larger than 2^32. That's why we have vil_nitf2_long_long_formatter. 18 // We use this typedef so systems that don't have 64 bit integers 19 // can still use the class. Of course they will break if they try to 20 // read a header that contains a value greater than 2^32. Fortunately, 21 // that is somewhat rare. 22 #include <vxl_config.h> 23 #if VXL_HAS_INT_64 24 typedef vxl_int_64 vil_nitf2_long; 25 #else 26 typedef vxl_int_32 vil_nitf2_long; 27 #endif 28 29 // Wrapper class for shared enums and static variables, to avoid circular 30 // dependencies among classes 31 // 32 class vil_nitf2 33 { 34 public: 35 // NITF field data types supported 36 enum enum_field_type { type_undefined=0, 37 type_int, type_long_long, type_double, 38 type_char, type_string, type_binary, 39 type_location, type_date_time, 40 type_tagged_record_sequence }; 41 42 // Controls the level of detail of logging to std::cout. 43 // All errors are logged to std::cerr, irrespective of log level. 44 enum enum_log_level { log_none=0, log_info, log_debug }; 45 46 // Logging level for all vil_nitf classes. This could be generalized to an 47 // array, if different subsets of classes want their own logging levels. 48 static enum_log_level s_log_level; 49 /** 50 * Call this function to flush all of the nitf2 classes statically 51 * allocated memory. Usually, you'd want to do this just before 52 * your application terminates or after you're done using vil_nitf2 53 * related classes. It's not a big deal if you call it too early (or often), 54 * the vil_nitf2 classes are smart enough to re-generate these members if 55 * they are needed later 56 */ 57 static void cleanup_static_members(); 58 }; 59 60 61 62 63 #define VIL_NITF2_LOG(LEVEL) \ 64 if (vil_nitf2::s_log_level < vil_nitf2::LEVEL) ; else std::cout 65 66 #endif // VIL_NITF2_H 67