core
vil
file_formats
vil_nitf2_header.h
Go to the documentation of this file.
1
// vil_nitf2: Written by Rob Radtke (rob@) and Harry Voorhees (hlv@) of
2
// Stellar Science Ltd. Co. (stellarscience.com) for
3
// Air Force Research Laboratory, 2005.
4
5
#ifndef VIL_NITF2_HEADER_H
6
#define VIL_NITF2_HEADER_H
7
8
#include "
vil_nitf2_tagged_record.h
"
9
#include "
vil_nitf2_classification.h
"
10
#include "
vil_nitf2.h
"
11
12
class
vil_stream
;
13
14
15
/// Parses a NITF 2.1 file header for vil_nitf2_image.
16
/// Use get_property() to get a field value.
17
//
18
class
vil_nitf2_header
19
{
20
public
:
21
vil_nitf2_header
();
22
23
virtual
~vil_nitf2_header
();
24
25
enum
portion_type
{
26
enum_subheader
,
27
enum_data
28
};
29
enum
section_type
{
30
enum_file_header
= 0,
31
enum_image_segments
,
32
enum_graphic_segments
,
33
enum_label_segments
,
34
enum_text_segments
,
35
enum_data_extension_segments
,
36
enum_reserved_extension_segments
37
};
38
static
std::string
section_num_tag
(
section_type
sec);
39
static
std::string
section_len_header_tag
(
section_type
sec);
40
static
std::string
section_len_data_tag
(
section_type
sec);
41
42
// Read the image header starting at stream's current position. Return success.
43
virtual
bool
read
(
vil_stream
* stream );
44
//virtual bool write( vil_stream* stream );
45
46
// Sets out_value to the value of field specified by tag.
47
// Returns 0 if such a field is not found or is of the wrong type.
48
template
<
class
T >
49
bool
get_property
(std::string tag, T& out_value)
const
50
{
51
if
(
m_field_sequence_classification
&&
m_field_sequence_classification
->
get_value
(tag, out_value) )
return
true
;
52
else
if
(
m_field_sequence2
&&
m_field_sequence2
->
get_value
(tag, out_value) )
return
true
;
53
else
return
m_field_sequence1
.
get_value
(tag, out_value);
54
}
55
56
// Sets out_value to the value of std::vector field element specified by tag and index.
57
// Returns 0 if such a field is not found or is of the wrong type.
58
template
<
class
T >
59
bool
get_property
(std::string tag,
int
i, T& out_value)
const
60
{
61
if
(
m_field_sequence_classification
&&
m_field_sequence_classification
->
get_value
(tag, i, out_value) )
return
true
;
62
else
if
(
m_field_sequence2
&&
m_field_sequence2
->
get_value
(tag, i, out_value) )
return
true
;
63
else
return
m_field_sequence1
.
get_value
(tag, i, out_value);
64
}
65
66
vil_nitf2_classification::file_version
file_version
()
const
;
67
68
// I allocate the return value, but you own it after I return it to you
69
// so you need to delete it.
70
virtual
vil_nitf2_field::field_tree
*
get_tree
()
const
;
71
72
protected
:
73
// Field sequences for different parts of this header.
74
vil_nitf2_field_sequence
m_field_sequence1
;
75
vil_nitf2_field_sequence
*
m_field_sequence2
;
76
vil_nitf2_field_sequence
*
m_field_sequence_classification
;
77
78
// Returns field definitions, which I own, for different parts of the header.
79
static
vil_nitf2_field_definitions
*
get_field_definitions_1
();
80
static
vil_nitf2_field_definitions
*
get_field_definitions_2
(
vil_nitf2_classification::file_version
version );
81
82
private
:
83
static
vil_nitf2_field_definitions
*
s_field_definitions_1
;
84
static
vil_nitf2_field_definitions
*
s_field_definitions_21
;
85
static
vil_nitf2_field_definitions
*
s_field_definitions_20
;
86
87
// so these static members can be cleaned up when the program is done
88
// using nitf files
89
friend
void
vil_nitf2::cleanup_static_members
();
90
};
91
92
#endif // VIL_NITF2_HEADER_H
vil_nitf2_header::enum_file_header
Definition:
vil_nitf2_header.h:30
vil_nitf2_header::vil_nitf2_header
vil_nitf2_header()
Definition:
vil_nitf2_header.cxx:20
vil_nitf2_field_sequence
Definition:
vil_nitf2_field_sequence.h:30
vil_nitf2_header::enum_text_segments
Definition:
vil_nitf2_header.h:34
vil_nitf2_header::s_field_definitions_21
static vil_nitf2_field_definitions * s_field_definitions_21
Definition:
vil_nitf2_header.h:84
vil_nitf2_header::get_field_definitions_2
static vil_nitf2_field_definitions * get_field_definitions_2(vil_nitf2_classification::file_version version)
Definition:
vil_nitf2_header.cxx:99
vil_nitf2_header::enum_image_segments
Definition:
vil_nitf2_header.h:31
vil_nitf2_header::s_field_definitions_1
static vil_nitf2_field_definitions * s_field_definitions_1
Definition:
vil_nitf2_header.h:83
vil_nitf2_classification.h
vil_nitf2_header::enum_subheader
Definition:
vil_nitf2_header.h:26
vil_nitf2_header::file_version
vil_nitf2_classification::file_version file_version() const
Definition:
vil_nitf2_header.cxx:219
vil_nitf2_tagged_record.h
vil_nitf2_header::section_len_data_tag
static std::string section_len_data_tag(section_type sec)
Definition:
vil_nitf2_header.cxx:60
vil_nitf2_header::get_tree
virtual vil_nitf2_field::field_tree * get_tree() const
Definition:
vil_nitf2_header.cxx:232
vil_nitf2_header::enum_data_extension_segments
Definition:
vil_nitf2_header.h:35
vil_nitf2.h
vil_stream
Stream interface for VIL image loaders.
Definition:
vil_stream.h:21
vil_nitf2_header::read
virtual bool read(vil_stream *stream)
Definition:
vil_nitf2_header.cxx:74
vil_nitf2_header::m_field_sequence_classification
vil_nitf2_field_sequence * m_field_sequence_classification
Definition:
vil_nitf2_header.h:76
vil_nitf2_header::enum_label_segments
Definition:
vil_nitf2_header.h:33
vil_nitf2_header::~vil_nitf2_header
virtual ~vil_nitf2_header()
Definition:
vil_nitf2_header.cxx:26
vil_nitf2_header::get_property
bool get_property(std::string tag, int i, T &out_value) const
Definition:
vil_nitf2_header.h:59
vil_nitf2_header::m_field_sequence2
vil_nitf2_field_sequence * m_field_sequence2
Definition:
vil_nitf2_header.h:75
vil_nitf2_classification::file_version
file_version
Definition:
vil_nitf2_classification.h:34
vil_nitf2_header::enum_reserved_extension_segments
Definition:
vil_nitf2_header.h:36
vil_nitf2_header
Parses a NITF 2.1 file header for vil_nitf2_image.
Definition:
vil_nitf2_header.h:18
vil_nitf2_header::section_len_header_tag
static std::string section_len_header_tag(section_type sec)
Definition:
vil_nitf2_header.cxx:46
vil_nitf2_field_definitions
Definition:
vil_nitf2_field_definition.h:122
vil_nitf2_header::s_field_definitions_20
static vil_nitf2_field_definitions * s_field_definitions_20
Definition:
vil_nitf2_header.h:85
vil_nitf2_field_sequence::get_value
bool get_value(std::string tag, int &out_value) const
vil_nitf2_header::section_num_tag
static std::string section_num_tag(section_type sec)
Definition:
vil_nitf2_header.cxx:32
vil_nitf2::cleanup_static_members
static void cleanup_static_members()
Call this function to flush all of the nitf2 classes statically allocated memory.
Definition:
vil_nitf2.cxx:14
vil_nitf2_header::get_property
bool get_property(std::string tag, T &out_value) const
Definition:
vil_nitf2_header.h:49
vil_nitf2_header::m_field_sequence1
vil_nitf2_field_sequence m_field_sequence1
Definition:
vil_nitf2_header.h:74
vil_nitf2_field::field_tree
Definition:
vil_nitf2_field.h:65
vil_nitf2_header::enum_data
Definition:
vil_nitf2_header.h:27
vil_nitf2_header::enum_graphic_segments
Definition:
vil_nitf2_header.h:32
vil_nitf2_header::section_type
section_type
Definition:
vil_nitf2_header.h:29
vil_nitf2_header::portion_type
portion_type
Definition:
vil_nitf2_header.h:25
vil_nitf2_header::get_field_definitions_1
static vil_nitf2_field_definitions * get_field_definitions_1()
Definition:
vil_nitf2_header.cxx:192
Generated by
1.8.15