OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Private Attributes | List of all members
ossimNitfTagInformation Class Reference

#include <ossimNitfTagInformation.h>

Inheritance diagram for ossimNitfTagInformation:
ossimObject ossimReferenced

Public Member Functions

 ossimNitfTagInformation (ossimRefPtr< ossimNitfRegisteredTag > tagData=0)
 
virtual ~ossimNitfTagInformation ()
 
virtual void parseStream (ossim::istream &in)
 
virtual void writeStream (ossim::ostream &out)
 
void setTagName (const ossimString &tagName)
 
void setTagLength (ossim_uint32 tagLength)
 
ossim_uint32 getTotalTagLength () const
 Length of the 5 byte tag length the 6 byte tag name and the data length. More...
 
ossim_uint32 getTagLength () const
 Should return the value of theTagLength which is the length of the data in bytes. More...
 
ossim_uint64 getTagOffset () const
 
ossim_uint64 getTagDataOffset () const
 
ossimString getTagName () const
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
void clearFields ()
 
ossimRefPtr< ossimNitfRegisteredTaggetTagData ()
 
const ossimRefPtr< ossimNitfRegisteredTaggetTagData () const
 
void setTagData (ossimRefPtr< ossimNitfRegisteredTag > tagData)
 
ossimString getTagType () const
 
void setTagType (const ossimString &tagType) const
 
bool operator< (const ossimNitfTagInformation &rhs) const
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 

Private Attributes

char theTagName [7]
 This is a 6 byte field. More...
 
char theTagLength [6]
 This is a 5 byte field. More...
 
char theTagType [7]
 This is a 6 byte field which should be UDHD, UDID, XHD, IXSHD, SXSHD, or TXSHD. More...
 
ossim_uint64 theTagOffset
 This will hold the offset to the start of the above information This is just a work variable. More...
 
ossim_uint64 theTagDataOffset
 This will hold the start to the data. More...
 
ossimRefPtr< ossimNitfRegisteredTagtheTagData
 Used to hold the tag data. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Detailed Description

Definition at line 22 of file ossimNitfTagInformation.h.

Constructor & Destructor Documentation

◆ ossimNitfTagInformation()

ossimNitfTagInformation::ossimNitfTagInformation ( ossimRefPtr< ossimNitfRegisteredTag tagData = 0)

Definition at line 21 of file ossimNitfTagInformation.cpp.

References clearFields(), and setTagData().

22 {
23  clearFields();
24  setTagData(tagData);
25 }
void setTagData(ossimRefPtr< ossimNitfRegisteredTag > tagData)

◆ ~ossimNitfTagInformation()

ossimNitfTagInformation::~ossimNitfTagInformation ( )
virtual

Definition at line 27 of file ossimNitfTagInformation.cpp.

28 {
29 }

Member Function Documentation

◆ clearFields()

void ossimNitfTagInformation::clearFields ( )

Definition at line 129 of file ossimNitfTagInformation.cpp.

References theTagDataOffset, theTagLength, theTagName, theTagOffset, and theTagType.

Referenced by ossimNitfTagInformation(), parseStream(), and ossimNitfDataExtensionSegmentV2_1::parseStream().

130 {
131  memset(theTagName, ' ', 6);
132  memset(theTagLength, 0, 5);
133  strcpy(theTagType, "IXSHD ");
134 
135  theTagName[6] = '\0';
136  theTagLength[5] = '\0';
137 
138  theTagOffset = 0;
139  theTagDataOffset = 0;
140 }
char theTagLength[6]
This is a 5 byte field.
ossim_uint64 theTagOffset
This will hold the offset to the start of the above information This is just a work variable...
char theTagName[7]
This is a 6 byte field.
ossim_uint64 theTagDataOffset
This will hold the start to the data.
char theTagType[7]
This is a 6 byte field which should be UDHD, UDID, XHD, IXSHD, SXSHD, or TXSHD.

◆ getTagData() [1/2]

ossimRefPtr< ossimNitfRegisteredTag > ossimNitfTagInformation::getTagData ( )

Definition at line 172 of file ossimNitfTagInformation.cpp.

References theTagData.

173 {
174  return theTagData;
175 }
ossimRefPtr< ossimNitfRegisteredTag > theTagData
Used to hold the tag data.

◆ getTagData() [2/2]

const ossimRefPtr< ossimNitfRegisteredTag > ossimNitfTagInformation::getTagData ( ) const

Definition at line 177 of file ossimNitfTagInformation.cpp.

References theTagData.

178 {
179  return theTagData;
180 }
ossimRefPtr< ossimNitfRegisteredTag > theTagData
Used to hold the tag data.

◆ getTagDataOffset()

ossim_uint64 ossimNitfTagInformation::getTagDataOffset ( ) const

Definition at line 107 of file ossimNitfTagInformation.cpp.

References theTagDataOffset.

Referenced by ossimRpfFrameFileReader::parseFile().

108 {
109  return theTagDataOffset;
110 }
ossim_uint64 theTagDataOffset
This will hold the start to the data.

◆ getTagLength()

ossim_uint32 ossimNitfTagInformation::getTagLength ( ) const

Should return the value of theTagLength which is the length of the data in bytes.

Definition at line 97 of file ossimNitfTagInformation.cpp.

References theTagLength, and ossimString::toUInt32().

Referenced by getTotalTagLength(), and parseStream().

98 {
100 }
char theTagLength[6]
This is a 5 byte field.
ossim_uint32 toUInt32() const

◆ getTagName()

ossimString ossimNitfTagInformation::getTagName ( ) const

Definition at line 112 of file ossimNitfTagInformation.cpp.

References theTagName, and ossimString::trim().

Referenced by ossimNitfImageHeader::addTag(), ossimNitfFileHeader::addTag(), ossimNitfFileHeaderV2_1::addTag(), ossimRpfFrameFileReader::parseFile(), parseStream(), and ossimNitfFile::print().

113 {
114  return ossimString(theTagName).trim();
115 }
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
char theTagName[7]
This is a 6 byte field.

◆ getTagOffset()

ossim_uint64 ossimNitfTagInformation::getTagOffset ( ) const

Definition at line 102 of file ossimNitfTagInformation.cpp.

References theTagOffset.

103 {
104  return theTagOffset;
105 }
ossim_uint64 theTagOffset
This will hold the offset to the start of the above information This is just a work variable...

◆ getTagType()

ossimString ossimNitfTagInformation::getTagType ( ) const

Definition at line 195 of file ossimNitfTagInformation.cpp.

References theTagType, and ossimString::trim().

196 {
197  return ossimString(theTagType).trim();
198 }
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
char theTagType[7]
This is a 6 byte field which should be UDHD, UDID, XHD, IXSHD, SXSHD, or TXSHD.

◆ getTotalTagLength()

ossim_uint32 ossimNitfTagInformation::getTotalTagLength ( ) const

Length of the 5 byte tag length the 6 byte tag name and the data length.

So we have Data length + 11 bytes.

Definition at line 92 of file ossimNitfTagInformation.cpp.

References getTagLength().

Referenced by operator<().

93 {
94  return (getTagLength() + (ossim_uint32)11);
95 }
unsigned int ossim_uint32
ossim_uint32 getTagLength() const
Should return the value of theTagLength which is the length of the data in bytes. ...

◆ operator<()

bool ossimNitfTagInformation::operator< ( const ossimNitfTagInformation rhs) const
inline

Definition at line 59 of file ossimNitfTagInformation.h.

References getTotalTagLength().

60  {
61  return getTotalTagLength() < rhs.getTotalTagLength();
62  }
ossim_uint32 getTotalTagLength() const
Length of the 5 byte tag length the 6 byte tag name and the data length.

◆ parseStream()

void ossimNitfTagInformation::parseStream ( ossim::istream in)
virtual

Definition at line 31 of file ossimNitfTagInformation.cpp.

References clearFields(), ossimNitfTagFactoryRegistry::create(), ossimObject::getClassName(), getTagLength(), ossimNitfRegisteredTag::getTagLength(), getTagName(), ossimNitfRegisteredTag::getTagName(), ossimNitfTagFactoryRegistry::instance(), ossimNotify(), ossimNotifyLevel_WARN, ossimNitfRegisteredTag::parseStream(), ossimNitfRegisteredTag::setTagLength(), ossimNitfRegisteredTag::setTagName(), theTagData, theTagDataOffset, theTagLength, theTagName, theTagOffset, and ossimRefPtr< T >::valid().

Referenced by ossimNitfImageHeaderV2_0::parseStream(), ossimNitfDataExtensionSegmentV2_0::parseStream(), ossimNitfDataExtensionSegmentV2_1::parseStream(), and ossimNitfFileHeaderV2_1::parseStream().

32 {
33  if(in)
34  {
35  clearFields();
36  theTagOffset = in.tellg();
37  in.read(theTagName, 6);
38  in.read(theTagLength, 5);
39  theTagDataOffset = in.tellg();
40 
42 
43  if (theTagData.valid())
44  {
45  if (theTagData->getClassName() == "ossimNitfUnknownTag")
46  {
47  // Unknown tag doesn't know his tag name yet.
49  }
50 
51  //---
52  // Tags with dynamic tag length construct with 0 length.
53  // Set if 0.
54  //---
55  if ( theTagData->getTagLength() == 0 )
56  {
58  }
59  // Sanity check fixed length in code with length from CEL field:
60  else if ( theTagData->getTagLength() != getTagLength() )
61  {
63  << "ossimNitfTagInformation::parseStream WARNING!"
64  << "\nCEL field length does not match fixed tag length for tag: "
65  << theTagData->getTagName().c_str()
66  << "\nCEL: " << getTagLength()
67  << "\nTag: " << theTagData->getTagLength()
68  << std::endl;
69  }
70 
72  }
73  else
74  {
76  }
77  }
78 }
virtual const std::string & getTagName() const
This will return the name of the registered tag for this user defined header.
ossimRefPtr< ossimNitfRegisteredTag > theTagData
Used to hold the tag data.
bool valid() const
Definition: ossimRefPtr.h:75
virtual void parseStream(ossim::istream &in)=0
This will allow the user defined data to parse the stream.
char theTagLength[6]
This is a 5 byte field.
virtual ossimString getClassName() const
Definition: ossimObject.cpp:64
virtual void setTagLength(ossim_uint32 length)
Set the tag length.
virtual ossim_uint32 getTagLength() const
Returns the length in bytes of the tag from the CEL or REL field.
virtual void setTagName(const std::string &tagName)
static ossimNitfTagFactoryRegistry * instance()
ossim_uint64 theTagOffset
This will hold the offset to the start of the above information This is just a work variable...
char theTagName[7]
This is a 6 byte field.
ossim_uint64 theTagDataOffset
This will hold the start to the data.
ossim_uint32 getTagLength() const
Should return the value of theTagLength which is the length of the data in bytes. ...
ossimRefPtr< ossimNitfRegisteredTag > create(const ossimString &tagName) const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ print()

std::ostream & ossimNitfTagInformation::print ( std::ostream &  out) const
virtual

Generic print method.

Derived classes should re-implement as they see fit.

Returns
std::ostream&

Reimplemented from ossimObject.

Definition at line 117 of file ossimNitfTagInformation.cpp.

References theTagDataOffset, theTagLength, theTagName, theTagOffset, and theTagType.

118 {
119  out << "theTagName: " << theTagName
120  << "\ntheTagLength: " << theTagLength
121  << "\ntheTagType: " << theTagType
122  << "\ntheTagOffset: " << theTagOffset
123  << "\ntheTagDataOffset: " << theTagDataOffset
124  << std::endl;
125 
126  return out;
127 }
char theTagLength[6]
This is a 5 byte field.
ossim_uint64 theTagOffset
This will hold the offset to the start of the above information This is just a work variable...
char theTagName[7]
This is a 6 byte field.
ossim_uint64 theTagDataOffset
This will hold the start to the data.
char theTagType[7]
This is a 6 byte field which should be UDHD, UDID, XHD, IXSHD, SXSHD, or TXSHD.

◆ setTagData()

void ossimNitfTagInformation::setTagData ( ossimRefPtr< ossimNitfRegisteredTag tagData)

Definition at line 182 of file ossimNitfTagInformation.cpp.

References ossimNitfRegisteredTag::getRegisterTagName(), ossimNitfRegisteredTag::getSizeInBytes(), setTagLength(), setTagName(), theTagData, theTagLength, theTagName, and ossimRefPtr< T >::valid().

Referenced by ossimNitf20Writer::addRegisteredTag(), ossimNitfWriter::addRegisteredTag(), and ossimNitfTagInformation().

183 {
184  theTagData = tagData;
185 
186  memset(theTagName, ' ', 6);
187  memset(theTagLength, ' ', 5);
188 
189  if(theTagData.valid())
190  {
193  }
194 }
ossimRefPtr< ossimNitfRegisteredTag > theTagData
Used to hold the tag data.
bool valid() const
Definition: ossimRefPtr.h:75
virtual std::string getRegisterTagName() const
This will return the name of the registered tag for this user defined header.
char theTagLength[6]
This is a 5 byte field.
void setTagName(const ossimString &tagName)
virtual ossim_uint32 getSizeInBytes() const
Returns the length in bytes of the tag from the CEL or REL field.
char theTagName[7]
This is a 6 byte field.
void setTagLength(ossim_uint32 tagLength)

◆ setTagLength()

void ossimNitfTagInformation::setTagLength ( ossim_uint32  tagLength)

Definition at line 154 of file ossimNitfTagInformation.cpp.

References theTagLength.

Referenced by setTagData().

155 {
156  memset(theTagLength, 0, 5);
157 
158  if(tagLength > 99999)
159  {
160  tagLength = 99999;
161  }
162 
163  std::ostringstream out;
164 
165  out << std::setw(5)
166  << std::setfill('0')
167  << tagLength;
168 
169  memcpy(theTagLength, out.str().c_str(), 5);
170 }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
char theTagLength[6]
This is a 5 byte field.

◆ setTagName()

void ossimNitfTagInformation::setTagName ( const ossimString tagName)

Definition at line 142 of file ossimNitfTagInformation.cpp.

References theTagName.

Referenced by setTagData().

143 {
144  memset(theTagName, ' ', 6);
145 
146  std::ostringstream out;
147 
148  out << std::setw(6)
149  << std::setfill(' ')
150  << tagName;
151  memcpy(theTagName, out.str().c_str(), 6);
152 }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
char theTagName[7]
This is a 6 byte field.

◆ setTagType()

void ossimNitfTagInformation::setTagType ( const ossimString tagType) const

Definition at line 200 of file ossimNitfTagInformation.cpp.

References theTagType.

Referenced by ossimNitfWriter::addRegisteredTag(), and ossimNitfFileHeaderV2_1::parseStream().

201 {
202  std::ostringstream out;
203  out << std::setw(6)
204  << std::setfill(' ')
205  << std::setiosflags(std::ios::left)
206  << tagType;
207  memcpy(theTagType, out.str().c_str(), 6);
208  theTagType[6] = 0;
209 }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
char theTagType[7]
This is a 6 byte field which should be UDHD, UDID, XHD, IXSHD, SXSHD, or TXSHD.

◆ writeStream()

void ossimNitfTagInformation::writeStream ( ossim::ostream out)
virtual

Definition at line 80 of file ossimNitfTagInformation.cpp.

References theTagData, theTagDataOffset, theTagLength, theTagName, theTagOffset, ossimRefPtr< T >::valid(), and ossimNitfRegisteredTag::writeStream().

81 {
82  theTagOffset = out.tellp(); // Capture the offset.
83  out.write(theTagName, 6);
84  out.write(theTagLength, 5);
85  if(theTagData.valid())
86  {
87  theTagDataOffset = out.tellp();
88  theTagData->writeStream(out);
89  }
90 }
ossimRefPtr< ossimNitfRegisteredTag > theTagData
Used to hold the tag data.
virtual void writeStream(ossim::ostream &out)=0
bool valid() const
Definition: ossimRefPtr.h:75
char theTagLength[6]
This is a 5 byte field.
ossim_uint64 theTagOffset
This will hold the offset to the start of the above information This is just a work variable...
char theTagName[7]
This is a 6 byte field.
ossim_uint64 theTagDataOffset
This will hold the start to the data.

Member Data Documentation

◆ theTagData

ossimRefPtr<ossimNitfRegisteredTag> ossimNitfTagInformation::theTagData
private

Used to hold the tag data.

Definition at line 98 of file ossimNitfTagInformation.h.

Referenced by getTagData(), parseStream(), setTagData(), and writeStream().

◆ theTagDataOffset

ossim_uint64 ossimNitfTagInformation::theTagDataOffset
private

This will hold the start to the data.

This is just the position in the file just past the tag length field. This is just a work variable

Definition at line 93 of file ossimNitfTagInformation.h.

Referenced by clearFields(), getTagDataOffset(), parseStream(), print(), and writeStream().

◆ theTagLength

char ossimNitfTagInformation::theTagLength[6]
private

This is a 5 byte field.

Definition at line 74 of file ossimNitfTagInformation.h.

Referenced by clearFields(), getTagLength(), parseStream(), print(), setTagData(), setTagLength(), and writeStream().

◆ theTagName

char ossimNitfTagInformation::theTagName[7]
private

This is a 6 byte field.

Definition at line 69 of file ossimNitfTagInformation.h.

Referenced by clearFields(), getTagName(), parseStream(), print(), setTagData(), setTagName(), and writeStream().

◆ theTagOffset

ossim_uint64 ossimNitfTagInformation::theTagOffset
private

This will hold the offset to the start of the above information This is just a work variable.

Definition at line 86 of file ossimNitfTagInformation.h.

Referenced by clearFields(), getTagOffset(), parseStream(), print(), and writeStream().

◆ theTagType

char ossimNitfTagInformation::theTagType[7]
mutableprivate

This is a 6 byte field which should be UDHD, UDID, XHD, IXSHD, SXSHD, or TXSHD.

This is declared as mutable since changing the tag type doesn't change the contents of the tag.

Definition at line 80 of file ossimNitfTagInformation.h.

Referenced by clearFields(), getTagType(), print(), and setTagType().


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