OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRpfFrameFileIndexSectionSubheader.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts
6 //
7 // Description: Rpf support class
8 //
9 //********************************************************************
10 // $Id: ossimRpfFrameFileIndexSectionSubheader.cpp 16997 2010-04-12 18:53:48Z dburken $
11 
12 #include <istream>
13 #include <ostream>
14 
16 #include <ossim/base/ossimCommon.h> /* ossim::byteOrder() */
17 #include <ossim/base/ossimEndian.h>
18 #include <ossim/base/ossimTrace.h>
19 
20 // Static trace for debugging
21 static ossimTrace traceDebug("ossimRpfFrameFileIndexSectionSubheader:debug");
22 
24 {
25  return data.print(out);
26 }
27 
29  :
30  m_highestSecurityClassification(' '),
31  m_indexTableOffset(0),
32  m_numberOfIndexRecords(0),
33  m_numberOfPathnameRecords(0),
34  m_indexRecordLength(0)
35 {
36 }
37 
40  :
41  m_highestSecurityClassification(obj.m_highestSecurityClassification),
42  m_indexTableOffset(obj.m_indexTableOffset),
43  m_numberOfIndexRecords(obj.m_numberOfIndexRecords),
44  m_numberOfPathnameRecords(obj.m_numberOfPathnameRecords),
45  m_indexRecordLength(obj.m_indexRecordLength)
46 {
47 }
48 
51 {
52  if ( this != &rhs )
53  {
59  }
60  return *this;
61 }
62 
64 {
65 }
66 
69 {
70  if(in)
71  {
72  in.read((char*)&m_highestSecurityClassification, 1);
73  in.read((char*)&m_indexTableOffset, 4);
74  in.read((char*)&m_numberOfIndexRecords, 4);
75  in.read((char*)&m_numberOfPathnameRecords, 2);
76  in.read((char*)&m_indexRecordLength, 2);
77 
78  if( ossim::byteOrder() != byteOrder )
79  {
80  ossimEndian anEndian;
81  anEndian.swap(m_indexTableOffset);
82  anEndian.swap(m_numberOfIndexRecords);
84  anEndian.swap(m_indexRecordLength);
85  }
86  }
87  else
88  {
90  }
91 
92  if ( traceDebug() )
93  {
95  }
96 
98 }
99 
101 {
103  {
104  // Swap to big endian.
105  ossimEndian anEndian;
106  anEndian.swap(m_indexTableOffset);
107  anEndian.swap(m_numberOfIndexRecords);
109  anEndian.swap(m_indexRecordLength);
110  }
111 
112  out.write((char*)&m_highestSecurityClassification, 1);
113  out.write((char*)&m_indexTableOffset, 4);
114  out.write((char*)&m_numberOfIndexRecords, 4);
115  out.write((char*)&m_numberOfPathnameRecords, 2);
116  out.write((char*)&m_indexRecordLength, 2);
117 
119  {
120  // Swap back to native byte order.
121  ossimEndian anEndian;
122  anEndian.swap(m_indexTableOffset);
123  anEndian.swap(m_numberOfIndexRecords);
125  anEndian.swap(m_indexRecordLength);
126  }
127 }
129 {
130  out << "ossimRpfFrameFileIndexSectionSubheader DEBUG:"
131  << "\nHighestSecurityClassification: " << m_highestSecurityClassification
132  << "\nIndexTableOffset: " << m_indexTableOffset
133  << "\nNumberOfIndexRecords: " << m_numberOfIndexRecords
134  << "\nNumberOfPathnameRecords: " << m_numberOfPathnameRecords
135  << "\nIndexRecordLength: " << m_indexRecordLength
136  << std::endl;
137 
138  return out;
139 }
140 
142 {
143  return m_indexTableOffset;
144 }
145 
147 {
148  return m_numberOfIndexRecords;
149 }
150 
152 {
154 }
155 
157 {
158  return m_indexRecordLength;
159 }
160 
162 {
163  m_numberOfIndexRecords = count;
164 }
165 
167 {
169 }
170 
172 {
173  m_indexRecordLength = length;
174 }
175 
177 {
179  m_indexTableOffset = 0;
183 }
ossim_int32 ossimErrorCode
static const ossimErrorCode OSSIM_OK
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
static const ossimErrorCode OSSIM_ERROR
std::ostream & operator<<(std::ostream &out, const ossimRpfFrameFileIndexSectionSubheader &data)
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
ossimByteOrder
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
ossimErrorCode parseStream(std::istream &in, ossimByteOrder byteOrder)
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
const ossimRpfFrameFileIndexSectionSubheader & operator=(const ossimRpfFrameFileIndexSectionSubheader &rhs)
assignment operator