vil_nitf2_field.cxx
Go to the documentation of this file.
1 // vil_nitf2: Written by Harry Voorhees (hlv@) and Rob Radtke (rob@) of
2 // Stellar Science Ltd. Co. (stellarscience.com) for
3 // Air Force Research Laboratory, 2005.
4 
5 #include "vil_nitf2_field.h"
6 #include "vil_nitf2.h"
10 
12 {
15  }
16  else {
18  }
19 }
20 
21 std::string vil_nitf2_field::tag() const
22 {
23  return m_definition->tag;
24 }
25 
26 std::string vil_nitf2_field::pretty_name() const
27 {
28  return m_definition->pretty_name;
29 }
30 
31 std::string vil_nitf2_field::description() const
32 {
33  return m_definition->description;
34 }
35 
37 {
38  auto* tr = new field_tree;
39  tr->columns.push_back( tag() );
40  tr->columns.push_back( pretty_name() );
41  return tr;
42 }
43 
45 {
46  for (auto & i : children) {
47  delete i;
48  }
49  children.clear();
50 }
51 
53 {
54  if (num_dimensions()==0) {
55  return (vil_nitf2_scalar_field*) this;
56  } else {
57  return nullptr;
58  }
59 }
60 
62 {
63  if (num_dimensions()>0) {
64  return (vil_nitf2_array_field*) this;
65  } else {
66  return nullptr;
67  }
68 }
69 
70 std::ostream& operator << (std::ostream& os, const vil_nitf2_field& field)
71 {
72  return field.output(os);
73 }
vil_nitf2::enum_field_type type() const
virtual field_tree * get_tree() const
std::vector< std::string > columns
vil_nitf2_scalar_field * scalar_field()
virtual int num_dimensions() const =0
vil_nitf2_array_field * array_field()
std::string tag() const
enum_field_type
Definition: vil_nitf2.h:36
vil_nitf2::enum_field_type field_type
std::string description() const
vil_nitf2_field_definition * m_definition
std::ostream & operator<<(std::ostream &os, const vil_nitf2_field &field)
std::vector< field_tree * > children
Abstract class for array fields, i.e., fields that occur within a repeat loop.
std::string pretty_name() const
vil_nitf2_field_formatter * formatter
virtual std::ostream & output(std::ostream &os) const =0