Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef VIL_NITF2_COMPOUND_FIELD_VALUE_H
00006 #define VIL_NITF2_COMPOUND_FIELD_VALUE_H
00007
00008 #include <vcl_iostream.h>
00009 #include <vcl_string.h>
00010 #include <vcl_istream.h>
00011 #include <vcl_ostream.h>
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 class vil_nitf2_compound_field_value
00028 {
00029 public:
00030
00031 virtual vcl_ostream& output(vcl_ostream&) const = 0;
00032
00033
00034 virtual bool is_valid() const = 0;
00035
00036 virtual ~vil_nitf2_compound_field_value() {}
00037 };
00038
00039
00040
00041 class vil_nitf2_date_time : public vil_nitf2_compound_field_value
00042 {
00043 friend class vil_nitf2_date_time_formatter;
00044 public:
00045 int year;
00046 int month;
00047 int day;
00048 int hour;
00049 int minute;
00050 double second;
00051 int sec_precision;
00052 vil_nitf2_date_time() : year(0), month(0), day(0), hour(0), minute(0), second(0), sec_precision(0) {}
00053 vil_nitf2_date_time(vcl_string format);
00054 virtual ~vil_nitf2_date_time() {}
00055 bool is_valid() const;
00056 bool read(vcl_istream& input, int field_width, bool& out_blank);
00057 bool write(vcl_ostream& output, int field_width) const;
00058 vcl_ostream& output(vcl_ostream& os) const;
00059 };
00060
00061 vcl_ostream& operator << (vcl_ostream& os, const vil_nitf2_date_time& dateTime);
00062
00063
00064
00065 class vil_nitf2_location : public vil_nitf2_compound_field_value
00066 {
00067 friend class vil_nitf2_location_formatter;
00068 public:
00069 enum format_type { format_degrees, format_dmsh };
00070 format_type format;
00071 vil_nitf2_location(format_type format) : format(format) {}
00072 virtual ~vil_nitf2_location() {}
00073 virtual bool read(vcl_istream& input, int field_width, bool& out_blank) = 0;
00074 virtual bool write(vcl_ostream& output, int field_width) = 0;
00075 };
00076
00077
00078
00079
00080 struct vil_nitf2_location_degrees : public vil_nitf2_location
00081 {
00082 public:
00083 vil_nitf2_location_degrees(int precision)
00084 : vil_nitf2_location(format_degrees), precision(precision) {}
00085 bool read(vcl_istream& input, int field_width, bool& out_blank);
00086 bool write(vcl_ostream& output, int field_width);
00087 double lat_degrees;
00088 double lon_degrees;
00089 int precision;
00090 vcl_ostream& output(vcl_ostream&) const;
00091 bool is_valid() const;
00092 };
00093
00094 vcl_ostream& operator << (vcl_ostream& os, const vil_nitf2_location& loc);
00095
00096
00097
00098
00099
00100
00101 struct vil_nitf2_location_dmsh : public vil_nitf2_location
00102 {
00103 public:
00104 vil_nitf2_location_dmsh(int sec_precision)
00105 : vil_nitf2_location(format_dmsh), sec_precision(sec_precision) {}
00106 bool read(vcl_istream& input, int field_width, bool& out_blank);
00107 bool write(vcl_ostream& output, int field_width);
00108 int lat_degrees; int lat_minutes; double lat_seconds; char lat_hemisphere;
00109 int lon_degrees; int lon_minutes; double lon_seconds; char lon_hemisphere;
00110 int sec_precision;
00111 vcl_ostream& output(vcl_ostream&) const;
00112 bool is_valid() const;
00113 };
00114
00115 vcl_ostream& operator << (vcl_ostream& os, const vil_nitf2_location_dmsh& loc);
00116
00117 #endif // VIL_NITF2_COMPOUND_FIELD_VALUE_H