h5cpp  0.6
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 <sys/types.h>
29 #include <h5cpp/core/windows.hpp>
30 
31 namespace hdf5{
32 
34 {
35  private:
37  ssize_t index_ {0};
38 
39  public:
40 
43  explicit Iterator(ssize_t index);
44  Iterator(const Iterator &) = default;
45 
46  Iterator & operator=(const Iterator&) = default;
47 
48  virtual ~Iterator();
49 
51  // prefix
54  // postfix
57 
58  Iterator &operator+=(ssize_t i);
59  Iterator &operator-=(ssize_t i);
60 
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  bool operator>=(const Iterator &b) const;
66 
68  ssize_t index() const { return index_; }
69 
70 };
71 
72 DLL_EXPORT Iterator operator+(const Iterator&a, ssize_t b);
73 
74 DLL_EXPORT Iterator operator+(ssize_t a,const Iterator &b);
75 
76 DLL_EXPORT Iterator operator-(const Iterator &a,ssize_t b);
77 
78 DLL_EXPORT ssize_t operator-(const Iterator &a,const Iterator &b);
79 
80 } // namespace hdf5
Definition: iterator.hpp:34
Iterator & operator++()
increment iterator position
Iterator & operator=(const Iterator &)=default
ssize_t index() const
get state of the iterator
Definition: iterator.hpp:68
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