Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
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]

List of all members.

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

Protected Member Functions

void output_dimension_iterate (vcl_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
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

Private Attributes

vcl_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 22 of file vil_nitf2_typed_array_field.h.


Constructor & Destructor Documentation

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 26 of file vil_nitf2_typed_array_field.h.

template<class T>
vil_nitf2_typed_array_field< T >::~vil_nitf2_typed_array_field ( ) [inline]

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

Definition at line 60 of file vil_nitf2_typed_array_field.h.

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

Definition at line 217 of file vil_nitf2_typed_array_field.h.

Definition at line 229 of file vil_nitf2_typed_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 [inherited]

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, inherited]

Definition at line 99 of file vil_nitf2_array_field.cxx.

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

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, inherited]

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

int vil_nitf2_array_field::num_dimensions ( ) const [virtual, inherited]

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.

template<class T >
vcl_ostream & vil_nitf2_typed_array_field< T >::output ( vcl_ostream &  os) const [virtual]

Output in human-readable form.

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

Implements vil_nitf2_field.

Definition at line 172 of file vil_nitf2_typed_array_field.h.

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

Definition at line 180 of file vil_nitf2_typed_array_field.h.

vcl_string vil_nitf2_field::pretty_name ( ) const [inherited]

Definition at line 26 of file vil_nitf2_field.cxx.

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

Implements vil_nitf2_array_field.

Definition at line 106 of file vil_nitf2_typed_array_field.h.

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

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

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 89 of file vil_nitf2_typed_array_field.h.

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

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, inherited]

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, inherited]

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, inherited]

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, inherited]

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, inherited]

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, inherited]

Definition at line 93 of file vil_nitf2_array_field.h.

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

Implements vil_nitf2_array_field.

Definition at line 145 of file vil_nitf2_typed_array_field.h.


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.

int vil_nitf2_array_field::m_num_dimensions [protected, inherited]

Dimensionality of vector field.

Definition at line 102 of file vil_nitf2_array_field.h.

template<class T>
vcl_map<vil_nitf2_index_vector, T> vil_nitf2_typed_array_field< T >::m_value_map [private]

Definition at line 76 of file vil_nitf2_typed_array_field.h.


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