vil_nitf2_field.h
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 #ifndef VIL_NITF2_FIELD_H
6 #define VIL_NITF2_FIELD_H
7 
8 #include <vector>
9 #include <iostream>
10 #include <string>
11 // not used? #include <sstream>
12 #ifdef _MSC_VER
13 # include <vcl_msvc_warnings.h>
14 #endif
15 
17 class vil_nitf2_location;
23 
24 #include "vil_nitf2.h"
25 
26 //-----------------------------------------------------------------------------
27 // vil_nitf2_field is an instance of a single NITF field (or sequence of repeating
28 // fields), including its definition and value, as read from (or to be written
29 // to) a NITF file.
30 
31 // Abstract base class for scalar and array-valued fields, as read from
32 // or to be written to a NITF file. This class includes its definition
33 // information, value information is stored in subclasses.
34 //
36 {
37  public:
38  // Return my identifier
39  std::string tag() const;
40 
41  // Return my descriptive name
42  std::string pretty_name() const;
43 
44  // Return my description
45  std::string description() const;
46 
47  // Return number of dimensions: 0 for scalar fields, positive for array fields
48  virtual int num_dimensions() const = 0;
49 
50  // Downcast methods
53 
54  // Destructor
55  virtual ~vil_nitf2_field() = default;
56 
57  // Output to stream (required overload as a reminder to implement operator <<)
58  virtual std::ostream& output(std::ostream& os) const = 0;
59 
60  // Return my element data type
62 
63  // Description of the field and pointers to the descriptions
64  // of child nodes in the true
65  class field_tree {
66  public:
67  std::vector< std::string > columns;
68  std::vector< field_tree* > children;
69  ~field_tree();
70  };
71 
72  // Returns a field tree, which caller owns
73  virtual field_tree* get_tree() const;
74 
75  protected:
76  // Default constructor
78 
79  // Members
81 };
82 
83 // Output operator
84 std::ostream& operator << (std::ostream& os, const vil_nitf2_field& field);
85 
86 #endif // VIL_NITF2_FIELD_H
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
std::ostream & operator<<(std::ostream &os, const vil_nitf2_field &field)
vil_nitf2_array_field * array_field()
std::string tag() const
enum_field_type
Definition: vil_nitf2.h:36
std::string description() const
vil_nitf2_field_definition * m_definition
vil_nitf2_field(vil_nitf2_field_definition *definition)
std::vector< field_tree * > children
Abstract class for array fields, i.e., fields that occur within a repeat loop.
std::string pretty_name() const
virtual std::ostream & output(std::ostream &os) const =0
virtual ~vil_nitf2_field()=default