OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimH5Util.h
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: LGPL
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: David Burken
8 //
9 // Description: OSSIM HDF5 utility class.
10 //
11 //----------------------------------------------------------------------------
12 // $Id
13 
14 #ifndef ossimH5Util_HEADER
15 #define ossimH5Util_HEADER 1
16 
18 #include <ossim/base/ossimRefPtr.h>
20 
21 #include <iosfwd>
22 #include <string>
23 #include <vector>
24 
25 // Forward class declarations:
26 class ossimIrect;
27 namespace H5
28 {
29  class AbstractDs;
30  class Attribute;
31  class DataSet;
32  class H5File;
33  class CompType;
34  class DataSpace;
35  class DataSet;
36  class DataType;
37  class EnumType;
38  class FloatType;
39  class IntType;
40  class StrType;
41  class ArrayType;
42 }
43 
44 // Anonymous enums:
45 enum
46 {
48 };
49 
50 namespace ossim_hdf5
51 {
52  // Anonymous enums:
53  enum
54  {
55  //---
56  // Used by iterateGroupForDatasetNames which can recursively call itself
57  // to avoid blowing away the stack on an error.
58  //---
60  };
61 
69  std::ostream& print( H5::H5File* file,
70  std::ostream& out );
71 
81  void printIterative( H5::H5File* file,
82  const std::string& groupName,
83  const std::string& prefix,
84  ossim_uint32& recursedCount,
85  std::ostream& out );
86 
96  void printObject( H5::H5File* file,
97  const std::string& objectName,
98  const std::string& prefix,
99  std::ostream& out );
100 
101 
102  void printEnumType(H5::DataSet& dataset,
103  H5::EnumType& dataType,
104  const std::string& prefix,
105  std::ostream& out);
106  void printIntType(H5::DataSet& dataset,
107  H5::IntType& dataType,
108  const char* dataPtr,
109  const std::string& prefix,
110  std::ostream& out);
111  void printFloatType(H5::DataSet& dataset,
112  H5::FloatType& dataType,
113  const char* dataPtr,
114  const std::string& prefix,
115  std::ostream& out);
116  void printArrayType(H5::DataSet& dataset,
117  H5::ArrayType& dataType,
118  const char* dataPtr,
119  const std::string& prefix,
120  std::ostream& out);
121  void printStrType(H5::DataSet& dataset,
122  H5::StrType& dataType,
123  const char* dataPtr,
124  const std::string& prefix,
125  std::ostream& out);
132  void printCompound(H5::DataSet& dataset,
133  const std::string& prefix,
134  std::ostream& out);
135 
155  bool getGroupAttributeValue( H5::H5File* file,
156  const std::string& group,
157  const std::string& key,
158  std::string& value );
159 
179  bool getDatasetAttributeValue( H5::H5File* file,
180  const std::string& objectName,
181  const std::string& key,
182  std::string& value );
183 
184  void printAttribute( const H5::Attribute& attr,
185  const std::string& prefix,
186  std::ostream& out );
187  void combine( const std::string& left,
188  const std::string& right,
189  char separator,
190  std::string& result );
191 
192  void getDatasetNames(H5::H5File* file, std::vector<std::string>& names );
193 
194  std::string getDatatypeClassType( ossim_int32 type );
195 
196  bool isLoadableAsImage( H5::H5File* file,
197  const std::string& datasetName );
198 
199  //bool isExcludedDataset( const std::string& datasetName );
200 
201  void iterateGroupForDatasetNames( H5::H5File* file,
202  const std::string& group,
203  std::vector<std::string>& names,
204  ossim_uint32& recursedCount );
205 
206  void getExtents( const H5::DataSet* dataset,
207  std::vector<ossim_uint32>& extents );
208 
209  // ossimScalarType getScalarType( ossim_int32 typeClass, ossim_int32 id );
210  ossimScalarType getScalarType( const H5::DataSet* dataset );
211 
220  size_t size,
221  bool isSigned );
222 
223  /* GP:
224  * I am commenting this one out and we should use the one above.
225  * This gives us negative values for the class type and seems to be busted.
226  * if you have the typeclass then you can get the size and sign and it is safer to
227  * use the call above.
228  */
229  //ossimScalarType getScalarType( ossim_int32 id );
230 
231  ossimByteOrder getByteOrder( const H5::AbstractDs* dataset );
232 
233  ossimByteOrder getByteOrder( const H5::DataType* dataType );
234 
235 
242  bool getValidBoundingRect( H5::DataSet& dataset,
243  const std::string& name,
244  ossimIrect& rect );
245 
255  H5::DataSet& latDataSet,
256  H5::DataSet& lonDataSet,
257  const ossimIrect& validRect );
258 
265  bool crossesDateline( H5::DataSet& dataset, const ossimIrect& validRect );
266  bool crossesDateline( const std::vector<ossim_float32>& lineBuffer);
267 
268 } // End: namespace ossim_hdf5{...}
269 
270 #endif /* #ifndef ossimH5Util_HEADER */
void printCompound(H5::DataSet &dataset, const std::string &prefix, std::ostream &out)
Prints a compound object.
void combine(const std::string &left, const std::string &right, char separator, std::string &result)
ossimScalarType getScalarType(const H5::DataSet *dataset)
void printIntType(H5::DataSet &dataset, H5::IntType &dataType, const char *dataPtr, const std::string &prefix, std::ostream &out)
bool isLoadableAsImage(H5::H5File *file, const std::string &datasetName)
std::ostream & print(H5::H5File *file, std::ostream &out)
Print method.
Definition: ossimH5Util.cpp:41
void printIterative(H5::H5File *file, const std::string &groupName, const std::string &prefix, ossim_uint32 &recursedCount, std::ostream &out)
Iterative print method.
Definition: ossimH5Util.cpp:79
void printFloatType(H5::DataSet &dataset, H5::FloatType &dataType, const char *dataPtr, const std::string &prefix, std::ostream &out)
void printAttribute(const H5::Attribute &attr, const std::string &prefix, std::ostream &out)
OSSIM_DLL bool isSigned(ossimScalarType scalarType)
yy_size_t size
bool getDatasetAttributeValue(H5::H5File *file, const std::string &objectName, const std::string &key, std::string &value)
Gets string value for attribute key.
void printStrType(H5::DataSet &dataset, H5::StrType &dataType, const char *dataPtr, const std::string &prefix, std::ostream &out)
unsigned int ossim_uint32
void iterateGroupForDatasetNames(H5::H5File *file, const std::string &group, std::vector< std::string > &names, ossim_uint32 &recursedCount)
void printEnumType(H5::DataSet &dataset, H5::EnumType &dataType, const std::string &prefix, std::ostream &out)
ossimByteOrder
ossimByteOrder getByteOrder(const H5::AbstractDs *dataset)
ossimScalarType
bool getValidBoundingRect(H5::DataSet &dataset, const std::string &name, ossimIrect &rect)
Gets the valid bounding rect of the dataset excluding nulls on front and back.
void printArrayType(H5::DataSet &dataset, H5::ArrayType &dataType, const char *dataPtr, const std::string &prefix, std::ostream &out)
bool getGroupAttributeValue(H5::H5File *file, const std::string &group, const std::string &key, std::string &value)
Gets string value for attribute key.
ossimRefPtr< ossimProjection > getBilinearProjection(H5::DataSet &latDataSet, H5::DataSet &lonDataSet, const ossimIrect &validRect)
Gets bilinear projection from Latitude, Longitude layer.
void getExtents(const H5::DataSet *dataset, std::vector< ossim_uint32 > &extents)
void getDatasetNames(H5::H5File *file, std::vector< std::string > &names)
bool crossesDateline(H5::DataSet &dataset, const ossimIrect &validRect)
Checks for dateline cross.
void printObject(H5::H5File *file, const std::string &objectName, const std::string &prefix, std::ostream &out)
Prints an object.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
std::string getDatatypeClassType(ossim_int32 type)
int ossim_int32