OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRpfFrameFileReader.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: ossimRpfFrameFileReader.cpp 19682 2011-05-31 14:21:20Z dburken $
11 
17 #include <fstream>
18 #include <ostream>
19 
21 {
22  return data.print(out);
23 }
24 
26  :theRpfHeader(0),
27  theFilename("")
28 {
29 }
30 
32 {
33  theRpfHeader = 0;
34 }
35 
37 {
38  std::ifstream in(fileName.c_str(), ios::in | ios::binary);
40 
41  if(!in)
42  {
44  }
45  clearAll();
46  nitfFile->parseFile(fileName);
47  const ossimRefPtr<ossimNitfFileHeader> nitfFileHeader =
48  nitfFile->getHeader();
49  if(!nitfFileHeader)
50  {
51  nitfFile = 0;
53  }
54 
56  nitfFileHeader->getTag(info, "RPFHDR");
57  // we no longer need access to the nitf header. We got what we needed
58  nitfFile = 0;
59  theFilename = fileName;
60  if(info.getTagName() == "RPFHDR")
61  {
63 
64  // set the get pointer for the stream to the start
65  // of the Rpf header data
66  in.seekg(info.getTagDataOffset());
67 
68  // now get the header data. We do not need to pass in the byte order.
69  // this is grabbed from the first byte of the stream. To see this,
70  // Look at the RpfHeader implementation.
71  theRpfHeader->parseStream(in); // ==ossimErrorCodes::OSSIM_OK)
72  if ( in.fail() )
73  {
74  theRpfHeader = 0;
75  }
76  }
77  else
78  {
80  }
81 
82  if( !theRpfHeader.valid() )
83  {
85  }
86 
88 }
89 
91 {
92  if( theRpfHeader.valid() )
93  {
94  theRpfHeader->print(out, std::string(""));
95  }
96  return out;
97 }
98 
100 {
101  return theRpfHeader.get();
102 }
103 
105 {
106  theRpfHeader = 0;
107  theFilename = "";
108 }
ossim_int32 ossimErrorCode
std::ostream & print(std::ostream &out) const
static const ossimErrorCode OSSIM_OK
std::basic_ifstream< char > ifstream
Class for char input file streams.
Definition: ossimIosFwd.h:44
bool valid() const
Definition: ossimRefPtr.h:75
ossim_uint64 getTagDataOffset() const
static const ossimErrorCode OSSIM_ERROR
ossimErrorCode parseFile(const ossimFilename &fileName)
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.
ossimRefPtr< ossimRpfHeader > theRpfHeader
virtual bool getTag(ossimNitfTagInformation &tagInfo, const ossimString &tagName) const
virtual void parseStream(std::istream &in)
Parse method.
const ossimRpfHeader * getRpfHeader() const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
std::ostream & operator<<(std::ostream &out, const ossimRpfFrameFileReader &data)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23