SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WriteHDF5DumpFile.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2009 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9  License for the specific language governing rights and limitations under
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 
30 ///
31 ///@file WriteHDF5DumpFile.h
32 ///
33 ///@author
34 /// Allen Sanderson
35 /// SCI Institute
36 /// University of Utah
37 ///@date May 2003
38 ///
39 
40 
41 #ifndef HDF5_DUMP_API
42 #define HDF5_DUMP_API
43 
44 #include <sci_defs/hdf5_defs.h>
45 
46 #include <iostream>
47 #include <vector>
48 
49 #ifdef HAVE_HDF5
50 
51 #include "hdf5.h"
52 
53 namespace SCIRun {
54 
55 herr_t hdf5_attr_iter (hid_t obj_id, const char *name, void *op_data);
56 herr_t hdf5_group_iter(hid_t obj_id, const char *name, void *op_data);
57 herr_t hdf5_link_iter (hid_t obj_id, const char *name, const H5L_info_t *linfo, void *op_data);
58 
59 class WriteHDF5DumpFile {
60 public:
61  WriteHDF5DumpFile( ostream *iostr );
62 
63  void tab( );
64 
65  herr_t file(const std::string fname);
66  herr_t group (hid_t group_id, const char *name);
67  herr_t all (hid_t obj_id, const char *name);
68  herr_t link (hid_t link_id, const char *name);
69  herr_t attr (hid_t group_id, const char *name);
70  herr_t dataset (hid_t dataset_id, const char *name);
71  herr_t datatype (hid_t obj_id, hid_t type);
72  herr_t data (hid_t obj_id, hid_t type);
73  herr_t dataspace(hid_t file_space_id);
74 
75  std::string error() { return error_msg_; };
76 
77 private:
78  vector<hid_t> group_ids, dataset_ids;
79 
80  unsigned int indent_;
81  unsigned int max_indent_;
82 
83  vector<string> path_;
84 
85  ostream *iostr_;
86  std::string error_msg_;
87 
88  template< class C >
89  typename C::iterator find( C& c, typename C::value_type v )
90  {
91  typename C::iterator p = c.begin();
92 
93  while( p != c.end() )
94  if( *p == v ) return p;
95  else p++;
96  return p;
97  }
98 
99 };
100 
101 
102 } // end namespace SCIRun
103 
104 #endif // HAVE_HDF5
105 
106 #endif // HDF5_DUMP_API
const char * name[]
Definition: BoostGraphExampleTests.cc:87
dictionary data
Definition: eabLatVolData.py:11
v
Definition: readAllFields.py:42
tuple file
Definition: eab.py:7