OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRpfFrameFileIndexRecord.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: ossimRpfFrameFileIndexRecord.cpp 17501 2010-06-02 11:14:55Z dburken $
11 
12 #include <cstring> /* for memset, memcpy */
13 #include <istream>
14 #include <ostream>
15 
17 #include <ossim/base/ossimEndian.h>
19 
21 {
22  return data.print(out);
23 }
24 
26  :
27  m_boundaryRectRecordNumber(0),
28  m_locationRowNumber(0),
29  m_locationColumnNumber(0),
30  m_pathnameRecordOffset(0)
31 {
32  clearFields();
33 }
34 
36  :
37  m_boundaryRectRecordNumber(obj.m_boundaryRectRecordNumber),
38  m_locationRowNumber(obj.m_locationRowNumber),
39  m_locationColumnNumber(obj.m_locationColumnNumber),
40  m_pathnameRecordOffset(obj.m_pathnameRecordOffset),
41  m_securityClassification(obj.m_securityClassification)
42 {
43  memcpy(m_filename, obj.m_filename, 13);
47 }
48 
51 {
52  if ( this != &rhs )
53  {
59 
60  memcpy(m_filename, rhs.m_filename, 13);
64  }
65  return *this;
66 }
67 
70 {
71  if(in)
72  {
73  ossimEndian anEndian;
74 
75  clearFields();
76 
77  in.read((char*)&m_boundaryRectRecordNumber, 2);
78  in.read((char*)&m_locationRowNumber, 2);
79  in.read((char*)&m_locationColumnNumber, 2);
80  in.read((char*)&m_pathnameRecordOffset, 4);
81  in.read((char*)m_filename, 12);
82  in.read((char*)m_geographicLocation, 6);
83  in.read((char*)&m_securityClassification, 1);
84  in.read((char*)m_fileSecurityCountryCode, 2);
85  in.read((char*)m_fileSecurityReleaseMarking, 2);
86 
87  if(anEndian.getSystemEndianType() != byteOrder)
88  {
90  anEndian.swap(m_locationRowNumber);
91  anEndian.swap(m_locationColumnNumber);
92  anEndian.swap(m_pathnameRecordOffset);
93  }
94  }
95  else
96  {
98  }
99 
101 }
102 
104 {
105  ossimEndian anEndian;
106 
107  if( anEndian.getSystemEndianType() != OSSIM_BIG_ENDIAN )
108  {
109  // Always write out big endian.
111  anEndian.swap(m_locationRowNumber);
112  anEndian.swap(m_locationColumnNumber);
113  anEndian.swap(m_pathnameRecordOffset);
114  }
115 
116  out.write((char*)&m_boundaryRectRecordNumber, 2);
117  out.write((char*)&m_locationRowNumber, 2);
118  out.write((char*)&m_locationColumnNumber, 2);
119  out.write((char*)&m_pathnameRecordOffset, 4);
120  out.write((char*)m_filename, 12);
121  out.write((char*)m_geographicLocation, 6);
122  out.write((char*)&m_securityClassification, 1);
123  out.write((char*)m_fileSecurityCountryCode, 2);
124  out.write((char*)m_fileSecurityReleaseMarking, 2);
125 
126  if( anEndian.getSystemEndianType() != OSSIM_BIG_ENDIAN )
127  {
128  // Swap back to native.
130  anEndian.swap(m_locationRowNumber);
131  anEndian.swap(m_locationColumnNumber);
132  anEndian.swap(m_pathnameRecordOffset);
133  }
134 }
135 
137 {
138  out << "BoundaryRectRecordNumber: " << m_boundaryRectRecordNumber
139  << "\nLocationRowNumber: " << m_locationRowNumber
140  << "\nLocationColumnNumber: " << m_locationColumnNumber
141  << "\nPathnameRecordOffset: " << m_pathnameRecordOffset
142  << "\nFilename: " << m_filename
143  << "\nGeographicLocation: " << m_geographicLocation
144  << "\nSecurityClassification: " << m_securityClassification
145  << "\nFileSecurityCountryCode: " << m_fileSecurityCountryCode
146  << "\nFileSecurityReleaseMarking: " << m_fileSecurityReleaseMarking
147  << std::endl;
148  return out;
149 }
150 
152 {
154 }
155 
157 {
158  return m_locationRowNumber;
159 }
160 
162 {
163  return m_locationColumnNumber;
164 }
165 
167 {
168  return m_pathnameRecordOffset;
169 }
170 
172 {
173  return ossimFilename(m_filename);
174 }
175 
177 {
179 }
180 
182 {
183  m_pathnameRecordOffset = offset;
184 }
185 
187 {
192  memset(m_filename, ' ', 12);
193  memset(m_geographicLocation, ' ', 6);
195  memset(m_fileSecurityCountryCode, ' ', 2);
196  memset(m_fileSecurityReleaseMarking, ' ', 2);
197 
198  m_filename[12] = '\0';
199  m_geographicLocation[6] = '\0';
200  m_fileSecurityCountryCode[2] = '\0';
202 }
ossim_int32 ossimErrorCode
std::ostream & print(std::ostream &out) const
static const ossimErrorCode OSSIM_OK
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
static const ossimErrorCode OSSIM_ERROR
unsigned short ossim_uint16
ossimErrorCode parseStream(std::istream &in, ossimByteOrder byteOrder)
std::ostream & operator<<(std::ostream &out, const ossimRpfFrameFileIndexRecord &data)
void setPathnameRecordOffset(ossim_uint32 offset)
void writeStream(std::ostream &out)
Write method.
unsigned int ossim_uint32
const ossimRpfFrameFileIndexRecord & operator=(const ossimRpfFrameFileIndexRecord &rhs)
assignment operator
ossimByteOrder
void setBoundaryRecNumber(ossim_uint16 entry)
Sets the zero based entry number.
ossimByteOrder getSystemEndianType() const
Definition: ossimEndian.h:78
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
ossimRpfFrameFileIndexRecord()
default constructor
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23