OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRpfReplaceUpdateSectionSubheader.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // File: ossimRpfReplaceUpdateSectionSubheader.cpp
4 //
5 // License: See top level LICENSE.txt file.
6 //
7 // Author: David Burken
8 //
9 // Description:
10 //
11 // RPF replace/update section subheader record.
12 //
13 // See MIL-STD-2411 for detailed information.
14 //
15 //----------------------------------------------------------------------------
16 // $Id: ossimRpfReplaceUpdateSectionSubheader.cpp 20324 2011-12-06 22:25:23Z dburken $
17 
19 #include <ossim/base/ossimCommon.h> /* ossim::byteOrder() */
20 #include <ossim/base/ossimEndian.h>
21 #include <ossim/base/ossimTrace.h>
22 #include <istream>
23 #include <ostream>
24 
25 // Static trace for debugging
26 static ossimTrace traceDebug("ossimRpfReplaceUpdateSectionSubheader:debug");
27 
29 {
30  return data.print(out);
31 }
32 
34  :
35  m_tableOffset(0),
36  m_numberOfRecords(0),
37  m_recordLength(0)
38 {
39 }
40 
43  :
44  m_tableOffset(obj.m_tableOffset),
45  m_numberOfRecords(obj.m_numberOfRecords),
46  m_recordLength(obj.m_recordLength)
47 {
48 }
49 
52 {
53  if ( this != &rhs )
54  {
58  }
59  return *this;
60 }
61 
63 {
64 }
65 
68 {
69  if(in)
70  {
71  in.read((char*)&m_tableOffset, 4);
72  in.read((char*)&m_numberOfRecords, 2);
73  in.read((char*)&m_recordLength, 2);
74 
75  if( ossim::byteOrder() != byteOrder )
76  {
77  ossimEndian anEndian;
78  anEndian.swap(m_tableOffset);
79  anEndian.swap(m_numberOfRecords);
80  anEndian.swap(m_recordLength);
81  }
82  }
83  else
84  {
86  }
87 
88  if ( traceDebug() )
89  {
91  }
92 
94 }
95 
97 {
99  {
100  // Swap to big endian.
101  ossimEndian anEndian;
102  anEndian.swap(m_tableOffset);
103  anEndian.swap(m_numberOfRecords);
104  anEndian.swap(m_recordLength);
105  }
106 
107  out.write((char*)&m_tableOffset, 4);
108  out.write((char*)&m_numberOfRecords, 2);
109  out.write((char*)&m_recordLength, 2);
110 
112  {
113  // Swap back to native byte order.
114  ossimEndian anEndian;
115  anEndian.swap(m_tableOffset);
116  anEndian.swap(m_numberOfRecords);
117  anEndian.swap(m_recordLength);
118  }
119 }
121 {
122  out << "ossimRpfReplaceUpdateSectionSubheader DEBUG:"
123  << "\ntable_offset: " << m_tableOffset
124  << "\nnumber_of_records: " << m_numberOfRecords
125  << "\nrecord_length: " << m_recordLength
126  << std::endl;
127 
128  return out;
129 }
130 
132 {
133  return m_tableOffset;
134 }
135 
137 {
138  return m_numberOfRecords;
139 }
140 
142 {
143  return m_recordLength;
144 }
145 
147 {
148  m_numberOfRecords = count;
149 }
150 
152 {
153  m_recordLength = length;
154 }
155 
157 {
158  m_tableOffset = 0;
159  m_numberOfRecords = 0;
160  m_recordLength = 0;
161 }
162 
163 
ossim_int32 ossimErrorCode
const ossimRpfReplaceUpdateSectionSubheader & operator=(const ossimRpfReplaceUpdateSectionSubheader &rhs)
assignment operator
static const ossimErrorCode OSSIM_OK
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
static const ossimErrorCode OSSIM_ERROR
unsigned short ossim_uint16
std::ostream & print(std::ostream &out) const
print method that outputs a key/value type format adding prefix to keys.
unsigned int ossim_uint32
std::ostream & operator<<(std::ostream &out, const ossimRpfReplaceUpdateSectionSubheader &data)
ossimByteOrder
void setNumberOfRecords(ossim_uint16 count)
Sets number of records.
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
ossimErrorCode parseStream(std::istream &in, ossimByteOrder byteOrder)
Method to parse the record.
RPF replace/update section subheader record.
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23