Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vil_nitf2_array_field Class Referenceabstract

Abstract class for array fields, i.e., fields that occur within a repeat loop. More...

#include <vil_nitf2_array_field.h>

Inheritance diagram for vil_nitf2_array_field:
Inheritance graph
[legend]

Public Member Functions

 vil_nitf2_array_field (vil_nitf2_field_definition *definition, int num_dimensions)
 
 ~vil_nitf2_array_field () override=default
 
int num_dimensions () const override
 Number of dimensions. More...
 
void set_next_dimension (const vil_nitf2_index_vector &indexes, int bound)
 Given a partial index vector, set the value of the next dimension. More...
 
int next_dimension (const vil_nitf2_index_vector &indexes) const
 Given a partial index vector, return value of next dimension (or zero if none). More...
 
bool check_index (const vil_nitf2_index_vector &indexes) const
 Compares index vector against value dimensions. More...
 
virtual bool read_vector_element (vil_nitf2_istream &input, const vil_nitf2_index_vector &indexes, int variable_width)=0
 Reads from input stream the scalar value at specified index. More...
 
virtual bool write_vector_element (vil_nitf2_ostream &output, const vil_nitf2_index_vector &indexes, int variable_width) const =0
 Writes to output stream the scalar value at specified index. More...
 
field_treeget_tree () const override
 
virtual bool value (const vil_nitf2_index_vector &, int &) const
 Sets out_value to the value of the element selected by specified index vector, which must satisfy check_index(). More...
 
virtual bool value (const vil_nitf2_index_vector &, double &) const
 
virtual bool value (const vil_nitf2_index_vector &, char &) const
 
virtual bool value (const vil_nitf2_index_vector &, void *&) const
 
virtual bool value (const vil_nitf2_index_vector &, std::string &) const
 
virtual bool value (const vil_nitf2_index_vector &, vil_nitf2_location *&) const
 
virtual bool value (const vil_nitf2_index_vector &, vil_nitf2_date_time &) const
 
virtual bool value (const vil_nitf2_index_vector &, vil_nitf2_tagged_record_sequence &) const
 
std::string tag () const
 
std::string pretty_name () const
 
std::string description () const
 
vil_nitf2_scalar_fieldscalar_field ()
 
vil_nitf2_array_fieldarray_field ()
 
virtual std::ostream & output (std::ostream &os) const =0
 
vil_nitf2::enum_field_type type () const
 

Protected Member Functions

void do_dimension (const vil_nitf2_index_vector &index, vil_nitf2_field::field_tree *tr) const
 
std::string get_value_string (const vil_nitf2_index_vector &in_indices) const
 

Protected Attributes

int m_num_dimensions
 Dimensionality of vector field. More...
 
std::map< vil_nitf2_index_vector, int > m_dimensions_map
 Because a repeating field's dimension can depend on the value of another repeating field, slices of a multi-dimensional vector field can have varying dimensions (for an example test case, see method vil_nitf2_tagged_record::test()). More...
 
vil_nitf2_field_definitionm_definition
 

Detailed Description

Abstract class for array fields, i.e., fields that occur within a repeat loop.

Since repeat loops can be nested, this field can be multi-dimensional. Its row dimensions don't even need to be same. One instance of this class "collects" all the values associated with a tag, even though they may be interleaved among other values in the NITF file. This class provides dimensional information and implements methods common to the type-specific subclasses.

Definition at line 32 of file vil_nitf2_array_field.h.

Constructor & Destructor Documentation

◆ vil_nitf2_array_field()

vil_nitf2_array_field::vil_nitf2_array_field ( vil_nitf2_field_definition definition,
int  num_dimensions 
)
inline

Definition at line 36 of file vil_nitf2_array_field.h.

◆ ~vil_nitf2_array_field()

vil_nitf2_array_field::~vil_nitf2_array_field ( )
overridedefault

Member Function Documentation

◆ array_field()

vil_nitf2_array_field * vil_nitf2_field::array_field ( )
inherited

Definition at line 61 of file vil_nitf2_field.cxx.

◆ check_index()

bool vil_nitf2_array_field::check_index ( const vil_nitf2_index_vector indexes) const

Compares index vector against value dimensions.

Definition at line 49 of file vil_nitf2_array_field.cxx.

◆ description()

std::string vil_nitf2_field::description ( ) const
inherited

Definition at line 31 of file vil_nitf2_field.cxx.

◆ do_dimension()

void vil_nitf2_array_field::do_dimension ( const vil_nitf2_index_vector index,
vil_nitf2_field::field_tree tr 
) const
protected

Definition at line 102 of file vil_nitf2_array_field.cxx.

◆ get_tree()

vil_nitf2_field::field_tree * vil_nitf2_array_field::get_tree ( ) const
overridevirtual

Reimplemented from vil_nitf2_field.

Definition at line 129 of file vil_nitf2_array_field.cxx.

◆ get_value_string()

std::string vil_nitf2_array_field::get_value_string ( const vil_nitf2_index_vector in_indices) const
protected

Definition at line 89 of file vil_nitf2_array_field.cxx.

◆ next_dimension()

int vil_nitf2_array_field::next_dimension ( const vil_nitf2_index_vector indexes) const

Given a partial index vector, return value of next dimension (or zero if none).

Length of indexes must be less than num_dimensions(). See comment for member m_dimensions_map, below; indexes is its key. For example, if indexes is empty, the first dimension is retrieved.

Definition at line 23 of file vil_nitf2_array_field.cxx.

◆ num_dimensions()

int vil_nitf2_array_field::num_dimensions ( ) const
overridevirtual

Number of dimensions.

Returns
this vector's number of dimensions, which equals its "repeat" nesting level.

Implements vil_nitf2_field.

Definition at line 17 of file vil_nitf2_array_field.cxx.

◆ output()

virtual std::ostream& vil_nitf2_field::output ( std::ostream &  os) const
pure virtualinherited

◆ pretty_name()

std::string vil_nitf2_field::pretty_name ( ) const
inherited

Definition at line 26 of file vil_nitf2_field.cxx.

◆ read_vector_element()

virtual bool vil_nitf2_array_field::read_vector_element ( vil_nitf2_istream input,
const vil_nitf2_index_vector indexes,
int  variable_width 
)
pure virtual

Reads from input stream the scalar value at specified index.

check_index(indexes) must be true, or this will emit an error.

Returns
success.

Implemented in vil_nitf2_typed_array_field< T >.

◆ scalar_field()

vil_nitf2_scalar_field * vil_nitf2_field::scalar_field ( )
inherited

Definition at line 52 of file vil_nitf2_field.cxx.

◆ set_next_dimension()

void vil_nitf2_array_field::set_next_dimension ( const vil_nitf2_index_vector indexes,
int  bound 
)

Given a partial index vector, set the value of the next dimension.

Length of indexes must be less than num_dimensions(). See comment for member m_dimensions_map, below; indexes is its key. For example, if indexes is empty, the first dimension is set.

Definition at line 34 of file vil_nitf2_array_field.cxx.

◆ tag()

std::string vil_nitf2_field::tag ( ) const
inherited

Definition at line 21 of file vil_nitf2_field.cxx.

◆ type()

vil_nitf2::enum_field_type vil_nitf2_field::type ( ) const
inherited

Definition at line 11 of file vil_nitf2_field.cxx.

◆ value() [1/8]

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
int &   
) const
inlinevirtual

Sets out_value to the value of the element selected by specified index vector, which must satisfy check_index().

Returns true iff the value is defined. Note that this may return false because the value is unspecified (i.e., blank), even if the index is valid.

Subclasses overload the appropriate method to set out parameter and return true. The implementation here return false. These methods are defined here for the convenience of my callers, so they don't have to downcast to the specific field type.

Definition at line 92 of file vil_nitf2_array_field.h.

◆ value() [2/8]

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
double &   
) const
inlinevirtual

Definition at line 93 of file vil_nitf2_array_field.h.

◆ value() [3/8]

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
char &   
) const
inlinevirtual

Definition at line 94 of file vil_nitf2_array_field.h.

◆ value() [4/8]

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
void *&   
) const
inlinevirtual

Definition at line 95 of file vil_nitf2_array_field.h.

◆ value() [5/8]

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
std::string &   
) const
inlinevirtual

Definition at line 96 of file vil_nitf2_array_field.h.

◆ value() [6/8]

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
vil_nitf2_location *&   
) const
inlinevirtual

Definition at line 97 of file vil_nitf2_array_field.h.

◆ value() [7/8]

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
vil_nitf2_date_time  
) const
inlinevirtual

Definition at line 98 of file vil_nitf2_array_field.h.

◆ value() [8/8]

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
vil_nitf2_tagged_record_sequence  
) const
inlinevirtual

Definition at line 99 of file vil_nitf2_array_field.h.

◆ write_vector_element()

virtual bool vil_nitf2_array_field::write_vector_element ( vil_nitf2_ostream output,
const vil_nitf2_index_vector indexes,
int  variable_width 
) const
pure virtual

Writes to output stream the scalar value at specified index.

check_index(indexes) must be true, of this will emit an error. Returns success. Arg variable_width, if non-negative, overrides formatter's field_width.

Implemented in vil_nitf2_typed_array_field< T >.

Member Data Documentation

◆ m_definition

vil_nitf2_field_definition* vil_nitf2_field::m_definition
protectedinherited

Definition at line 80 of file vil_nitf2_field.h.

◆ m_dimensions_map

std::map<vil_nitf2_index_vector, int> vil_nitf2_array_field::m_dimensions_map
protected

Because a repeating field's dimension can depend on the value of another repeating field, slices of a multi-dimensional vector field can have varying dimensions (for an example test case, see method vil_nitf2_tagged_record::test()).

Dimensions are therefore stored here as follows:

  • m_dimensions_map[vector()] holds the first dimension;
  • m_dimensions_map[vector(i)] holds the second dimension of row i of a 2-or-more-dimensional vector;
  • m_dimensions_map[vector(i,j)] holds the third dimension of plane (i,j) of a 3-or-more-dimensional vector; and so on, according dimensionality of the field.

Definition at line 122 of file vil_nitf2_array_field.h.

◆ m_num_dimensions

int vil_nitf2_array_field::m_num_dimensions
protected

Dimensionality of vector field.

Definition at line 108 of file vil_nitf2_array_field.h.


The documentation for this class was generated from the following files: