Nitf Namespace Reference


Classes

class  ChipConverter
 Performs all computation combining ICHIPB and the application's chipping representations. More...
class  DesSubheader
 Represents the NITF DES subheader. More...
class  FileHeader
 Represents the NITF file header. More...
class  Header
 The Header class contains all knowledge needed to succesfully import or export a given NITF header. More...
class  ImageSubheader
 Represents the NITF image subheader. More...
class  NitfImporterShell
 Base class for NITF importers. More...
class  TrePlugInResource
 This is a Resource class for TRE parser plug-ins. More...
class  Properties
 A plug-in interface used to specify a GUI for displaying and (optionally) editing TRE and DES data. More...
class  PropertiesQWidgetWrapper
 A plug-in that both implements the Properties and Nitf::Properties interfaces and provides a QWidget. More...
class  OssimFileResource
 This is a Resource class that opens and closes NITF files with OSSIM. More...
class  OssimImageHandlerResource
 This is a Resource class that opens and closes images with OSSIM. More...
class  TreParser
 A plug-in interface used to read and write TREs while importing or exporting a NITF file. More...
class  TreParserShell
 This class is a shell for a tre parer plug-in. More...
struct  FindFirst
 Represents getting the first instance of a tag. More...

Namespaces

namespace  DesSubheaderFieldNames
namespace  FileHeaderFieldNames
namespace  ImageSubheaderFieldNames
namespace  ImageSubheaderFieldValues
namespace  TRE

Typedefs

typedef EnumWrapper< TreStateEnumTreState
typedef EnumWrapper
< TreExportStatusEnum
TreExportStatus

Enumerations

enum  TreStateEnum { VALID = 0, SUSPECT = 1, INVALID = 2, UNTESTED = 3 }
enum  TreExportStatusEnum { REMOVE, REPLACE, UNCHANGED }

Functions

bool importMetadata (const unsigned int &currentImage, const Nitf::OssimFileResource &pFile, const ossimNitfFileHeaderV2_X *pFileHeader, const ossimNitfImageHeaderV2_X *pImageSubheader, RasterDataDescriptor *pDescriptor, std::map< std::string, TrePlugInResource > &parsers, std::string &errorMessage)
bool addTagToMetadata (const unsigned int &ownerIndex, const ossimNitfTagInformation &tagInfo, RasterDataDescriptor *pDescriptor, DynamicObject *pTres, DynamicObject *pTreInfo, std::map< std::string, TrePlugInResource > &parsers, std::string &errorMessage)
bool exportMetadata (const RasterDataDescriptor *pDescriptor, const RasterFileDescriptor *pExportDescriptor, ossimNitfWriter *pNitf, Progress *pProgress)
std::string getRpcCoefficient (const std::string &prefix, const unsigned int &num)
TreState MaxState (TreState stateA, TreState stateB)
template<class Condition>
const DynamicObjectgetTagHandle (const DynamicObject &nitfMetadata, std::string treName, Condition cond=Condition())
template<typename T>
getSentinel ()
template<typename T>
TreState testTagValueRange (std::ostream &reporter, const T &testValue, const T &minValue, const T &maxValue)
template<typename T>
TreState testTagValueRange (const DynamicObject &tre, std::ostream &reporter, unsigned int *pNumFields, const std::string &name, const T &minValue, const T &maxValue, bool optional=false)
template<typename T>
TreState testTagValueEq (const DynamicObject &tre, std::ostream &reporter, const std::string &name, const T &eqValue)
template<typename T>
TreState testTagValueNotEq (const DynamicObject &tre, std::ostream &reporter, const std::string &name, const T &notEqValue)
template<typename T>
convertBinary (const void *pBuffer, EndianType sourceEndian)
bool bitTest (unsigned int bitMask, unsigned int bit)
bool DtgParseHHMM (const std::string &fDTG, unsigned short &hour, unsigned short &min)
bool DtgParseCCYYMMDDhhmm (const std::string &fDTG, unsigned short &year, unsigned short &month, unsigned short &day, unsigned short &hour, unsigned short &min)
bool DtgParseCCYYMMDDhhmm (const std::string &fDTG, DateTime *pDateTime)
bool DtgParseCCYYMMDDssss (const std::string &date, const std::string &time, DateTime *pDateTime, float &secondsInDay)
bool DtgParseCCYYMMDDhhmmss (const std::string &fDTG, unsigned short &year, unsigned short &month, unsigned short &day, unsigned short &hour, unsigned short &min, unsigned short &sec, bool *pDateValid=NULL, bool *pTimeValid=NULL)
bool DtgParseCCYYMMDDhhmmss (const std::string &fDTG, DateTime *pDateTime)
bool DtgParseCCYYMMDD (const std::string &fDTG, unsigned short &year, unsigned short &month, unsigned short &day)
bool DtgParseCCYYMMDD (const std::string &fDTG, DateTime *pDateTime)
bool DtgParseDDMMMYY (const std::string &fDTG, unsigned short &year, unsigned short &month, unsigned short &day)
bool DtgParseDDMMMYY (const std::string &fDTG, DateTime *pDateTime)
bool DtgParseCCYYMMMDDhhmmss (const std::string &fDTG, unsigned short &year, unsigned short &month, unsigned short &day, unsigned short &hour, unsigned short &min, unsigned short &sec)
bool DtgParseCCYYMMMDDhhmmss (const std::string &fDTG, DateTime *pDateTime)
bool DtgParseDDHHMMSSZMONYY (const std::string &fDTG, unsigned short &year, unsigned short &month, unsigned short &day, unsigned short &hour, unsigned short &min, unsigned short &sec)
bool DtgParseDDHHMMSSZMONYY (const std::string &fDTG, DateTime *pDateTime)
bool DtgParseYYMMDD (const std::string &fDTG, unsigned short &year, unsigned short &month, unsigned short &day)
bool DtgParseYYMMDD (const std::string &fDTG, DateTime *pDateTime)
TreState testTagValidBcsASet (const std::string &testValue, std::ostream &reporter, std::set< std::string > testSet, bool allBlankOk=false, bool notInSetOk=true, bool emitMsgNotInSet=false)
TreState testTagValidBcsASet (const DynamicObject &tre, std::ostream &reporter, unsigned int *pNumFields, const std::string &name, const std::set< std::string > &testSet, bool allBlankOk=false, bool notInSetOk=true, bool emitMsgNotInSet=false)
bool readFromStream (std::istream &strm, std::vector< char > &buf, std::streamsize count, bool bStr=true)
std::string sizeString (const std::string &str, unsigned int size, char fillChar= ' ', bool rightJustify=false)
template<typename T>
std::string toString (T num, unsigned int size, int precision=-1, char fillChar= '0', bool posSign=false, bool sciNotation=false, int expSize=3, bool optional=false, char optionalChar= ' ')
template<typename T>
fromBuffer (std::vector< char > &buf, bool &ok, bool allBlankOk, bool allDashesOk)
template<>
std::string fromBuffer< std::string > (std::vector< char > &buf, bool &ok, bool allBlankOk, bool allDashesOk)
bool readFieldErrMsg (std::string &msg, const std::string &name, const std::vector< char > &buf, int len)
bool numReadErrMsg (int64_t numRead, int64_t numBytes, std::string &errorMessage)
template<typename T>
bool readField (std::istream &input, DynamicObject &output, bool &success, const std::string &name, int len, std::string &msg, std::vector< char > &buf, bool allBlankOk=false, bool allDashesOk=false)
template<typename T>
bool readAndConvertFromStream (std::istream &input, T &output, bool &success, const std::string &name, int len, std::string &msg, std::vector< char > &buf, bool allBlankOk=false, bool allDashesOk=false)
bool isClassificationValidForExport (const Classification &classification, std::string &errorMessage)
bool isClassificationFieldValidForExport (const Classification &classification, const std::string &fieldName)
bool updateSpecialMetadata (DynamicObject *pMetadata, std::vector< double > &centerWavelengths, std::vector< double > &startWavelengths, std::vector< double > &endWavelengths, const std::vector< double > &fwhms, bool convertFromInverseCentimeters=false)

Variables

static const bool POS_SIGN_TRUE = true
static const bool POS_SIGN_FALSE = false
static const bool ALL_BLANK_TRUE = true
static const bool ALL_BLANK_FALSE = false
static const bool NOT_IN_SET_TRUE = true
static const bool NOT_IN_SET_FALSE = false
static const bool EMIT_MSG_NOT_IN_SET_TRUE = true
static const bool EMIT_MSG_NOT_IN_SET_FALSE = false
static const bool USE_SCIENTIFIC_NOTATION = true
static const char ZERO_FILL = '0'
static const int ONE_EXP_DIGIT = 1
static const std::string NITF_METADATA = "NITF"
static const std::string FILE_HEADER = "File Header"
static const std::string IMAGE_SUBHEADER = "Image Subheader"
static const std::string DES_METADATA = "DES"
static const std::string TRE_METADATA = "TRE"
static const std::string TRE_INFO_METADATA = "TRE Information"
static const std::string VERSION_02_00 = "02.00"
static const std::string VERSION_02_10 = "02.10"


Typedef Documentation

The EnumWrapper contains a given enum value and provides a isValid() method which returns true if the contained enum value is valid.

Please see How To Use EnumWrapper for more information. The wrapped enum values are Nitf::TreExportStatusEnum.

Definition at line 60 of file NitfTreParser.h.

typedef EnumWrapper<TreStateEnum> Nitf::TreState

The EnumWrapper contains a given enum value and provides a isValid() method which returns true if the contained enum value is valid.

Please see How To Use EnumWrapper for more information. The wrapped enum values are Nitf::TreStateEnum.

Definition at line 42 of file NitfTreParser.h.


Enumeration Type Documentation

The status of a TRE export.

See also:
TreParser::exportMetadata()
Enumerator:
REMOVE  Remove any existing TRE of the name without adding any generated ones.

REPLACE  Remove any existing TRE of the name while adding the one populated by TreParser::exportMetadata().

UNCHANGED  Let any TREs of the same name be exported without modifications.

Definition at line 49 of file NitfTreParser.h.

The state of a given TRE.

See also:
TreParser::isTreValid()
Enumerator:
VALID  A TRE is valid if all fields are present (and the correct type) and the values of each field are within their prescribed ranges.

SUSPECT  A TRE is suspect if all of its fields are present (and the correct type) but the values of one or more fields are outside their prescribed ranges.

INVALID  A TRE is invalid if fields are missing.

UNTESTED  A TRE has not been tested.

Definition at line 29 of file NitfTreParser.h.


Function Documentation

bool Nitf::addTagToMetadata ( const unsigned int &  ownerIndex,
const ossimNitfTagInformation &  tagInfo,
RasterDataDescriptor pDescriptor,
DynamicObject pTres,
DynamicObject pTreInfo,
std::map< std::string, TrePlugInResource > &  parsers,
std::string &  errorMessage 
)

Adds a single TRE to a RasterDataDescriptor.

Parameters:
ownerIndex The index of the owner of this TRE.
tagInfo Information about the TRE.
pDescriptor The RasterDataDescriptor to populate.
pTres The DynamicObject containing the TREs.
pTreInfo The DynamicObject containing the locations of the TREs.
parsers Contains TRE parsers which have already been loaded into memory -- included for performance.
errorMessage Message for import errors, etc.
Returns:
True on success, false otherwise.

bool Nitf::bitTest ( unsigned int  bitMask,
unsigned int  bit 
)

Test the specified bit.

Parameters:
bitMask Mask to tests
bit Bit of the mask to test
Returns:
True if the given bit is true, false otherwise.

template<typename T>
T Nitf::convertBinary ( const void *  pBuffer,
EndianType  sourceEndian 
)

Combination typecast and endian swap.

Parameters:
pBuffer Buffer containing non-swapped data
sourceEndian The endianness of the data in the buffer
Returns:
The contents of the buffer, appropriately typed and swapped.

Definition at line 296 of file NitfUtilities.h.

bool Nitf::DtgParseCCYYMMDD ( const std::string &  fDTG,
DateTime pDateTime 
)

Parse a date-time string of the form CCYYMMDD.

Parameters:
fDTG The string to parse
pDateTime Upon successful return, this contains the date and time from the string.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseCCYYMMDD ( const std::string &  fDTG,
unsigned short &  year,
unsigned short &  month,
unsigned short &  day 
)

Parse a date-time string of the form CCYYMMDD.

Parameters:
fDTG The string to parse
year Upon successful return, this contains the year (including century) from the string.
month Upon successful return, this contains the month from the string.
day Upon successful return, this contains the day from the string.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseCCYYMMDDhhmm ( const std::string &  fDTG,
DateTime pDateTime 
)

Parse a date-time string of the form CCYYMMDDhhmm.

Parameters:
fDTG The string to parse
pDateTime Upon successful return, this contains the date and time from the string.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseCCYYMMDDhhmm ( const std::string &  fDTG,
unsigned short &  year,
unsigned short &  month,
unsigned short &  day,
unsigned short &  hour,
unsigned short &  min 
)

Parse a date-time string of the form CCYYMMDDhhmm.

Parameters:
fDTG The string to parse
year Upon successful return, this contains the year (including century) from the string.
month Upon successful return, this contains the month from the string.
day Upon successful return, this contains the day from the string.
hour Upon successful return, this contains the hours from the string.
min Upon successful return, this contains the minutes from the string.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseCCYYMMDDhhmmss ( const std::string &  fDTG,
DateTime pDateTime 
)

Parse a date-time string of the form CCYYMMDDhhmmss.

Parameters:
fDTG The string to parse
pDateTime Upon successful return, this contains the date and time from the string.
Returns:
True if the parse succeeded, false otherwise. Note that even if this returns false, pDateTime may contain partially valid data.

bool Nitf::DtgParseCCYYMMDDhhmmss ( const std::string &  fDTG,
unsigned short &  year,
unsigned short &  month,
unsigned short &  day,
unsigned short &  hour,
unsigned short &  min,
unsigned short &  sec,
bool *  pDateValid = NULL,
bool *  pTimeValid = NULL 
)

Parse a date-time string of the form CCYYMMDDhhmmss.

Parameters:
fDTG The string to parse
year Upon successful return, this contains the year (including century) from the string.
month Upon successful return, this contains the month from the string.
day Upon successful return, this contains the day from the string.
hour Upon successful return, this contains the hours from the string.
min Upon successful return, this contains the minutes from the string.
sec Upon successful return, this contains the seconds from the string.
pDateValid If non-NULL, the value pointed at will contain true if the date portion of the date-time string parsed successfully.
pTimeValid If non-NULL, the value pointed at will contain true if the time portion of the date-time string parsed successfully.
Returns:
True if the parse completely succeeded, false otherwise. Note that even if this returns false, pDateValid and pTimeValid will be set appropriately.

bool Nitf::DtgParseCCYYMMDDssss ( const std::string &  date,
const std::string &  time,
DateTime pDateTime,
float &  secondsInDay 
)

Parse a date-time from two strings of the form CCYYMMDD and ssss.sss.

Parameters:
date The date string to parse
time The time string to parse, this may have a variable number of digits but must be seconds of the day
pDateTime Upon successful return, this contains the date and time from the string.
secondsInDay Return the seconds in the day as a float. pDateTime only contains 1 second resolution so this is required to obtain fractional seconds. This is the value in time as a float.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseCCYYMMMDDhhmmss ( const std::string &  fDTG,
DateTime pDateTime 
)

Parse a date-time string of the form CCYYMMDDhhmmss.

Parameters:
fDTG The string to parse
pDateTime Upon successful return, this contains the date and time from the string.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseCCYYMMMDDhhmmss ( const std::string &  fDTG,
unsigned short &  year,
unsigned short &  month,
unsigned short &  day,
unsigned short &  hour,
unsigned short &  min,
unsigned short &  sec 
)

Parse a date-time string of the form CCYYMMDDhhmmss.

Parameters:
fDTG The string to parse
year Upon successful return, this contains the year (including century) from the string.
month Upon successful return, this contains the month from the string.
day Upon successful return, this contains the day from the string.
hour Upon successful return, this contains the hours from the string.
min Upon successful return, this contains the minutes from the string.
sec Upon successful return, this contains the seconds from the string.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseDDHHMMSSZMONYY ( const std::string &  fDTG,
DateTime pDateTime 
)

Parse a date-time string of the form CCYYMMDDhhmmss, where MMM is a three-letter abbreviation for the month.

Parameters:
fDTG The string to parse
pDateTime Upon successful return, this contains the date and time from the string. The century assumes that any two-digit year less than 48 refers to 2000 + YY, and any two-digit year greater than or equal to 48 refers to 1900 + YY.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseDDHHMMSSZMONYY ( const std::string &  fDTG,
unsigned short &  year,
unsigned short &  month,
unsigned short &  day,
unsigned short &  hour,
unsigned short &  min,
unsigned short &  sec 
)

Parse a date-time string of the form DDHHMMSSZMONYY, where MMM is a three-letter abbreviation for the month.

Parameters:
fDTG The string to parse
year Upon successful return, this contains the year (including century) from the string. The century assumes that any two-digit year less than 48 refers to 2000 + YY, and any two-digit year greater than or equal to 48 refers to 1900 + YY.
month Upon successful return, this contains the month from the string.
day Upon successful return, this contains the day from the string.
hour Upon successful return, this contains the hours from the string.
min Upon successful return, this contains the minutes from the string.
sec Upon successful return, this contains the seconds from the string.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseDDMMMYY ( const std::string &  fDTG,
DateTime pDateTime 
)

Parse a date-time string of the form DDMMMYY, where MMM is a three-letter abbreviation for the month.

Parameters:
fDTG The string to parse
pDateTime Upon successful return, this contains the date and time from the string. The century assumes that any two-digit year less than 48 refers to 2000 + YY, and any two-digit year greater than or equal to 48 refers to 1900 + YY.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseDDMMMYY ( const std::string &  fDTG,
unsigned short &  year,
unsigned short &  month,
unsigned short &  day 
)

Parse a date-time string of the form DDMMMYY, where MMM is a three-letter abbreviation for the month.

Parameters:
fDTG The string to parse
year Upon successful return, this contains the year (including century) from the string. The century assumes that any two-digit year less than 48 refers to 2000 + YY, and any two-digit year greater than or equal to 48 refers to 1900 + YY.
month Upon successful return, this contains the 1-based month from the string.
day Upon successful return, this contains the day from the string.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseHHMM ( const std::string &  fDTG,
unsigned short &  hour,
unsigned short &  min 
)

Parse a date-time string of the form HHMM (hour minute).

Parameters:
fDTG The string to parse
hour Upon successful return, this contains the hours from the string.
min Upon successful return, this contains the minutes from the string.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseYYMMDD ( const std::string &  fDTG,
DateTime pDateTime 
)

Parse a date-time string of the form YYMMDD.

Parameters:
fDTG The string to parse.
pDateTime Upon successful return, this contains the date from the string. The century assumes that any two-digit year less than 48 refers to 2000 + YY, and any two-digit year greater than or equal to 48 refers to 1900 + YY.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::DtgParseYYMMDD ( const std::string &  fDTG,
unsigned short &  year,
unsigned short &  month,
unsigned short &  day 
)

Parse a date-time string of the form YYMMDD.

Parameters:
fDTG The string to parse.
year Upon successful return, this contains the year (including century) from the string. The century assumes that any two-digit year less than 48 refers to 2000 + YY, and any two-digit year greater than or equal to 48 refers to 1900 + YY.
month Upon successful return, this contains the month from the string.
day Upon successful return, this contains the day from the string.
Returns:
True if the parse succeeded, false otherwise.

bool Nitf::exportMetadata ( const RasterDataDescriptor pDescriptor,
const RasterFileDescriptor pExportDescriptor,
ossimNitfWriter *  pNitf,
Progress pProgress 
)

Exports supported metadata for the specified image into pNitf.

Parameters:
pDescriptor The RasterDataDescriptor containing the metadata to export.
pExportDescriptor The RasterFileDescriptor for export.
pNitf The ossimNitfWriter to populate.
pProgress The Progress object to use.
Returns:
True on success, false otherwise.

template<typename T>
T Nitf::fromBuffer ( std::vector< char > &  buf,
bool &  ok,
bool  allBlankOk,
bool  allDashesOk 
)

Definition at line 861 of file NitfUtilities.h.

template<>
std::string Nitf::fromBuffer< std::string > ( std::vector< char > &  buf,
bool &  ok,
bool  allBlankOk,
bool  allDashesOk 
)

std::string Nitf::getRpcCoefficient ( const std::string &  prefix,
const unsigned int &  num 
)

Returns the string representation of the given RPC coefficient.

Parameters:
prefix The prefix for the coefficient name.
num The coefficient number to get [1, 20].
Returns:
string representation of the coefficient.

template<typename T>
T Nitf::getSentinel (  ) 

Gets the sentinel value for a given field.

Returns:
The sentinel value.

Definition at line 127 of file NitfUtilities.h.

template<class Condition>
const DynamicObject* Nitf::getTagHandle ( const DynamicObject nitfMetadata,
std::string  treName,
Condition  cond = Condition() 
)

Gets a handle to a TRE out of the NITF Metadata.

You can provide a functor to filter out which TRE to fetch (ie. find the first ICHIPB with an OP_COL_11 field that is valid). Example:

 // Get the first instance of the RPC00B TRE; assumes nitfMetadata is the NITF metadata DynamicObject
 DynamicObject* pDynObj = getTagHandle(nitfMetadata, "RPC00B", FindFirst());

Parameters:
nitfMetadata The cube's NITF metadata object.
treName The name of the TRE.
cond A functor that determines if the DynamicObject passed in should be fetched. argument is provided, gets the first instance of the tag.
Returns:
A pointer to the tag handle of the given TRE and instance. NULL, if the TRE does not exist.

Definition at line 89 of file NitfUtilities.h.

bool Nitf::importMetadata ( const unsigned int &  currentImage,
const Nitf::OssimFileResource pFile,
const ossimNitfFileHeaderV2_X *  pFileHeader,
const ossimNitfImageHeaderV2_X *  pImageSubheader,
RasterDataDescriptor pDescriptor,
std::map< std::string, TrePlugInResource > &  parsers,
std::string &  errorMessage 
)

Imports supported metadata for the specified image into a RasterDataDescriptor.

Parameters:
currentImage The index of the image to import.
pFile The source file.
pFileHeader The header of the source file.
pImageSubheader The current image subheader.
pDescriptor The RasterDataDescriptor to populate.
parsers Contains TRE parsers which have already been loaded into memory -- included for improved performance.
errorMessage Message for import errors, etc.
Returns:
True on success, false otherwise.

bool Nitf::isClassificationFieldValidForExport ( const Classification classification,
const std::string &  fieldName 
)

Determines whether a classification field is valid for export to a NITF 2.1 file.

Parameters:
classification The Classification object to validate.
fieldName The name of the field to validate.
Returns:
True if the given field is valid for NITF 2.1 export, false otherwise.

bool Nitf::isClassificationValidForExport ( const Classification classification,
std::string &  errorMessage 
)

Determines whether a Classification object is valid for export to a NITF 2.1 file.

Parameters:
classification The Classification object to validate.
errorMessage An error message indicating the nature of the problem.
Returns:
True if the given object is valid for NITF 2.1 export, false otherwise.

TreState Nitf::MaxState ( TreState  stateA,
TreState  stateB 
)

Determine the least trusted state of the provided TreStates.

Parameters:
stateA The first state to compare
stateB The second state to compare
Returns:
The least trusted of the provided states.

bool Nitf::numReadErrMsg ( int64_t  numRead,
int64_t  numBytes,
std::string &  errorMessage 
)

Definition at line 936 of file NitfUtilities.h.

template<typename T>
bool Nitf::readAndConvertFromStream ( std::istream &  input,
T &  output,
bool &  success,
const std::string &  name,
int  len,
std::string &  msg,
std::vector< char > &  buf,
bool  allBlankOk = false,
bool  allDashesOk = false 
)

Definition at line 990 of file NitfUtilities.h.

template<typename T>
bool Nitf::readField ( std::istream &  input,
DynamicObject output,
bool &  success,
const std::string &  name,
int  len,
std::string &  msg,
std::vector< char > &  buf,
bool  allBlankOk = false,
bool  allDashesOk = false 
)

Definition at line 963 of file NitfUtilities.h.

bool Nitf::readFieldErrMsg ( std::string &  msg,
const std::string &  name,
const std::vector< char > &  buf,
int  len 
)

Definition at line 925 of file NitfUtilities.h.

bool Nitf::readFromStream ( std::istream &  strm,
std::vector< char > &  buf,
std::streamsize  count,
bool  bStr = true 
)

Reads a number of characters from a stream and places it in a vector of chars.

Parameters:
strm The source stream.
buf The destination vector for the data.
count The number of bytes to read from the stream.
bStr TRUE if the value read will need to be a NULL-terminated string. FALSE if the data will be treated as binary data.
Returns:
TRUE if the operation succeeds and the stream is good, FALSE otherwise.

std::string Nitf::sizeString ( const std::string &  str,
unsigned int  size,
char  fillChar = ' ',
bool  rightJustify = false 
)

Cleans up a string for NITF export.

It guarantees the string is characters long. Left or right justified, as specified, if the string needs to be lengthened.

Parameters:
str The string to be cleaned up for NITF export
size The required length of the output string.
fillChar The character to fill with if the string needs to be lenghtened. Default is blank (' ').
rightJustify If true then the string is right justified, left justified otherwise.
Returns:
The output string. Guaranteed to be size characters long.

TreState Nitf::testTagValidBcsASet ( const DynamicObject tre,
std::ostream &  reporter,
unsigned int *  pNumFields,
const std::string &  name,
const std::set< std::string > &  testSet,
bool  allBlankOk = false,
bool  notInSetOk = true,
bool  emitMsgNotInSet = false 
)

Test a tag to ensure valid BCS-A strings from within a set.

Parameters:
tre DynamicObject to get the test value from
reporter ostream to report errors to.
pNumFields Number of fields currently read in by the calling parser. If not NULL, this value is incremented if the field has been read.
name The name of the test value within the DynamicObject.
testSet Set of always allowed strings.
allBlankOk If true, it is valid to have an all blank (whitespace) string in the test value.
notInSetOk If true, it is valid to have the test value not occur in testSet.
emitMsgNotInSet If true, emit a message to reporter when the test value does not occur in testSet.
Returns:
This method follows these rules, in this order:
  1. If testValue occurs in testSet, returns TreState::VALID.
  2. If true is false, and testString is all blank, emits a message and returns TreState::INVALID.
  3. If emitMsgNotInSet, emit a message
  4. If notInSetOk is false, returns TreState::SUSPECT.
  5. If testValue contains characters outside of BCS-A, emits a message and returns TreState::INVALID.

TreState Nitf::testTagValidBcsASet ( const std::string &  testValue,
std::ostream &  reporter,
std::set< std::string >  testSet,
bool  allBlankOk = false,
bool  notInSetOk = true,
bool  emitMsgNotInSet = false 
)

Test a tag to ensure valid BCS-A strings from within a set.

Parameters:
testValue String to test.
reporter ostream to report errors to.
testSet Set of always allowed strings.
allBlankOk If true, it is valid to have an all blank (whitespace) string in testValue.
notInSetOk If true, it is valid to have testValue not occur in testSet.
emitMsgNotInSet If true, emit a message to reporter when testValue does not occur in testSet.
Returns:
This method follows these rules, in this order:
  1. If testValue occurs in testSet, returns TreState::VALID.
  2. If true is false, and testString is all blank, emits a message and returns TreState::INVALID.
  3. If emitMsgNotInSet, emit a message
  4. If notInSetOk is false, returns TreState::SUSPECT.
  5. If testValue contains characters outside of BCS-A, emits a message and returns TreState::INVALID.

template<typename T>
TreState Nitf::testTagValueEq ( const DynamicObject tre,
std::ostream &  reporter,
const std::string &  name,
const T &  eqValue 
)

Test a tag within a DynamicObject for equivalence.

Parameters:
tre The DynamicObject to get the value from
reporter ostream to report failures to
name The name of the tag within the DynamicObject
eqValue The value to test equivalence against
Returns:
INVALID if the tag is not found, SUSPECT if not equal, VALID otherwise.

Definition at line 226 of file NitfUtilities.h.

template<typename T>
TreState Nitf::testTagValueNotEq ( const DynamicObject tre,
std::ostream &  reporter,
const std::string &  name,
const T &  notEqValue 
)

Test a tag within a DynamicObject for non-equivalence.

Parameters:
tre The DynamicObject to get the value from
reporter ostream to report failures to
name The name of the tag within the DynamicObject
notEqValue The value to test non-equivalence against
Returns:
INVALID if the tag is not found, SUSPECT if equal, VALID otherwise.

Definition at line 262 of file NitfUtilities.h.

template<typename T>
TreState Nitf::testTagValueRange ( const DynamicObject tre,
std::ostream &  reporter,
unsigned int *  pNumFields,
const std::string &  name,
const T &  minValue,
const T &  maxValue,
bool  optional = false 
)

Test a tag within a DynamicObject against a range.

Parameters:
tre The DynamicObject from which to get the value.
reporter ostream To report failures.
pNumFields Number of fields currently read in by the calling parser. If not NULL, this value is incremented if the field has been read.
name The name of the tag within the DynamicObject.
minValue The minimum value of the range.
maxValue The maximum value of the range.
optional True if the field is considered to be optional (all spaces allowed).
Returns:
INVALID if the tag is not found, SUSPECT if outside the range, VALID otherwise.

Definition at line 180 of file NitfUtilities.h.

template<typename T>
TreState Nitf::testTagValueRange ( std::ostream &  reporter,
const T &  testValue,
const T &  minValue,
const T &  maxValue 
)

Test a tag against a range.

Parameters:
reporter ostream to report failures to
testValue The value to test
minValue The minimum value of the range
maxValue The maximum value of the range
Returns:
SUSPECT if outside the range, VALID otherwise.

Definition at line 147 of file NitfUtilities.h.

template<typename T>
std::string Nitf::toString ( num,
unsigned int  size,
int  precision = -1,
char  fillChar = '0',
bool  posSign = false,
bool  sciNotation = false,
int  expSize = 3,
bool  optional = false,
char  optionalChar = ' ' 
)

Converts a numeric to a string.

It only works with numeric intrinsics Guaranteed to be num characters long with a leading '-' if negative or a leading '+' if positive and posSign == true

Parameters:
num The numeric to be converted to a string.
size The required length of the output string.
precision For floating point the number of digits after the decimal point. Default == -1 which means to fit in the maximum within the allocated size.
fillChar The numeric fill character. Default == '0'.
posSign If true then output a leading "+" if the num is positive.
sciNotation If true then force scientific notation in the form: "+0.123456E+001"
expSize The number of digits in the exponent (where 1 <= expSize <= 3).
optional True if field can be exported as optional (with placeholders) if not present initially.
optionalChar The char to use when filling the field with a placeholder.
Returns:
The numeric value converted to a string. Guaranteed to be num characters long with a leading '-' if negative or a leading '+' if positive and posSign == true

Definition at line 720 of file NitfUtilities.h.

bool Nitf::updateSpecialMetadata ( DynamicObject pMetadata,
std::vector< double > &  centerWavelengths,
std::vector< double > &  startWavelengths,
std::vector< double > &  endWavelengths,
const std::vector< double > &  fwhms,
bool  convertFromInverseCentimeters = false 
)

Updates band information in the special metadata, computing start, center, and end wavelengths from the given data if possible.

Parameters:
pMetadata The metadata to update.
centerWavelengths The center wavelengths to write or an empty vector if center wavelengths are unknown.
startWavelengths The start wavelengths to write or an empty vector if start wavelengths are unknown.
endWavelengths The end wavelengths to write or an empty vector if end wavelengths are unknown.
fwhms The FWHM for each band or an empty vector if FWHMs are unknown.
convertFromInverseCentimeters True if all data is in inverse centimeters, false if all data is in microns.
Returns:
True on success, false otherwise.


Variable Documentation

const bool Nitf::ALL_BLANK_FALSE = false [static]

Definition at line 22 of file NitfConstants.h.

const bool Nitf::ALL_BLANK_TRUE = true [static]

Definition at line 21 of file NitfConstants.h.

const std::string Nitf::DES_METADATA = "DES" [static]

Definition at line 34 of file NitfConstants.h.

const bool Nitf::EMIT_MSG_NOT_IN_SET_FALSE = false [static]

Definition at line 26 of file NitfConstants.h.

const bool Nitf::EMIT_MSG_NOT_IN_SET_TRUE = true [static]

Definition at line 25 of file NitfConstants.h.

const std::string Nitf::FILE_HEADER = "File Header" [static]

Definition at line 32 of file NitfConstants.h.

const std::string Nitf::IMAGE_SUBHEADER = "Image Subheader" [static]

Definition at line 33 of file NitfConstants.h.

const std::string Nitf::NITF_METADATA = "NITF" [static]

Definition at line 31 of file NitfConstants.h.

const bool Nitf::NOT_IN_SET_FALSE = false [static]

Definition at line 24 of file NitfConstants.h.

const bool Nitf::NOT_IN_SET_TRUE = true [static]

Definition at line 23 of file NitfConstants.h.

const int Nitf::ONE_EXP_DIGIT = 1 [static]

Definition at line 29 of file NitfConstants.h.

const bool Nitf::POS_SIGN_FALSE = false [static]

Definition at line 20 of file NitfConstants.h.

const bool Nitf::POS_SIGN_TRUE = true [static]

Definition at line 19 of file NitfConstants.h.

const std::string Nitf::TRE_INFO_METADATA = "TRE Information" [static]

Definition at line 36 of file NitfConstants.h.

const std::string Nitf::TRE_METADATA = "TRE" [static]

Definition at line 35 of file NitfConstants.h.

const bool Nitf::USE_SCIENTIFIC_NOTATION = true [static]

Definition at line 27 of file NitfConstants.h.

const std::string Nitf::VERSION_02_00 = "02.00" [static]

Definition at line 38 of file NitfConstants.h.

const std::string Nitf::VERSION_02_10 = "02.10" [static]

Definition at line 39 of file NitfConstants.h.

const char Nitf::ZERO_FILL = '0' [static]

Definition at line 28 of file NitfConstants.h.


Software Development Kit - Opticks 4.8.0 Build 15482