Nitf::TreParser Class Reference

A plug-in interface used to read and write TREs while importing or exporting a NITF file. More...

#include <NitfTreParser.h>

Inheritance diagram for Nitf::TreParser:

Inheritance graph

List of all members.

Public Member Functions

virtual TreState isTreValid (const DynamicObject &tre, std::ostream &reporter) const =0
virtual bool ossimTagToDynamicObject (const ossimNitfRegisteredTag &input, DynamicObject &output, std::string &errorMessage) const =0
virtual bool toDynamicObject (std::istream &input, size_t numBytes, DynamicObject &output, std::string &errorMessage) const =0
virtual bool ossimTagFromDynamicObject (const DynamicObject &input, ossimNitfRegisteredTag &tre, std::string &errorMessage) const =0
virtual bool fromDynamicObject (const DynamicObject &input, std::ostream &output, size_t &numBytesWritten, std::string &errorMessage) const =0
virtual bool importMetadata (const DynamicObject &tre, RasterDataDescriptor &descriptor, std::string &errorMessage) const =0
virtual TreExportStatus exportMetadata (const RasterDataDescriptor &descriptor, const RasterFileDescriptor &exportDescriptor, DynamicObject &tre, unsigned int &ownerIndex, std::string &tagType, std::string &errorMessage) const =0

Static Public Member Functions

static std::string Type ()
static std::string NormalSubtype ()
static std::string CreateOnExportSubtype ()


Detailed Description

A plug-in interface used to read and write TREs while importing or exporting a NITF file.

In order for the NITF importer and exporter to find your plug-in, you should ensure that the plug-in name is the same 6-character string as the CETAG as the TRE.

Implementers of this interface can use an existing OSSIM TRE plug-in by implementing ossimTagToDynamicObject(ossimNitfRegisteredTag&, DynamicObject&) const and ossimTagFromDynamicObject(const DynamicObject&, ossimNitfRegisteredTag&) const. The ossimNitfRegisteredTag object will be that registered with OSSIM.

Implementers can also simply perform stream operations for TRE import and export. In that case, implement toDynamicObject(std::istream&, size_t, DynamicObject&) const and fromDynamicObject(const DynamicObject&, std::ostream&, size_t&) const.

Warning:
The toDynamicObject and fromDynamicObject methods may be called multiple times during the life of the object.

Definition at line 80 of file NitfTreParser.h.


Member Function Documentation

static std::string Nitf::TreParser::Type (  )  [static]

The type that should be returned from PlugIn::getType() for TRE parser plug-ins.

Returns:
Returns the type used for TRE parser plug-ins.

Definition at line 89 of file NitfTreParser.h.

static std::string Nitf::TreParser::NormalSubtype (  )  [static]

The type that should be returned from PlugIn::getSubtype() for TRE parser plug-ins which do not implement TreParser::exportMetadata().

Returns:
Returns the subtype used for TRE parser plug-ins which do not implement TreParser::exportMetadata().
See also:
TreParser::exportMetadata()

Definition at line 103 of file NitfTreParser.h.

static std::string Nitf::TreParser::CreateOnExportSubtype (  )  [static]

The type that should be returned from PlugIn::getSubtype() for TRE parser plug-ins which do implement TreParser::exportMetadata().

Returns:
Returns the subtype used for TRE parser plug-ins which do implement TreParser::exportMetadata().
See also:
TreParser::exportMetadata()

Definition at line 117 of file NitfTreParser.h.

virtual TreState Nitf::TreParser::isTreValid ( const DynamicObject tre,
std::ostream &  reporter 
) const [pure virtual]

Examine the TRE to determine if it is valid.

Parameters:
tre The TRE to examine.
reporter Write to this ostream with information regarding a TreState::SUSPECT or TreState::INVALID TRE.
Returns:
The TreState for the given TRE.

Implemented in Nitf::TreParserShell.

virtual bool Nitf::TreParser::ossimTagToDynamicObject ( const ossimNitfRegisteredTag &  input,
DynamicObject output,
std::string &  errorMessage 
) const [pure virtual]

Load the TRE directly from an ossimNitfRegisteredTag.

Implementers should implement either this function or toDynamicObject(std::istream&, size_t, DynamicObject&) const to load the TRE.

Parameters:
input The ossimNitfRegisteredTag to read from.
output The DynamicObject to write to.
errorMessage If this is modified by the function, it will be displayed to the user as a warning that imported TREs might be incomplete, missing, etc.
Warning:
This method may be called multiple times during the life of the object.
Returns:
True if the operation succeeded, false otherwise.

Implemented in Nitf::TreParserShell.

virtual bool Nitf::TreParser::toDynamicObject ( std::istream &  input,
size_t  numBytes,
DynamicObject output,
std::string &  errorMessage 
) const [pure virtual]

Load the TRE from an istream.

Implementers should implement either this function or ossimTagToDynamicObject(ossimNitfRegisteredTag&, DynamicObject&) const to load the TRE. This function will only be called if the other returned false.

Parameters:
input The istream to read from. The data within does not include the CETAG or CEL fields.
numBytes The number of bytes to read.
output The DynamicObject to write to.
errorMessage If this is modified by the function, it will be displayed to the user as a warning that imported TREs might be incomplete, missing, etc.
Warning:
This method may be called multiple times during the life of the object.
Returns:
True if the operation succeeded, false otherwise.

Implemented in Nitf::TreParserShell.

virtual bool Nitf::TreParser::ossimTagFromDynamicObject ( const DynamicObject input,
ossimNitfRegisteredTag &  tre,
std::string &  errorMessage 
) const [pure virtual]

Write the TRE directly to an ossimNitfRegisteredTag.

Implementers should implement either this function or fromDynamicObject(const DynamicObject&, std::ostream&, size_t&) const to write the TRE.

Parameters:
input The DynamicObject to read from.
tre The ossimNitfRegisteredTag to write to.
errorMessage If this is modified by the function, it will be displayed to the user as a warning that exported TREs might be incomplete, missing, etc.
Warning:
This method may be called multiple times during the life of the object.
Returns:
True if the operation succeeded, false otherwise.

Implemented in Nitf::TreParserShell.

virtual bool Nitf::TreParser::fromDynamicObject ( const DynamicObject input,
std::ostream &  output,
size_t &  numBytesWritten,
std::string &  errorMessage 
) const [pure virtual]

Write the TRE from a DynamicObject into an ostream.

Implementers should implement either this function or ossimTagFromDynamicObject(const DynamicObject&, ossimNitfRegisteredTag&) const to write the TRE. This function will only be called if the other returned false.

Parameters:
input The DynamicObject to read from.
output The ostream to write to. Do not write the CETAG or CEL.
numBytesWritten The number of bytes written.
errorMessage If this is modified by the function, it will be displayed to the user as a warning that exported TREs might be incomplete, missing, etc.
Warning:
This method may be called multiple times during the life of the object.
Returns:
True if the operation succeeded, false otherwise.

Implemented in Nitf::TreParserShell.

virtual bool Nitf::TreParser::importMetadata ( const DynamicObject tre,
RasterDataDescriptor descriptor,
std::string &  errorMessage 
) const [pure virtual]

Import contents of the TRE to specific fields within the descriptor.

For example, a TRE might contain wavelength data which would be appropriately represented in the Special Metadata.

Parameters:
tre The parsed TRE to place copies of data within the descriptor.
descriptor The descriptor to place copies of data within.
errorMessage If this is modified by the function, it will be displayed to the user as a warning that imported TREs might be incomplete, missing, etc.
Returns:
true if the operation successfully populated the descriptor, false otherwise. This method should return false if there is no need to import metadata into the descriptor.

Implemented in Nitf::TreParserShell.

virtual TreExportStatus Nitf::TreParser::exportMetadata ( const RasterDataDescriptor descriptor,
const RasterFileDescriptor exportDescriptor,
DynamicObject tre,
unsigned int &  ownerIndex,
std::string &  tagType,
std::string &  errorMessage 
) const [pure virtual]

Export contents descriptor into a tre.

For example, a TRE might contain wavelength data which would be appropriately represented in the Special Metadata.

This method can also be used to modify or create new TREs on export. This might be desired if the TRE must be modified when chipping, or to create a TRE for a dataset not initially loaded as a NITF.

Parameters:
descriptor The data descriptor to export from.
exportDescriptor The descriptor which specifies which portion is to be exported.
tre On return, this should contain the TRE to export with a future call to fromDynamicObject().
ownerIndex When returning TreExportStatus::REPLACE, specifies the index of the owner of this tag. This should be set to 0 for the file header and 1 for the image subheader. If this value is unspecified, it will default to the image subheader.
tagType When returning TreExportStatus::REPLACE, specifies the type of this tag. Valid values are "UDHD" "UDID", "XHD", and "IXSHD". If this value is unspecified, it will default to "IXSHD".
errorMessage If this is modified by the function, it will be displayed to the user as a warning that exported TREs might be incomplete, missing, etc.
Returns:
A TreExportStatus which indicates what to do with existing and created TREs that this parser handles.
See also:
CreateOnExportSubtype()

Implemented in Nitf::TreParserShell.


Software Development Kit - Opticks 4.9.0 Build 16218