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

#include <ossimRpfLocationSection.h>

Public Member Functions

 ossimRpfLocationSection ()
 
virtual ~ossimRpfLocationSection ()
 
virtual ossimErrorCode parseStream (std::istream &in, ossimByteOrder endianOrder)
 
void writeStream (std::ostream &out)
 Write method. More...
 
std::ostream & print (std::ostream &out, const std::string &prefix=std::string()) const
 print method that outputs a key/value type format adding prefix to keys. More...
 
bool hasComponent (ossimRpfComponentId componentId) const
 
bool getComponent (ossimRpfComponentId componentId, ossimRpfComponentLocationRecord &result) const
 
void addComponentRecord (const ossimRpfComponentLocationRecord &record)
 Method to add a component location record. More...
 
void setLocationSectionLength (ossim_uint16 length)
 
void setLocationTableOffset (ossim_uint32 offset)
 
void setNumberOfComponentLocationRecords (ossim_uint16 count)
 
void setLocationRecordLength (ossim_uint16 length)
 
void setComponentAggregateLength (ossim_uint32 length)
 
void clearFields ()
 Clears records and fields. More...
 
std::vector< ossimRpfComponentLocationRecord > & getLocationRecordList ()
 Brief Direct access to the list of records. More...
 

Private Attributes

ossim_uint16 m_locationSectionLength
 
ossim_uint32 m_locationTableOffset
 
ossim_uint16 m_numberOfComponentLocationRecords
 
ossim_uint16 m_locationRecordLength
 
ossim_uint32 m_componentAggregateLength
 
std::vector< ossimRpfComponentLocationRecordm_componentLocationList
 

Friends

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

Detailed Description

Definition at line 81 of file ossimRpfLocationSection.h.

Constructor & Destructor Documentation

◆ ossimRpfLocationSection()

ossimRpfLocationSection::ossimRpfLocationSection ( )

Definition at line 127 of file ossimRpfLocationSection.cpp.

References clearFields().

128 {
129  clearFields();
130 }
void clearFields()
Clears records and fields.

◆ ~ossimRpfLocationSection()

virtual ossimRpfLocationSection::~ossimRpfLocationSection ( )
inlinevirtual

Definition at line 87 of file ossimRpfLocationSection.h.

87 {}

Member Function Documentation

◆ addComponentRecord()

void ossimRpfLocationSection::addComponentRecord ( const ossimRpfComponentLocationRecord record)

Method to add a component location record.

This will push the record onto the back of theComponentLocationList array.

Parameters
recordRecord to add to array.

Definition at line 271 of file ossimRpfLocationSection.cpp.

References m_componentLocationList.

272 {
273  m_componentLocationList.push_back(record);
274 }
std::vector< ossimRpfComponentLocationRecord > m_componentLocationList

◆ clearFields()

void ossimRpfLocationSection::clearFields ( )

Clears records and fields.

Public interface to clearFields.

Definition at line 301 of file ossimRpfLocationSection.cpp.

References m_componentAggregateLength, m_componentLocationList, m_locationRecordLength, m_locationSectionLength, m_locationTableOffset, and m_numberOfComponentLocationRecords.

Referenced by ossimRpfLocationSection(), and parseStream().

302 {
308 
309  m_componentLocationList.clear();
310 }
std::vector< ossimRpfComponentLocationRecord > m_componentLocationList
ossim_uint16 m_numberOfComponentLocationRecords

◆ getComponent()

bool ossimRpfLocationSection::getComponent ( ossimRpfComponentId  componentId,
ossimRpfComponentLocationRecord result 
) const

◆ getLocationRecordList()

std::vector< ossimRpfComponentLocationRecord > & ossimRpfLocationSection::getLocationRecordList ( )

Brief Direct access to the list of records.

Definition at line 312 of file ossimRpfLocationSection.cpp.

References m_componentLocationList.

313 {
315 }
std::vector< ossimRpfComponentLocationRecord > m_componentLocationList

◆ hasComponent()

bool ossimRpfLocationSection::hasComponent ( ossimRpfComponentId  componentId) const

Will let you know if a component exists within the location section. these component Ids' are defined in the MIL-STD-2411-1 standards doc. the ossimRpfComponentId is in ossimRpfConstants.h

Definition at line 244 of file ossimRpfLocationSection.cpp.

References getComponent().

Referenced by ossimRpfHeader::hasComponent(), and ossimRpfFrame::populateReplaceUpdateTable().

245 {
247 
248  return getComponent(componentId, result);
249 }
bool getComponent(ossimRpfComponentId componentId, ossimRpfComponentLocationRecord &result) const

◆ parseStream()

ossimErrorCode ossimRpfLocationSection::parseStream ( std::istream &  in,
ossimByteOrder  endianOrder 
)
virtual

Definition at line 132 of file ossimRpfLocationSection.cpp.

References ossim::byteOrder(), clearFields(), m_componentAggregateLength, m_locationRecordLength, m_locationSectionLength, m_locationTableOffset, m_numberOfComponentLocationRecords, ossimErrorCodes::OSSIM_OK, and ossimEndian::swap().

Referenced by ossimRpfHeader::parseStream().

134 {
136 
137  if(in)
138  {
139  clearFields();
140 
141  in.read((char*)&m_locationSectionLength, 2);
142  in.read((char*)&m_locationTableOffset, 4);
143  in.read((char*)&m_numberOfComponentLocationRecords, 2);
144  in.read((char*)&m_locationRecordLength, 2);
145  in.read((char*)&m_componentAggregateLength, 4);
146 
147  if( ossim::byteOrder() != byteOrder )
148  {
149  ossimEndian anEndian;
150  anEndian.swap(m_locationSectionLength);
151  anEndian.swap(m_locationTableOffset);
153  anEndian.swap(m_locationRecordLength);
155  }
156 
157  if(traceDebug())
158  {
160  ossimNotify(ossimNotifyLevel_DEBUG) << std::endl;
161  }
162 
164  for(ossim_uint32 index = 0;
165  (index < m_componentLocationList.size())&&
166  (result == ossimErrorCodes::OSSIM_OK);
167  ++index)
168  {
169  result = m_componentLocationList[index].parseStream(in, byteOrder);
170  }
171  }
172  else
173  {
175  }
176 
177  return result;
178 }
ossim_int32 ossimErrorCode
static const ossimErrorCode OSSIM_OK
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
static const ossimErrorCode OSSIM_ERROR
std::vector< ossimRpfComponentLocationRecord > m_componentLocationList
unsigned int ossim_uint32
std::ostream & print(std::ostream &out, const std::string &prefix=std::string()) const
print method that outputs a key/value type format adding prefix to keys.
ossim_uint16 m_numberOfComponentLocationRecords
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void clearFields()
Clears records and fields.

◆ print()

std::ostream & ossimRpfLocationSection::print ( std::ostream &  out,
const std::string &  prefix = std::string() 
) const

print method that outputs a key/value type format adding prefix to keys.

Parameters
outString to output to.
prefixThis will be prepended to key. e.g. Where prefix = "nitf." and key is "file_name" key becomes: "nitf.file_name:"
Returns
output stream.

Definition at line 217 of file ossimRpfLocationSection.cpp.

References m_componentAggregateLength, m_componentLocationList, m_locationRecordLength, m_locationSectionLength, m_locationTableOffset, and m_numberOfComponentLocationRecords.

Referenced by operator<<().

219 {
220  out << prefix << "LocationSectionLength: "
221  << m_locationSectionLength << "\n"
222  << prefix << "LocationTableOffset: "
223  << m_locationTableOffset << "\n"
224  << prefix << "NumberOfComponentLocationRecords: "
226  << prefix << "LocationRecordLength: "
227  << m_locationRecordLength << "\n"
228  << prefix << "ComponentAggregateLength: "
229  << m_componentAggregateLength << "\n";
230 
232  {
233  std::vector<ossimRpfComponentLocationRecord>::const_iterator i =
234  m_componentLocationList.begin();
235  while (i != m_componentLocationList.end())
236  {
237  (*i).print(out, prefix);
238  ++i;
239  }
240  }
241  return out;
242 }
std::vector< ossimRpfComponentLocationRecord > m_componentLocationList
ossim_uint16 m_numberOfComponentLocationRecords

◆ setComponentAggregateLength()

void ossimRpfLocationSection::setComponentAggregateLength ( ossim_uint32  length)

Definition at line 296 of file ossimRpfLocationSection.cpp.

References m_componentAggregateLength.

297 {
299 }

◆ setLocationRecordLength()

void ossimRpfLocationSection::setLocationRecordLength ( ossim_uint16  length)

Definition at line 291 of file ossimRpfLocationSection.cpp.

References m_locationRecordLength.

292 {
293  m_locationRecordLength = length;
294 }

◆ setLocationSectionLength()

void ossimRpfLocationSection::setLocationSectionLength ( ossim_uint16  length)

Definition at line 276 of file ossimRpfLocationSection.cpp.

References m_locationSectionLength.

277 {
278  m_locationSectionLength = length;
279 }

◆ setLocationTableOffset()

void ossimRpfLocationSection::setLocationTableOffset ( ossim_uint32  offset)

Definition at line 281 of file ossimRpfLocationSection.cpp.

References m_locationTableOffset.

282 {
283  m_locationTableOffset = offset;
284 }

◆ setNumberOfComponentLocationRecords()

void ossimRpfLocationSection::setNumberOfComponentLocationRecords ( ossim_uint16  count)

Definition at line 286 of file ossimRpfLocationSection.cpp.

References m_numberOfComponentLocationRecords.

287 {
289 }
ossim_uint16 m_numberOfComponentLocationRecords

◆ writeStream()

void ossimRpfLocationSection::writeStream ( std::ostream &  out)

Write method.

Parameters
outStream to write to.

Definition at line 181 of file ossimRpfLocationSection.cpp.

References ossim::byteOrder(), m_componentAggregateLength, m_componentLocationList, m_locationRecordLength, m_locationSectionLength, m_locationTableOffset, m_numberOfComponentLocationRecords, OSSIM_BIG_ENDIAN, and ossimEndian::swap().

Referenced by ossimRpfHeader::writeStream().

182 {
184  {
185  // Always write in big endian.
186  ossimEndian endian;
188  endian.swap(m_locationTableOffset);
192  }
193 
194  out.write((char*)&m_locationSectionLength, 2);
195  out.write((char*)&m_locationTableOffset, 4);
196  out.write((char*)&m_numberOfComponentLocationRecords, 2);
197  out.write((char*)&m_locationRecordLength, 2);
198  out.write((char*)&m_componentAggregateLength, 4);
199 
201  {
202  // Swap back to native byte order.
203  ossimEndian endian;
205  endian.swap(m_locationTableOffset);
209  }
210 
211  for(ossim_uint32 i = 0; i < m_componentLocationList.size(); ++i)
212  {
213  m_componentLocationList[i].writeStream(out);
214  }
215 }
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
std::vector< ossimRpfComponentLocationRecord > m_componentLocationList
unsigned int ossim_uint32
ossim_uint16 m_numberOfComponentLocationRecords
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 72 of file ossimRpfLocationSection.cpp.

73 {
74  return data.print(out);
75 }
std::ostream & print(std::ostream &out, const std::string &prefix=std::string()) const
print method that outputs a key/value type format adding prefix to keys.

Member Data Documentation

◆ m_componentAggregateLength

ossim_uint32 ossimRpfLocationSection::m_componentAggregateLength
private

◆ m_componentLocationList

std::vector<ossimRpfComponentLocationRecord> ossimRpfLocationSection::m_componentLocationList
private

Since there are not very many components within an Rpf file it would be overkill to sort these components into an stl map. We will just use an array (stl vector) and do linear searches for components when we need to.

Definition at line 164 of file ossimRpfLocationSection.h.

Referenced by addComponentRecord(), clearFields(), getComponent(), getLocationRecordList(), print(), and writeStream().

◆ m_locationRecordLength

ossim_uint16 ossimRpfLocationSection::m_locationRecordLength
private

◆ m_locationSectionLength

ossim_uint16 ossimRpfLocationSection::m_locationSectionLength
private

This is a 2 byte unsigned short >= 34 indicatin the length in bytes of the entire location section

Definition at line 148 of file ossimRpfLocationSection.h.

Referenced by clearFields(), parseStream(), print(), setLocationSectionLength(), and writeStream().

◆ m_locationTableOffset

ossim_uint32 ossimRpfLocationSection::m_locationTableOffset
private

◆ m_numberOfComponentLocationRecords

ossim_uint16 ossimRpfLocationSection::m_numberOfComponentLocationRecords
private

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