h5cpp  0.5.0
A modern C++ wrapper for the HDF5 C library
attribute_iterator.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2017 DESY,ESS
3 //
4 // This file is part of h5cpp.
5 //
6 // This library is free software; you can redistribute it and/or modify it
7 // under the terms of the GNU Lesser General Public License as published
8 // by the Free Software Foundation; either version 2.1 of the License, or
9 // (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 // License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the
18 // Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
19 // Boston, MA 02110-1301 USA
20 // ===========================================================================
21 //
22 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
23 // Created on: Sep 14, 2017
24 //
25 #pragma once
26 
27 #include <h5cpp/core/iterator.hpp>
28 #include <h5cpp/core/windows.hpp>
31 
32 namespace hdf5 {
33 namespace attribute {
34 
35 #ifdef __clang__
36 #pragma clang diagnostic push
37 #pragma clang diagnostic ignored "-Wweak-vtables"
38 #endif
40 {
41  public:
43  using pointer = value_type*;
45  using difference_type = ssize_t;
46  using iterator_category = std::random_access_iterator_tag;
47 
48  AttributeIterator() = delete;
49  AttributeIterator(const AttributeIterator&) = default;
50  AttributeIterator(const AttributeManager &manager,ssize_t index);
51 
52  explicit operator bool() const
53  {
54  return !(index()<0 || index()>=static_cast<ssize_t>(manager_.get().size()));
55  }
56 
57  value_type operator*() const;
58 
59  value_type *operator->();
60 
61  AttributeIterator &operator++();
62  AttributeIterator operator++(int);
63  AttributeIterator &operator--();
64  AttributeIterator operator--(int);
65 
66  AttributeIterator &operator+=(ssize_t i);
67  AttributeIterator &operator-=(ssize_t i);
68 
69  bool operator==(const AttributeIterator &a) const;
70 
71  bool operator!=(const AttributeIterator &a) const;
72 
73  private:
74 #ifdef _MSC_VER
75 #pragma warning(push)
76 #pragma warning(disable: 4251)
77 #endif
78  std::reference_wrapper<const AttributeManager> manager_;
79 #ifdef _MSC_VER
80 #pragma warning(pop)
81 #endif
82  Attribute current_attribute_;
83 
84 };
85 #ifdef __clang__
86 #pragma clang diagnostic pop
87 #endif
88 
89 } // namespace attribute
90 } // namespace hdf5
hdf5::Iterator
Definition: iterator.hpp:32
hdf5::attribute::AttributeIterator
Definition: attribute_iterator.hpp:39
iterator.hpp
attribute_manager.hpp
hdf5::attribute::AttributeIterator::difference_type
ssize_t difference_type
Definition: attribute_iterator.hpp:45
windows.hpp
hdf5::operator!=
bool operator!=(const ObjectHandle &lhs, const ObjectHandle &rhs)
not equal to operator
hdf5::attribute::Attribute
Definition: attribute.hpp:48
hdf5::attribute::AttributeManager
provides STL interface for attributes
Definition: attribute_manager.hpp:62
hdf5::operator==
bool operator==(const ObjectHandle &lhs, const ObjectHandle &rhs)
equality operator
hdf5::attribute::AttributeIterator::iterator_category
std::random_access_iterator_tag iterator_category
Definition: attribute_iterator.hpp:46
DLL_EXPORT
#define DLL_EXPORT
Definition: windows.hpp:29
attribute.hpp
hdf5
top-level namespace of the entire library
Definition: attribute.hpp:45