libpniio
h5_error_stack.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2011 DESY, Eugen Wintersberger <eugen.wintersberger@desy.de>
3 //
4 // This file is part of libpniio.
5 //
6 // libpniio is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // libpniio is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with libpniio. If not, see <http://www.gnu.org/licenses/>.
18 //************************************************************************
19 //
20 // Created on: Jul 28, 2011
21 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
22 //
23 #pragma once
24 
25 extern "C"{
26 #include <hdf5.h>
27 }
28 
29 #include <iostream>
30 #include <vector>
31 
32 #include <pni/core/types.hpp>
33 #include <pni/core/error.hpp>
34 
35 #include "h5_error.hpp"
36 
37 namespace pni {
38 namespace io {
39 namespace nx {
40 namespace h5 {
41 
42 
51  {
52  public:
56  typedef std::vector<value_type> container_type;
58  typedef container_type::iterator iterator;
60  typedef container_type::const_iterator const_iterator;
61  private:
63  hid_t _stack_id;
65  container_type _errors;
66 
67  public:
68  //-----------------------------------------------------------------
72  h5_error_stack() noexcept;
73 
74  //-----------------------------------------------------------------
79 
80  //-----------------------------------------------------------------
84  virtual ~h5_error_stack();
85 
86  //-----------------------------------------------------------------
90  h5_error_stack &operator=(const h5_error_stack &s);
91 
92  //-----------------------------------------------------------------
99  ssize_t number_of_errors() const{ return _errors.size(); }
100 
101  //-----------------------------------------------------------------
108  void fill();
109 
110  //-----------------------------------------------------------------
117  void append(const h5_error &e);
118 
119  //-----------------------------------------------------------------
123  const_iterator begin() const;
124 
125  //----------------------------------------------------------------
129  const_iterator end() const;
130 
131 
132  };
133 
134  //------------------------------------------------------------------------
139  std::ostream &operator<<(std::ostream &o, const h5_error_stack &s);
140 
141  //------------------------------------------------------------------------
151 extern "C" herr_t _error_walker(unsigned n,const H5E_error2_t *eptr,
152  void *client_data);
153 
154  //------------------------------------------------------------------------
164  pni::core::string get_h5_error_string();
165 
166 
167 //end of namespace
168 }
169 }
170 }
171 }
std::ostream & operator<<(std::ostream &o, const h5_error &e)
ouput stream operator
Definition: h5_error.cpp:201
h5_error_stack() noexcept
default constructor
Definition: h5_error_stack.cpp:55
herr_t _error_walker(unsigned n, const H5E_error2_t *eptr, void *client_data)
Walker functins to read over error messages.
Definition: h5_error_stack.cpp:38
std::vector< value_type > container_type
container type to store errors
Definition: h5_error_stack.hpp:56
const_iterator end() const
iterator to last element
Definition: h5_error_stack.cpp:108
Definition: cbf_reader.hpp:41
void fill()
fill stack
Definition: h5_error_stack.cpp:64
pni::core::string get_h5_error_string()
return HDF5 error messages
Definition: h5_error_stack.cpp:126
HDF5 error stack.
Definition: h5_error_stack.hpp:50
ssize_t number_of_errors() const
get number of errors
Definition: h5_error_stack.hpp:99
container_type _errors
vector with error records on this stack
Definition: h5_error_stack.hpp:65
HDF5 error record.
Definition: h5_error.hpp:50
hid_t _stack_id
id of the error stack
Definition: h5_error_stack.hpp:63
container_type::iterator iterator
non-const iterator type
Definition: h5_error_stack.hpp:58
const_iterator begin() const
iterator to first error
Definition: h5_error_stack.cpp:102
container_type::const_iterator const_iterator
const iterator type
Definition: h5_error_stack.hpp:60
h5_error value_type
the element type of the stack - the error type
Definition: h5_error_stack.hpp:54
void append(const h5_error &e)
append error
Definition: h5_error_stack.cpp:99