OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRpfFrameFileIndexSubsection.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: ossimRpfFrameFileIndexSubsection.cpp 16997 2010-04-12 18:53:48Z dburken $
11 
12 #include <cstring> /* for memset */
13 #include <istream>
14 #include <iterator>
15 #include <ostream>
17 #include <ossim/base/ossimEndian.h>
20 
22 {
23  return data.print(out);
24 }
25 
27  :
28  m_indexTable(0),
29  m_pathnameTable(0)
30 {
31 }
32 
35  :
36  m_indexTable(obj.m_indexTable),
37  m_pathnameTable(obj.m_pathnameTable)
38 {
39 }
40 
43 {
44  if ( this != &rhs )
45  {
48  }
49  return *this;
50 }
51 
53 {
54 }
55 
58 {
60 
61  if(in && (m_indexTable.size()>0))
62  {
63  ossim_uint32 index;
64  for(index = 0;
65  (index < m_indexTable.size()) && (result == ossimErrorCodes::OSSIM_OK);
66  ++index)
67  {
68  result = m_indexTable[index].parseStream(in, byteOrder);
69  }
70  for(index = 0;
71  (index < m_pathnameTable.size()) && (result ==ossimErrorCodes::OSSIM_OK);
72  ++index)
73  {
74  result = m_pathnameTable[index].parseStream(in, byteOrder);
75  }
76  }
77  else
78  {
80  }
81 
82  return result;
83 }
84 
86 {
87  std::vector<ossimRpfFrameFileIndexRecord>::iterator indexIter = m_indexTable.begin();
88  while ( indexIter != m_indexTable.end() )
89  {
90  (*indexIter).writeStream(out);
91  ++indexIter;
92  }
93 
94  std::vector<ossimRpfPathnameRecord>::iterator pathIter = m_pathnameTable.begin();
95  while ( pathIter != m_pathnameTable.end() )
96  {
97  (*pathIter).writeStream(out);
98  ++pathIter;
99  }
100 }
101 
103 {
104  m_indexTable.clear();
105  m_pathnameTable.clear();
106 }
107 
109 {
110  copy(m_indexTable.begin(),
111  m_indexTable.end(),
112  std::ostream_iterator<ossimRpfFrameFileIndexRecord>(out, "\n"));
113  copy(m_pathnameTable.begin(),
114  m_pathnameTable.end(),
115  std::ostream_iterator<ossimRpfPathnameRecord>(out, "\n"));
116  return out;
117 }
118 
120  ossim_uint32 numberOfIndexRecords)
121 {
122  m_indexTable.resize(numberOfIndexRecords);
123 }
124 
126 {
127  m_pathnameTable.resize(numberOfPathnames);
128 }
129 
130 const std::vector<ossimRpfFrameFileIndexRecord>&
132 {
133  return m_indexTable;
134 }
135 
136 const std::vector<ossimRpfPathnameRecord>&
138 {
139  return m_pathnameTable;
140 }
141 
143  const ossimFilename& file, ossimRpfFrameFileIndexRecord& record) const
144 {
145  bool result = false;
146  std::vector<ossimRpfFrameFileIndexRecord>::const_iterator i = m_indexTable.begin();
147  while ( i != m_indexTable.end() )
148  {
149  if ( (*i).getFilename() == file )
150  {
151  record = (*i);
152  result = true;
153  break;
154  }
155  ++i;
156  }
157  return result;
158 }
ossim_int32 ossimErrorCode
std::ostream & operator<<(std::ostream &out, const ossimRpfFrameFileIndexSubsection &data)
bool getFrameFileIndexRecordFromFile(const ossimFilename &file, ossimRpfFrameFileIndexRecord &record) const
Gets the record matching file.
static const ossimErrorCode OSSIM_OK
ossimErrorCode parseStream(std::istream &in, ossimByteOrder byteOrder)
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
static const ossimErrorCode OSSIM_ERROR
const ossimRpfFrameFileIndexSubsection & operator=(const ossimRpfFrameFileIndexSubsection &rhs)
assignment operator
std::vector< ossimRpfPathnameRecord > m_pathnameTable
void setNumberOfFileIndexRecords(ossim_uint32 numberOfIndexRecords)
const std::vector< ossimRpfPathnameRecord > & getPathnameTable() const
std::vector< ossimRpfFrameFileIndexRecord > m_indexTable
unsigned int ossim_uint32
ossimByteOrder
const std::vector< ossimRpfFrameFileIndexRecord > & getIndexTable() const
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
std::ostream & print(std::ostream &out) const
void writeStream(std::ostream &out)
Write method.
void setNumberOfPathnames(ossim_uint32 numberOfPathnames)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23