Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
vil_nitf2_typed_array_field< T > Class Template Reference

Typed concrete class for array fields. More...

#include <vil_nitf2_typed_array_field.h>

Inheritance diagram for vil_nitf2_typed_array_field< T >:
Inheritance graph
[legend]

Public Member Functions

 vil_nitf2_typed_array_field (int num_dimensions, vil_nitf2_field_definition *field_definition)
 
bool value (const vil_nitf2_index_vector &indexes, T &out_value) const override
 Set out_value to the scalar value at the specified index vector, and returns whether specified element was defined. More...
 
bool read_vector_element (vil_nitf2_istream &input, const vil_nitf2_index_vector &indexes, int variable_width) override
 Reads from input stream the scalar value at specified index. More...
 
bool write_vector_element (vil_nitf2_ostream &output, const vil_nitf2_index_vector &indexes, int variable_width) const override
 Writes to output stream the scalar value at specified index. More...
 
std::ostream & output (std::ostream &os) const override
 Output in human-readable form. More...
 
 ~vil_nitf2_typed_array_field () override
 Destructor (overridden below for instantiations where T is a pointer). More...
 
template<>
 ~vil_nitf2_typed_array_field ()
 
template<>
 ~vil_nitf2_typed_array_field ()
 
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...
 
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 ()
 
vil_nitf2::enum_field_type type () const
 

Protected Member Functions

void output_dimension_iterate (std::ostream &os, vil_nitf2_index_vector indexes, bool &output_yet) const
 
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
 

Private Attributes

std::map< vil_nitf2_index_vector, T > m_value_map
 

Detailed Description

template<class T>
class vil_nitf2_typed_array_field< T >

Typed concrete class for array fields.

Stores values and implements I/O of values.

Definition at line 25 of file vil_nitf2_typed_array_field.h.

Constructor & Destructor Documentation

◆ vil_nitf2_typed_array_field()

template<class T>
vil_nitf2_typed_array_field< T >::vil_nitf2_typed_array_field ( int  num_dimensions,
vil_nitf2_field_definition field_definition 
)
inline

Definition at line 29 of file vil_nitf2_typed_array_field.h.

◆ ~vil_nitf2_typed_array_field() [1/3]

template<typename T >
vil_nitf2_typed_array_field< T >::~vil_nitf2_typed_array_field ( )
inlineoverride

Destructor (overridden below for instantiations where T is a pointer).

Definition at line 241 of file vil_nitf2_typed_array_field.h.

◆ ~vil_nitf2_typed_array_field() [2/3]

template<>
vil_nitf2_typed_array_field< void * >::~vil_nitf2_typed_array_field ( )
inline

Definition at line 220 of file vil_nitf2_typed_array_field.h.

◆ ~vil_nitf2_typed_array_field() [3/3]

Definition at line 231 of file vil_nitf2_typed_array_field.h.

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
inherited

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
protectedinherited

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
overridevirtualinherited

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
protectedinherited

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
inherited

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
overridevirtualinherited

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()

template<class T >
std::ostream & vil_nitf2_typed_array_field< T >::output ( std::ostream &  os) const
overridevirtual

Output in human-readable form.

Implementation provides an example of how to iterate over all elements.

Implements vil_nitf2_field.

Definition at line 175 of file vil_nitf2_typed_array_field.h.

◆ output_dimension_iterate()

template<class T >
void vil_nitf2_typed_array_field< T >::output_dimension_iterate ( std::ostream &  os,
vil_nitf2_index_vector  indexes,
bool &  output_yet 
) const
protected

Definition at line 183 of file vil_nitf2_typed_array_field.h.

◆ pretty_name()

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

Definition at line 26 of file vil_nitf2_field.cxx.

◆ read_vector_element()

template<class T >
bool vil_nitf2_typed_array_field< T >::read_vector_element ( vil_nitf2_istream input,
const vil_nitf2_index_vector indexes,
int  variable_width 
)
overridevirtual

Reads from input stream the scalar value at specified index.

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

Implements vil_nitf2_array_field.

Definition at line 109 of file vil_nitf2_typed_array_field.h.

◆ 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 
)
inherited

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/9]

template<class T >
bool vil_nitf2_typed_array_field< T >::value ( const vil_nitf2_index_vector indexes,
T &  out_value 
) const
override

Set out_value to the scalar value at the specified index vector, and returns whether specified element was defined.

The length of the index vector must equal num_dimensions(), and check_index(indexes) must return true to indicate that the indexes are within bounds. Even so, this method may return false if the value is undefined at the specified index. (This is a partial override of overloaded method vil_nitf2_array_field::value() for my specific type.)

Definition at line 92 of file vil_nitf2_typed_array_field.h.

◆ value() [2/9]

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

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() [3/9]

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

Definition at line 93 of file vil_nitf2_array_field.h.

◆ value() [4/9]

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

Definition at line 94 of file vil_nitf2_array_field.h.

◆ value() [5/9]

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

Definition at line 95 of file vil_nitf2_array_field.h.

◆ value() [6/9]

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

Definition at line 96 of file vil_nitf2_array_field.h.

◆ value() [7/9]

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

Definition at line 97 of file vil_nitf2_array_field.h.

◆ value() [8/9]

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

Definition at line 98 of file vil_nitf2_array_field.h.

◆ value() [9/9]

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

Definition at line 99 of file vil_nitf2_array_field.h.

◆ write_vector_element()

template<class T >
bool vil_nitf2_typed_array_field< T >::write_vector_element ( vil_nitf2_ostream output,
const vil_nitf2_index_vector indexes,
int  variable_width 
) const
overridevirtual

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.

Implements vil_nitf2_array_field.

Definition at line 148 of file vil_nitf2_typed_array_field.h.

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
protectedinherited

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
protectedinherited

Dimensionality of vector field.

Definition at line 108 of file vil_nitf2_array_field.h.

◆ m_value_map

template<class T>
std::map<vil_nitf2_index_vector, T> vil_nitf2_typed_array_field< T >::m_value_map
private

Definition at line 79 of file vil_nitf2_typed_array_field.h.


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