OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNadconGridHeader.cpp
Go to the documentation of this file.
1 //**************************************************************************
2 // Copyright (C) 2003 Storage Area Networks, Inc.
3 //
4 // Written by: Kenneth Melero <kmelero@sanz.com>
5 //
6 //**************************************************************************
7 
8 #include <fstream>
9 #include <iostream>
11 #include <ossim/base/ossimEndian.h>
12 
14 {
15  out << "theCols: " << rhs.theCols
16  << "\ntheRows: " << rhs.theRows
17  << "\ntheZ: " << rhs.theZ
18  << "\ntheMinX: " << rhs.theMinX
19  << "\ntheDx: " << rhs.theDx
20  << "\ntheMinY: " << rhs.theMinY
21  << "\ntheDy: " << rhs.theDy
22  << "\nBounds: " << rhs.getBoundingRect() << std::endl;
23  return out;
24 }
25 
27 {
28  std::ifstream in(file.c_str(), std::ios::in|std::ios::binary);
29 
30  if(in)
31  {
32  return readHeader(in);
33  }
34 
35  return false;
36 }
37 
39 {
40  in.read((char*)theCharBuf, 64);
41  in.read((char*)&theCols, 4);
42  in.read((char*)&theRows, 4);
43  in.read((char*)&theZ, 4);
44  in.read((char*)&theMinX, 4);
45  in.read((char*)&theDx, 4);
46  in.read((char*)&theMinY, 4);
47  in.read((char*)&theDy, 4);
48  ossimEndian anEndian;
50  {
51  anEndian.swap(theCols);
52  anEndian.swap(theRows);
53  anEndian.swap(theZ);
54  anEndian.swap(theMinX);
55  anEndian.swap(theDx);
56  anEndian.swap(theMinY);
57  anEndian.swap(theDy);
58  }
59 
60  return in.good();
61 }
std::basic_ifstream< char > ifstream
Class for char input file streams.
Definition: ossimIosFwd.h:44
bool readHeader(const ossimFilename &file)
std::ostream & operator<<(std::ostream &out, const ossimNadconGridHeader &rhs)
ossimDrect getBoundingRect() const
ossimByteOrder getSystemEndianType() const
Definition: ossimEndian.h:78
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
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
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23