OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRpfColorConverterSubsection.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: MIT
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: Garrett Potts
8 //
9 //********************************************************************
10 // $Id$
11 
14 #include <ossim/base/ossimEndian.h>
17 #include <iterator>
18 
21 {
22  data.print(out);
23  return out;
24 }
25 
27 {
29  clearFields();
30 }
31 
33 {
37 
38  theTableList.clear();
39 }
40 
42 {
43  std::vector<ossimRpfColorConverterTable>::const_iterator listElement = theTableList.begin();
44 
45  while(listElement != theTableList.end())
46  {
47  if((*listElement).getNumberOfEntries() == givenThisNumberOfEntires)
48  {
49  return &(*listElement);
50  }
51  }
52 
53  return NULL;
54 }
55 
58 {
59  if(in)
60  {
61  clearFields();
62 
63  // this is the start of the subsection
64  theStartOffset = in.tellg();
65  in.read((char*)&theColorConverterOffsetTableOffset, 4);
66  in.read((char*)&theColorConverterOffsetRecordLength, 2);
67  in.read((char*)&theConverterRecordLength, 2);
68 
69  // this grabs the end of the subsection
70  theEndOffset = in.tellg();
71 
72  ossimEndian anEndian;
73 
74  if(anEndian.getSystemEndianType() != byteOrder)
75  {
79 
80  }
82  for(unsigned long index = 0;
84  ++index)
85  {
87 
88  if(recordInfo.parseStream(in, byteOrder) ==
90  {
91  unsigned long rememberGet = in.tellg();
92 
93  theTableList[index].setNumberOfEntries(recordInfo.theNumberOfColorConverterRecords);
94  theTableList[index].setTableId(recordInfo.theColorConverterTableId);
95  in.seekg(theStartOffset + recordInfo.theColorConverterTableOffset, std::ios_base::beg);
96  theTableList[index].parseStream(in, byteOrder);
97 
98  in.seekg(rememberGet, std::ios_base::beg);
99  }
100  else
101  {
103  }
104  }
105  }
106  else
107  {
109  }
110 
112 }
113 
115 {
116  theNumberOfColorConverterOffsetRecords = numberOfRecords;
117 }
118 
120 {
121  out << "theColorConverterOffsetTableOffset: "
123  << "\ntheColorConverterOffsetRecordLength: "
125  << "\ntheConverterRecordLength: "
126  << theConverterRecordLength << "\n";
127 
128  copy(theTableList.begin(),
129  theTableList.end(),
130  std::ostream_iterator<ossimRpfColorConverterTable>(out, "\n"));
131 }
ossimErrorCode parseStream(ossim::istream &in, ossimByteOrder byteOrder)
ossim_int32 ossimErrorCode
static const ossimErrorCode OSSIM_OK
ossimErrorCode parseStream(ossim::istream &in, ossimByteOrder byteOrder)
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
static const ossimErrorCode OSSIM_ERROR
unsigned short ossim_uint16
const std::vector< ossimRpfColorConverterTable > & getColorConversionTable() const
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::vector< ossimRpfColorConverterTable > theTableList
void setNumberOfColorConverterOffsetRecords(ossim_uint16 numberOfRecords)
std::ostream & operator<<(std::ostream &out, const ossimRpfColorConverterSubsection &data)
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23