h5cpp  0.5.2
A modern C++ wrapper for the HDF5 C library
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 13, 2017
24 //
25 #pragma once
26 
27 #include <stdexcept>
28 #include <h5cpp/core/windows.hpp>
29 
30 namespace hdf5{
31 
33 {
34  private:
36  ssize_t index_ {0};
37 
38  public:
39 
42  explicit Iterator(ssize_t index);
43  Iterator(const Iterator &) = default;
44 
45  Iterator & operator=(const Iterator&) = default;
46 
47  virtual ~Iterator();
48 
50  // prefix
53  // postfix
56 
57  Iterator &operator+=(ssize_t i);
58  Iterator &operator-=(ssize_t i);
59 
60  bool operator==(const Iterator &b) const;
61  bool operator<(const Iterator &b) const;
62  bool operator<=(const Iterator &b) const;
63  bool operator>(const Iterator &b) const;
64  bool operator>=(const Iterator &b) const;
65 
67  ssize_t index() const { return index_; }
68 
69 };
70 
71 DLL_EXPORT Iterator operator+(const Iterator&a, ssize_t b);
72 
73 DLL_EXPORT Iterator operator+(ssize_t a,const Iterator &b);
74 
75 DLL_EXPORT Iterator operator-(const Iterator &a,ssize_t b);
76 
77 DLL_EXPORT ssize_t operator-(const Iterator &a,const Iterator &b);
78 
79 } // namespace hdf5
Definition: iterator.hpp:33
Iterator & operator++()
increment iterator position
Iterator & operator=(const Iterator &)=default
ssize_t index() const
get state of the iterator
Definition: iterator.hpp:67
Iterator & operator+=(ssize_t i)
Iterator(ssize_t index)
Iterator operator++(int)
bool operator>=(const Iterator &b) const
bool operator>(const Iterator &b) const
Iterator & operator--()
virtual ~Iterator()
Iterator(const Iterator &)=default
Iterator & operator-=(ssize_t i)
bool operator<=(const Iterator &b) const
Iterator operator--(int)
Iterator()
default constructor
bool operator<(const Iterator &b) const
bool operator==(const Iterator &b) const
top-level namespace of the entire library
Definition: attribute.hpp:45
Iterator operator-(const Iterator &a, ssize_t b)
Iterator operator+(const Iterator &a, ssize_t b)
#define DLL_EXPORT
Definition: windows.hpp:29