Public Member Functions | Protected Member Functions | Protected Attributes
vil_nitf2_array_field Class Reference

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]

List of all members.

Public Member Functions

 vil_nitf2_array_field (vil_nitf2_field_definition *definition, int num_dimensions)
virtual ~vil_nitf2_array_field ()
int num_dimensions () const
 Number of dimensions.
void set_next_dimension (const vil_nitf2_index_vector &indexes, int bound)
 Given a partial index vector, set the value of the next dimension.
int next_dimension (const vil_nitf2_index_vector &indexes) const
 Given a partial index vector, return value of next dimension (or zero if none).
bool check_index (const vil_nitf2_index_vector &indexes) const
 Compares index vector against value dimensions.
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.
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.
virtual field_treeget_tree () const
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().
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 &, vcl_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
vcl_string tag () const
vcl_string pretty_name () const
vcl_string description () const
vil_nitf2_scalar_fieldscalar_field ()
vil_nitf2_array_fieldarray_field ()
virtual vcl_ostream & output (vcl_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
vcl_string get_value_string (const vil_nitf2_index_vector &in_indices) const

Protected Attributes

int m_num_dimensions
 Dimensionality of vector field.
vcl_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()).
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 27 of file vil_nitf2_array_field.h.


Constructor & Destructor Documentation

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

Definition at line 31 of file vil_nitf2_array_field.h.

virtual vil_nitf2_array_field::~vil_nitf2_array_field ( ) [inline, virtual]

Definition at line 35 of file vil_nitf2_array_field.h.


Member Function Documentation

vil_nitf2_array_field * vil_nitf2_field::array_field ( ) [inherited]

Definition at line 61 of file vil_nitf2_field.cxx.

bool vil_nitf2_array_field::check_index ( const vil_nitf2_index_vector indexes) const

Compares index vector against value dimensions.

Definition at line 46 of file vil_nitf2_array_field.cxx.

vcl_string vil_nitf2_field::description ( ) const [inherited]

Definition at line 31 of file vil_nitf2_field.cxx.

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

Definition at line 99 of file vil_nitf2_array_field.cxx.

vil_nitf2_field::field_tree * vil_nitf2_array_field::get_tree ( ) const [virtual]

Reimplemented from vil_nitf2_field.

Definition at line 126 of file vil_nitf2_array_field.cxx.

vcl_string vil_nitf2_array_field::get_value_string ( const vil_nitf2_index_vector in_indices) const [protected]

Definition at line 86 of file vil_nitf2_array_field.cxx.

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 20 of file vil_nitf2_array_field.cxx.

int vil_nitf2_array_field::num_dimensions ( ) const [virtual]

Number of dimensions.

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

Implements vil_nitf2_field.

Definition at line 14 of file vil_nitf2_array_field.cxx.

virtual vcl_ostream& vil_nitf2_field::output ( vcl_ostream &  os) const [pure virtual, inherited]
vcl_string vil_nitf2_field::pretty_name ( ) const [inherited]

Definition at line 26 of file vil_nitf2_field.cxx.

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 >.

vil_nitf2_scalar_field * vil_nitf2_field::scalar_field ( ) [inherited]

Definition at line 52 of file vil_nitf2_field.cxx.

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 31 of file vil_nitf2_array_field.cxx.

vcl_string vil_nitf2_field::tag ( ) const [inherited]

Definition at line 21 of file vil_nitf2_field.cxx.

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

Definition at line 11 of file vil_nitf2_field.cxx.

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
int &   
) const [inline, virtual]

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 87 of file vil_nitf2_array_field.h.

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
double &   
) const [inline, virtual]

Definition at line 88 of file vil_nitf2_array_field.h.

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
char &   
) const [inline, virtual]

Definition at line 89 of file vil_nitf2_array_field.h.

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
void *&   
) const [inline, virtual]

Definition at line 90 of file vil_nitf2_array_field.h.

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
vcl_string &   
) const [inline, virtual]

Definition at line 91 of file vil_nitf2_array_field.h.

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
vil_nitf2_location *&   
) const [inline, virtual]

Definition at line 92 of file vil_nitf2_array_field.h.

virtual bool vil_nitf2_array_field::value ( const vil_nitf2_index_vector ,
vil_nitf2_date_time  
) const [inline, virtual]

Definition at line 93 of file vil_nitf2_array_field.h.

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

Definition at line 77 of file vil_nitf2_field.h.

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 116 of file vil_nitf2_array_field.h.

Dimensionality of vector field.

Definition at line 102 of file vil_nitf2_array_field.h.


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