OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ossimRpfCompressionSection Class Reference

#include <ossimRpfCompressionSection.h>

Public Member Functions

 ossimRpfCompressionSection ()
 
virtual ~ossimRpfCompressionSection ()
 
ossimErrorCode parseStream (ossim::istream &in, ossimByteOrder byteOrder)
 
void print (std::ostream &out) const
 
const std::vector< ossimRpfCompressionOffsetTableData > & getTable () const
 
const ossimRpfCompressionSectionSubheadergetSubheader () const
 

Private Member Functions

void clearTable ()
 

Private Attributes

ossimRpfCompressionSectionSubheadertheSubheader
 
ossim_uint32 theCompressionLookupOffsetTableOffset
 
ossim_uint16 theCompressionLookupTableOffsetRecordLength
 
std::vector< ossimRpfCompressionOffsetTableDatatheTable
 

Friends

std::ostream & operator<< (std::ostream &out, const ossimRpfCompressionSection &data)
 

Detailed Description

Definition at line 27 of file ossimRpfCompressionSection.h.

Constructor & Destructor Documentation

◆ ossimRpfCompressionSection()

ossimRpfCompressionSection::ossimRpfCompressionSection ( )

◆ ~ossimRpfCompressionSection()

ossimRpfCompressionSection::~ossimRpfCompressionSection ( )
virtual

Definition at line 108 of file ossimRpfCompressionSection.cpp.

References theSubheader.

109 {
110  if(theSubheader)
111  {
112  delete theSubheader;
113  theSubheader = NULL;
114  }
115 }
ossimRpfCompressionSectionSubheader * theSubheader

Member Function Documentation

◆ clearTable()

void ossimRpfCompressionSection::clearTable ( )
private

◆ getSubheader()

const ossimRpfCompressionSectionSubheader* ossimRpfCompressionSection::getSubheader ( ) const
inline

Definition at line 41 of file ossimRpfCompressionSection.h.

References theSubheader.

42  {
43  return theSubheader;
44  }
ossimRpfCompressionSectionSubheader * theSubheader

◆ getTable()

const std::vector<ossimRpfCompressionOffsetTableData>& ossimRpfCompressionSection::getTable ( ) const
inline

◆ parseStream()

ossimErrorCode ossimRpfCompressionSection::parseStream ( ossim::istream in,
ossimByteOrder  byteOrder 
)

Definition at line 117 of file ossimRpfCompressionSection.cpp.

References ossim::byteOrder(), ossimRpfCompressionLookupOffsetRecord::getCompressionLookupTableId(), ossimRpfCompressionLookupOffsetRecord::getCompressionLookupTableOffset(), ossimRpfCompressionLookupOffsetRecord::getCompressionLookupValueBitLength(), ossimRpfCompressionSectionSubheader::getEndOffset(), ossimRpfCompressionSectionSubheader::getNumberOfCompressionLookupOffsetRecords(), ossimRpfCompressionLookupOffsetRecord::getNumberOfCompressionLookupRecords(), ossimRpfCompressionLookupOffsetRecord::getNumberOfValuesPerCompressionLookupRecord(), ossimEndian::getSystemEndianType(), ossimErrorCodes::OSSIM_ERROR, ossimErrorCodes::OSSIM_OK, ossimRpfCompressionLookupOffsetRecord::parseStream(), ossimRpfCompressionSectionSubheader::parseStream(), size, ossimEndian::swap(), theCompressionLookupOffsetTableOffset, theCompressionLookupTableOffsetRecordLength, theSubheader, and theTable.

Referenced by ossimRpfHeader::getNewCompressionSection().

119 {
121 
122  if(in&&theSubheader)
123  {
124  result = theSubheader->parseStream(in, byteOrder);
125 
126  if(result == ossimErrorCodes::OSSIM_OK)
127  {
128  ossimEndian anEndian;
130 
131  in.read((char*)&theCompressionLookupOffsetTableOffset, 4);
133 
134  if(byteOrder != anEndian.getSystemEndianType())
135  {
138  }
139 
141  {
142  // clear the table
143  theTable.clear();
144 
145  // resize it
147 
148  // now populate it
149  for(long index = 0;
151  ++index)
152  {
153  record.parseStream(in, byteOrder);
154  unsigned long rememberLocation = in.tellg();
155  in.seekg(record.getCompressionLookupTableOffset()+
156  theSubheader->getEndOffset(), std::ios_base::beg);
157 
158  theTable[index].theTableId = record.getCompressionLookupTableId();
159  theTable[index].theNumberOfLookupValues = record.getNumberOfCompressionLookupRecords();
160  theTable[index].theCompressionLookupValueBitLength = record.getCompressionLookupValueBitLength();
161  theTable[index].theNumberOfValuesPerLookup = record.getNumberOfValuesPerCompressionLookupRecord();
162 
163  // store the information about this compress/decompress algorithm
164  // I am not sure but I will assume that the bit length can be
165  // arbitrary. In other words if someone says that the bit length of
166  // the lookup value is 12 this should be handled ok.
167  //
168  unsigned long size = (theTable[index].theNumberOfValuesPerLookup*
169  theTable[index].theNumberOfLookupValues*
170  theTable[index].theCompressionLookupValueBitLength)/8;
171 
172  theTable[index].theData = new unsigned char[size];
173 
174  in.read( (char*)theTable[index].theData, size);
175 
176  in.seekg(rememberLocation, std::ios_base::beg);
177  }
178  }
179  }
180  }
181  else
182  {
184  }
185 
186  return result;
187 }
ossim_int32 ossimErrorCode
static const ossimErrorCode OSSIM_OK
ossimRpfCompressionSectionSubheader * theSubheader
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
static const ossimErrorCode OSSIM_ERROR
std::vector< ossimRpfCompressionOffsetTableData > theTable
ossimErrorCode parseStream(ossim::istream &in, ossimByteOrder byteOrder)
yy_size_t size
ossimErrorCode parseStream(ossim::istream &in, ossimByteOrder byteOrder)
ossimByteOrder getSystemEndianType() const
Definition: ossimEndian.h:78
ossim_uint16 theCompressionLookupTableOffsetRecordLength
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26

◆ print()

void ossimRpfCompressionSection::print ( std::ostream &  out) const

Definition at line 189 of file ossimRpfCompressionSection.cpp.

References theSubheader, and theTable.

Referenced by operator<<().

190 {
191  if(theSubheader)
192  {
193  out << *theSubheader << "\n";
194  copy(theTable.begin(),
195  theTable.end(),
196  std::ostream_iterator<ossimRpfCompressionOffsetTableData>(out, "\n"));
197  }
198 }
ossimRpfCompressionSectionSubheader * theSubheader
std::vector< ossimRpfCompressionOffsetTableData > theTable

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const ossimRpfCompressionSection data 
)
friend

Definition at line 95 of file ossimRpfCompressionSection.cpp.

97 {
98  data.print(out);
99  return out;
100 }
void print(std::ostream &out) const

Member Data Documentation

◆ theCompressionLookupOffsetTableOffset

ossim_uint32 ossimRpfCompressionSection::theCompressionLookupOffsetTableOffset
private

Definition at line 50 of file ossimRpfCompressionSection.h.

Referenced by parseStream().

◆ theCompressionLookupTableOffsetRecordLength

ossim_uint16 ossimRpfCompressionSection::theCompressionLookupTableOffsetRecordLength
private

Definition at line 51 of file ossimRpfCompressionSection.h.

Referenced by parseStream().

◆ theSubheader

ossimRpfCompressionSectionSubheader* ossimRpfCompressionSection::theSubheader
private

◆ theTable

std::vector<ossimRpfCompressionOffsetTableData> ossimRpfCompressionSection::theTable
private

Definition at line 53 of file ossimRpfCompressionSection.h.

Referenced by getTable(), parseStream(), and print().


The documentation for this class was generated from the following files: