@@ -227,50 +227,35 @@ string toString(const vector<NumT> & data) {
227227 return result.str ();
228228}
229229
230- string get_extension (const string &filename)
231- {
232- int dot_pos = filename.find (' .' );
233- return string (filename,dot_pos);
234- }
235-
236230int readTest (const string & filename) {
237231 const string SDS (" SDS" );
238232 // top level file information
239233 NeXus::File file (filename);
240-
241- string file_extension = get_extension (filename);
242234 cout << " NXinquirefile found: " << relativePathOf (file.inquireFile ()) << endl;
243- vector<NeXus::AttrInfo> attr_infos;
244- if (file_extension==" .h5" )
245- {
246- attr_infos = file.getAttrInfos ();
247- cout << " Number of global attributes: " << attr_infos.size () << endl;
248- for (vector<NeXus::AttrInfo>::iterator it = attr_infos.begin ();
249- it != attr_infos.end (); it++) {
250- if (it->name != " file_time" && it->name != " HDF_version" && it->name != " HDF5_Version" && it->name != " XML_version" ) {
251- cout << " " << it->name << " = " ;
252- if (it->type == NeXus::CHAR) {
253- cout << file.getStrAttr (*it);
254- }
255- cout << endl;
256- }
257- }
258- }
259-
260- // check group attributes
261- file.openGroup (" entry" , " NXentry" );
262- if (file_extension==" .h5" )
263- {
264- attr_infos = file.getAttrInfos ();
265- cout << " Number of group attributes: " << attr_infos.size () << endl;
266- for (vector<NeXus::AttrInfo>::iterator it = attr_infos.begin ();
267- it != attr_infos.end (); it++) {
235+ vector<NeXus::AttrInfo> attr_infos = file.getAttrInfos ();
236+ cout << " Number of global attributes: " << attr_infos.size () << endl;
237+ for (vector<NeXus::AttrInfo>::iterator it = attr_infos.begin ();
238+ it != attr_infos.end (); it++) {
239+ if (it->name != " file_time" && it->name != " HDF_version" && it->name != " HDF5_Version" && it->name != " XML_version" ) {
268240 cout << " " << it->name << " = " ;
269241 if (it->type == NeXus::CHAR) {
270242 cout << file.getStrAttr (*it);
271243 }
272244 cout << endl;
273- }
245+ }
246+ }
247+
248+ // check group attributes
249+ file.openGroup (" entry" , " NXentry" );
250+ attr_infos = file.getAttrInfos ();
251+ cout << " Number of group attributes: " << attr_infos.size () << endl;
252+ for (vector<NeXus::AttrInfo>::iterator it = attr_infos.begin ();
253+ it != attr_infos.end (); it++) {
254+ cout << " " << it->name << " = " ;
255+ if (it->type == NeXus::CHAR) {
256+ cout << file.getStrAttr (*it);
257+ }
258+ cout << endl;
274259 }
275260
276261 // print out the entry level fields
0 commit comments