Go to the documentation of this file.00001
00002
00003
00004
00005 #include "vil_nitf2_field_functor.h"
00006 #include "vil_nitf2_tagged_record.h"
00007 #include "vil_nitf2_field.h"
00008 #include "vil_nitf2_index_vector.h"
00009
00010 bool vil_nitf2_field_specified::
00011 operator() (vil_nitf2_field_sequence* record,
00012 const vil_nitf2_index_vector& indexes, bool& result)
00013 {
00014 if (!record->find_field_definition(tag)) {
00015
00016 return false;
00017 }
00018 vil_nitf2_field* field = record->get_field(tag);
00019 if (field != 0) {
00020 vcl_string value;
00021 bool is_string_value = record->get_value(tag, indexes, value, true);
00022 if (is_string_value) {
00023
00024
00025 result = !value.empty();
00026 } else {
00027
00028
00029 result = false;
00030 }
00031 } else {
00032
00033 result = true;
00034 }
00035 return true;
00036 }
00037
00038 bool vil_nitf2_max_field_value_plus_offset_and_threshold::
00039 operator() (vil_nitf2_field_sequence* record,
00040 const vil_nitf2_index_vector& indexes, int& value)
00041 {
00042 int value1 = 0;
00043 bool found = record->get_value(tag, indexes, value1, true);
00044 value1 *= tag_factor;
00045 value1 += offset;
00046 value = (value1 < min_threshold) ? min_threshold : value1;
00047 return found;
00048 }
00049
00050 bool vil_nitf2_multiply_field_values::
00051 operator() (vil_nitf2_field_sequence* record,
00052 const vil_nitf2_index_vector& indexes, int& value) {
00053 int value1, value2;
00054 bool found = record->get_value(tag_1, indexes, value1, true);
00055 found &= record->get_value(tag_2, indexes, value2, true);
00056 if (found) {
00057 value = value1 * value2;
00058 return true;
00059 } else {
00060 value = 0;
00061 return use_zero_if_tag_not_found;
00062 }
00063 }