OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRpfBoundaryRectSectionSubheader.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts (gpotts@imagelinks.com)
6 // Description: Rpf support class
7 //
8 //********************************************************************
9 // $Id: ossimRpfBoundaryRectSectionSubheader.cpp 16997 2010-04-12 18:53:48Z dburken $
10 
11 #include <istream>
12 #include <ostream>
13 
15 #include <ossim/base/ossimCommon.h> /* ossim::byteOrder() */
16 #include <ossim/base/ossimEndian.h>
18 
21 {
22  return data.print(out);
23 }
24 
26  :
27  m_rectangleTableOffset(0),
28  m_numberOfEntries(0),
29  m_lengthOfEachEntry(0)
30 {
31 }
32 
35  :
36  m_rectangleTableOffset(obj.m_rectangleTableOffset),
37  m_numberOfEntries(obj.m_numberOfEntries),
38  m_lengthOfEachEntry(obj.m_lengthOfEachEntry)
39 {
40 }
43 {
44  if ( this != &rhs )
45  {
49  }
50  return *this;
51 }
52 
54 {
55 }
56 
59 {
60  if(in)
61  {
62  clearFields();
63 
64  in.read((char*)&m_rectangleTableOffset, 4);
65  in.read((char*)&m_numberOfEntries, 2);
66  in.read((char*)&m_lengthOfEachEntry, 2);
67 
68  if( ossim::byteOrder() != byteOrder )
69  {
70  ossimEndian anEndian;
71  anEndian.swap(m_rectangleTableOffset);
72  anEndian.swap(m_numberOfEntries);
73  anEndian.swap(m_lengthOfEachEntry);
74  }
75  }
76  else
77  {
79  }
80 
82 }
83 
85 {
86  ossimEndian anEndian;
87 
88  if( anEndian.getSystemEndianType() != OSSIM_BIG_ENDIAN )
89  {
90  // Always write out big endian.
91  anEndian.swap(m_rectangleTableOffset);
92  anEndian.swap(m_numberOfEntries);
93  anEndian.swap(m_lengthOfEachEntry);
94  }
95 
96  out.write((char*)&m_rectangleTableOffset, 4);
97  out.write((char*)&m_numberOfEntries, 2);
98  out.write((char*)&m_lengthOfEachEntry, 2);
99 
100  if( anEndian.getSystemEndianType() != OSSIM_BIG_ENDIAN )
101  {
102  // Swap back to native.
103  anEndian.swap(m_rectangleTableOffset);
104  anEndian.swap(m_numberOfEntries);
105  anEndian.swap(m_lengthOfEachEntry);
106  }
107 }
108 
110 {
111  out << "RectangleTableOffset: " << m_rectangleTableOffset
112  << "\nNumberOfEntries: " << m_numberOfEntries
113  << "\nLengthOfEachEntry: " << m_lengthOfEachEntry << std::endl;
114  return out;
115 }
116 
118 {
119  return m_numberOfEntries;
120 }
121 
123 {
124  return m_rectangleTableOffset;
125 }
126 
128 {
129  return m_lengthOfEachEntry;
130 }
131 
133 {
134  m_numberOfEntries = entries;
135 }
136 
138 {
139  m_rectangleTableOffset = offset;
140 }
141 
143 {
144  m_lengthOfEachEntry = length;
145 }
146 
148 {
150  m_numberOfEntries = 0;
152 }
ossim_int32 ossimErrorCode
ossimErrorCode parseStream(std::istream &in, ossimByteOrder)
static const ossimErrorCode OSSIM_OK
const ossimRpfBoundaryRectSectionSubheader & operator=(const ossimRpfBoundaryRectSectionSubheader &rhs)
assignment operator
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
static const ossimErrorCode OSSIM_ERROR
unsigned short ossim_uint16
unsigned int ossim_uint32
ossimByteOrder
ossimByteOrder getSystemEndianType() const
Definition: ossimEndian.h:78
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
std::ostream & print(std::ostream &out) const
print method
std::ostream & operator<<(std::ostream &out, const ossimRpfBoundaryRectSectionSubheader &data)
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23