H5Iterables_misc.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c), 2017, Adrien Devresse <adrien.devresse@epfl.ch>
3  *
4  * Distributed under the Boost Software License, Version 1.0.
5  * (See accompanying file LICENSE_1_0.txt or copy at
6  * http://www.boost.org/LICENSE_1_0.txt)
7  *
8  */
9 #ifndef H5ITERABLE_MISC_HPP
10 #define H5ITERABLE_MISC_HPP
11 
12 #include <exception>
13 #include <string>
14 #include <vector>
15 
16 #include "../H5Exception.hpp"
17 
18 #include <H5Ipublic.h>
19 
20 namespace HighFive {
21 
22 namespace details {
23 
24 // iterator for H5 iterate
25 
27  inline HighFiveIterateData(std::vector<std::string>& my_names)
28  : names(my_names), err(NULL) {}
29 
30  std::vector<std::string>& names;
31  std::exception* err;
32 
33  inline void throwIfError() {
34  if (err) {
35  throw * err;
36  }
37  }
38 };
39 
40 template <typename InfoType>
41 inline herr_t internal_high_five_iterate(hid_t id, const char* name,
42  const InfoType* info, void* op_data) {
43  (void)id;
44  (void)info;
45 
46  HighFiveIterateData* data = static_cast<HighFiveIterateData*>(op_data);
47  try {
48  data->names.push_back(name);
49  return 0;
50  } catch (...) {
51  data->err =
52  new ObjectException("Exception during H5Iterate, abort listing");
53  }
54  return -1;
55 }
56 
57 } // end details
58 }
59 
60 #endif // H5ITERABLE_MISC_HPP
HighFive::details::HighFiveIterateData::HighFiveIterateData
HighFiveIterateData(std::vector< std::string > &my_names)
Definition: H5Iterables_misc.hpp:27
NULL
#define NULL
Definition: mydefs.hpp:141
HighFive::details::HighFiveIterateData::err
std::exception * err
Definition: H5Iterables_misc.hpp:31
HighFive::details::HighFiveIterateData
Definition: H5Iterables_misc.hpp:26
HighFive::details::HighFiveIterateData::names
std::vector< std::string > & names
Definition: H5Iterables_misc.hpp:30
HighFive::details::internal_high_five_iterate
herr_t internal_high_five_iterate(hid_t id, const char *name, const InfoType *info, void *op_data)
Definition: H5Iterables_misc.hpp:41
HighFive::ObjectException
Exception specific to HighFive Object interface.
Definition: H5Exception.hpp:74
HighFive::details::HighFiveIterateData::throwIfError
void throwIfError()
Definition: H5Iterables_misc.hpp:33
HighFive
Definition: H5Annotate_traits.hpp:14


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:23