Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef VIL_NITF2_FIELD_DEFINITION_H
00006 #define VIL_NITF2_FIELD_DEFINITION_H
00007
00008
00009
00010
00011
00012 #define NITF_LOC new vil_nitf2_location_formatter
00013 #define NITF_INT new vil_nitf2_integer_formatter
00014 #define NITF_DBL new vil_nitf2_double_formatter
00015 #define NITF_EXP new vil_nitf2_exponential_formatter
00016 #define NITF_LONG new vil_nitf2_long_long_formatter
00017 #define NITF_CHAR new vil_nitf2_char_formatter
00018 #define NITF_BIN new vil_nitf2_binary_formatter
00019 #define NITF_STR new vil_nitf2_string_formatter
00020 #define NITF_ENUM new vil_nitf2_enum_string_formatter
00021 #define NITF_DAT new vil_nitf2_date_time_formatter
00022 #define NITF_TRES new vil_nitf2_tagged_record_sequence_formatter
00023
00024 #define NITF_STR_ECS(LEN) NITF_STR(LEN, vil_nitf2_string_formatter::ECS)
00025 #define NITF_STR_ECSA(LEN) NITF_STR(LEN, vil_nitf2_string_formatter::ECSA)
00026 #define NITF_STR_BCS(LEN) NITF_STR(LEN, vil_nitf2_string_formatter::BCS)
00027 #define NITF_STR_BCSA(LEN) NITF_STR(LEN, vil_nitf2_string_formatter::BCSA)
00028
00029 #include <vcl_list.h>
00030
00031 #include "vil_nitf2.h"
00032 #include "vil_nitf2_field_functor.h"
00033
00034 class vil_nitf2_field_definition;
00035 class vil_nitf2_field_definition_repeat_node;
00036 class vil_nitf2_field_formatter;
00037
00038
00039
00040
00041
00042 class vil_nitf2_field_definition_node
00043 {
00044 public:
00045 enum node_type { type_field, type_repeat };
00046 vil_nitf2_field_definition_node(node_type type) : type(type) {}
00047 virtual ~vil_nitf2_field_definition_node() {}
00048
00049
00050 bool is_field_definition() const { return type==type_field; }
00051 bool is_repeat_node() const { return type==type_repeat; }
00052
00053
00054 vil_nitf2_field_definition* field_definition();
00055 vil_nitf2_field_definition_repeat_node* repeat_node();
00056
00057
00058 virtual vil_nitf2_field_definition_node* copy() const = 0;
00059
00060
00061 node_type type;
00062 };
00063
00064
00065
00066
00067
00068
00069 class vil_nitf2_field_definition : public vil_nitf2_field_definition_node
00070 {
00071 public:
00072
00073
00074
00075 vcl_string tag;
00076 vcl_string pretty_name;
00077 bool required;
00078 vil_nitf2_field_formatter* formatter;
00079 bool blanks_ok;
00080 vil_nitf2_field_functor<int>* width_functor;
00081 vil_nitf2_field_functor<bool>* condition_functor;
00082 vcl_string units;
00083 vcl_string description;
00084
00085 bool is_required() const;
00086 bool is_variable_width() const;
00087
00088
00089 vil_nitf2_field_definition(
00090
00091 vcl_string tag,
00092
00093 vcl_string pretty_name,
00094
00095 vil_nitf2_field_formatter* formatter,
00096
00097 bool blanks_ok = false,
00098
00099 vil_nitf2_field_functor<int>* width_functor = 0,
00100
00101 vil_nitf2_field_functor<bool>* condition_functor = 0,
00102
00103 vcl_string units = "",
00104 vcl_string description = "");
00105
00106
00107 vil_nitf2_field_definition_node* copy() const;
00108
00109
00110 ~vil_nitf2_field_definition();
00111 };
00112
00113
00114
00115
00116
00117
00118
00119 class vil_nitf2_field_definitions : public vcl_list<vil_nitf2_field_definition_node*>
00120 {
00121 public:
00122
00123
00124 vil_nitf2_field_definitions& field(
00125 vcl_string tag,
00126 vcl_string pretty_name,
00127 vil_nitf2_field_formatter* formatter,
00128
00129 bool blanks_ok = false,
00130
00131 vil_nitf2_field_functor<int>* width_functor = 0,
00132
00133
00134 vil_nitf2_field_functor<bool>* condition_functor = 0,
00135 vcl_string units = "",
00136 vcl_string description = "");
00137
00138
00139
00140
00141 vil_nitf2_field_definitions& repeat(vil_nitf2_field_functor<int>* repeat_functor,
00142 vil_nitf2_field_definitions& field_definitions);
00143
00144
00145 vil_nitf2_field_definitions& repeat(vcl_string intTag,
00146 vil_nitf2_field_definitions& field_definitions)
00147 { return repeat(new vil_nitf2_field_value<int>(intTag), field_definitions); }
00148
00149
00150 vil_nitf2_field_definitions(const vil_nitf2_field_definitions&);
00151
00152
00153 vil_nitf2_field_definitions() {}
00154
00155
00156 virtual ~vil_nitf2_field_definitions();
00157 };
00158
00159
00160
00161
00162
00163 class vil_nitf2_field_definition_repeat_node : public vil_nitf2_field_definition_node
00164 {
00165 public:
00166
00167 vil_nitf2_field_definition_repeat_node(vil_nitf2_field_functor<int>* repeat_functor,
00168 vil_nitf2_field_definitions* field_definitions)
00169 : vil_nitf2_field_definition_node(type_repeat),
00170 repeat_functor(repeat_functor),
00171 field_definitions(field_definitions) {}
00172
00173
00174 vil_nitf2_field_functor<int>* repeat_functor;
00175 vil_nitf2_field_definitions* field_definitions;
00176
00177
00178 ~vil_nitf2_field_definition_repeat_node();
00179
00180
00181 vil_nitf2_field_definition_node* copy() const;
00182 };
00183
00184 #endif // VIL_NITF2_FIELD_DEFINITION_H