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

#include <ossimNitfUnknownTag.h>

Inheritance diagram for ossimNitfUnknownTag:
ossimNitfRegisteredTag ossimObject ossimPropertyInterface ossimReferenced

Public Member Functions

 ossimNitfUnknownTag ()
 default constructor More...
 
virtual ~ossimNitfUnknownTag ()
 destructor More...
 
virtual void parseStream (std::istream &in)
 Parse method. More...
 
virtual void writeStream (std::ostream &out)
 Write method. More...
 
virtual void clearFields ()
 Clears all string fields within the record to some default nothingness. More...
 
virtual std::ostream & print (std::ostream &out, const std::string &prefix=std::string()) const
 print method that outputs a key/value type format adding prefix to keys. More...
 
virtual void setTagLength (ossim_uint32 length)
 
- Public Member Functions inherited from ossimNitfRegisteredTag
 ossimNitfRegisteredTag ()
 default constructor More...
 
 ossimNitfRegisteredTag (const std::string &tagName, ossim_uint32 tagLength)
 Constructor that takes name and size. More...
 
virtual ~ossimNitfRegisteredTag ()
 destructor More...
 
virtual std::string getRegisterTagName () const
 This will return the name of the registered tag for this user defined header. More...
 
virtual const std::string & getTagName () const
 This will return the name of the registered tag for this user defined header. More...
 
virtual void setTagName (const std::string &tagName)
 
virtual ossim_uint32 getSizeInBytes () const
 Returns the length in bytes of the tag from the CEL or REL field. More...
 
virtual ossim_uint32 getTagLength () const
 Returns the length in bytes of the tag from the CEL or REL field. More...
 
virtual void parseStream (ossim::istream &in)=0
 This will allow the user defined data to parse the stream. More...
 
virtual void writeStream (ossim::ostream &out)=0
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
virtual void getMetadata (ossimKeywordlist &kwl, const char *prefix=0) const
 Default interface to populate keyword list with metadata. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const ossimString &prefix) 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 std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
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
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 

Protected Member Functions

bool tagDataIsAscii () const
 
bool tagDataIsXml () const
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Protected Attributes

char * m_tagData
 Holds entire tag data(theTagLength) plus one byte for null terminator. More...
 
- Protected Attributes inherited from ossimNitfRegisteredTag
std::string m_tagName
 
ossim_uint32 m_tagLength
 

Detailed Description

Definition at line 21 of file ossimNitfUnknownTag.h.

Constructor & Destructor Documentation

◆ ossimNitfUnknownTag()

ossimNitfUnknownTag::ossimNitfUnknownTag ( )

default constructor

Definition at line 26 of file ossimNitfUnknownTag.cpp.

27  : m_tagData(0)
28 {
29 }
char * m_tagData
Holds entire tag data(theTagLength) plus one byte for null terminator.

◆ ~ossimNitfUnknownTag()

ossimNitfUnknownTag::~ossimNitfUnknownTag ( )
virtual

destructor

Definition at line 31 of file ossimNitfUnknownTag.cpp.

References m_tagData.

32 {
33  if (m_tagData)
34  {
35  delete [] m_tagData;
36  m_tagData = 0;
37  }
38 }
char * m_tagData
Holds entire tag data(theTagLength) plus one byte for null terminator.

Member Function Documentation

◆ clearFields()

void ossimNitfUnknownTag::clearFields ( )
virtual

Clears all string fields within the record to some default nothingness.

Definition at line 65 of file ossimNitfUnknownTag.cpp.

References m_tagData.

66 {
67  if (m_tagData)
68  {
69  delete [] m_tagData;
70  m_tagData = 0;
71  }
72 }
char * m_tagData
Holds entire tag data(theTagLength) plus one byte for null terminator.

◆ parseStream()

void ossimNitfUnknownTag::parseStream ( std::istream &  in)
virtual

Parse method.

Parameters
inStream to parse. This will read the entire tag length into an array.

Definition at line 40 of file ossimNitfUnknownTag.cpp.

References m_tagData, and ossimNitfRegisteredTag::m_tagLength.

41 {
42  if (m_tagLength)
43  {
44  if (m_tagData)
45  {
46  delete [] m_tagData;
47  }
48 
49  m_tagData = new char[m_tagLength+1];
50 
51  in.read(m_tagData, m_tagLength);
52 
53  m_tagData[m_tagLength] = '\0';
54  }
55 }
char * m_tagData
Holds entire tag data(theTagLength) plus one byte for null terminator.

◆ print()

std::ostream & ossimNitfUnknownTag::print ( std::ostream &  out,
const std::string &  prefix = std::string() 
) const
virtual

print method that outputs a key/value type format adding prefix to keys.

Reimplemented from ossimNitfRegisteredTag.

Definition at line 74 of file ossimNitfUnknownTag.cpp.

References ossimNitfRegisteredTag::getTagLength(), ossimNitfRegisteredTag::getTagName(), m_tagData, tagDataIsAscii(), and tagDataIsXml().

76 {
77  std::string pfx = prefix;
78  pfx += getTagName();
79  pfx += ".";
80 
81  out << setiosflags(std::ios::left)
82  << pfx << std::setw(24) << "CETAG:" << getTagName() << "\n"
83  << pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
84  << pfx << std::setw(24) << "unformatted_tag_data: ";
85 
86  if (tagDataIsAscii())
87  {
88  if (tagDataIsXml())
89  out << "<![CDATA[" << m_tagData << "]]>" << "\n";
90  else
91  out << m_tagData << "\n";
92  }
93  else
94  {
95  out << "binary not displayed\n";
96  }
97 
98  return out;
99 }
virtual const std::string & getTagName() const
This will return the name of the registered tag for this user defined header.
char * m_tagData
Holds entire tag data(theTagLength) plus one byte for null terminator.
virtual ossim_uint32 getTagLength() const
Returns the length in bytes of the tag from the CEL or REL field.

◆ setTagLength()

void ossimNitfUnknownTag::setTagLength ( ossim_uint32  length)
virtual
Parameters
lengthLength of tag.
Note
The tag length must be set prior to calling "parseStream".
Since you must have a length to read theTagData, if theTagData exist it will be deleted by this method. Subsequent "parseStream" calls will allocate theTagData as needed.

Reimplemented from ossimNitfRegisteredTag.

Definition at line 115 of file ossimNitfUnknownTag.cpp.

References m_tagData, and ossimNitfRegisteredTag::m_tagLength.

116 {
117  if (m_tagData)
118  {
119  delete [] m_tagData;
120  m_tagData = 0;
121  }
122  m_tagLength = length;
123 }
char * m_tagData
Holds entire tag data(theTagLength) plus one byte for null terminator.

◆ tagDataIsAscii()

bool ossimNitfUnknownTag::tagDataIsAscii ( ) const
protected
Returns
true if all characters in theTagData are printable.

Definition at line 125 of file ossimNitfUnknownTag.cpp.

References m_tagData, and ossimNitfRegisteredTag::m_tagLength.

Referenced by print().

126 {
127  if ( (m_tagLength == 0) || !m_tagData )
128  {
129  return false;
130  }
131 
132  for (ossim_uint32 i = 0; i < m_tagLength; ++i)
133  {
134  int c = m_tagData[i];
135  if (isascii(c) == false)
136  {
137  return false;
138  }
139  }
140 
141  return true;
142 }
char * m_tagData
Holds entire tag data(theTagLength) plus one byte for null terminator.
unsigned int ossim_uint32

◆ tagDataIsXml()

bool ossimNitfUnknownTag::tagDataIsXml ( ) const
protected

Definition at line 101 of file ossimNitfUnknownTag.cpp.

References ossimString::length(), m_tagData, ossimNitfRegisteredTag::m_tagLength, and ossimString::substr().

Referenced by print().

102 {
103  ossimString xmlTest = "<?xml";
104  ossim_uint32 len = xmlTest.length();
105  if ( (m_tagLength < len) || !m_tagData )
106  {
107  return false;
108  }
109 
110  ossimString tagDataString = ossimString(m_tagData).substr(0, len);
111  if (tagDataString == xmlTest) return true;
112  return false;
113 }
char * m_tagData
Holds entire tag data(theTagLength) plus one byte for null terminator.
std::string::size_type length() const
Definition: ossimString.h:408
unsigned int ossim_uint32
std::string substr(std::string::size_type pos=0, std::string::size_type n=std::string::npos) const
Equivalent to basic_string(*this, pos, n).
Definition: ossimString.h:910

◆ writeStream()

void ossimNitfUnknownTag::writeStream ( std::ostream &  out)
virtual

Write method.

Parameters
outStream to write to.

Definition at line 57 of file ossimNitfUnknownTag.cpp.

References m_tagData, and ossimNitfRegisteredTag::m_tagLength.

58 {
59  if (m_tagLength && m_tagData)
60  {
61  out.write(m_tagData, m_tagLength);
62  }
63 }
char * m_tagData
Holds entire tag data(theTagLength) plus one byte for null terminator.

Member Data Documentation

◆ m_tagData

char* ossimNitfUnknownTag::m_tagData
protected

Holds entire tag data(theTagLength) plus one byte for null terminator.

Definition at line 79 of file ossimNitfUnknownTag.h.

Referenced by clearFields(), parseStream(), print(), setTagLength(), tagDataIsAscii(), tagDataIsXml(), writeStream(), and ~ossimNitfUnknownTag().


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