OOPS
Iterator.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2018 UCAR
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  */
7 
8 #ifndef LORENZ95_ITERATOR_H_
9 #define LORENZ95_ITERATOR_H_
10 
11 #include <iterator>
12 #include <string>
13 #include <vector>
14 
15 #include "eckit/geometry/Point2.h"
16 
17 #include "lorenz95/Resolution.h"
18 
19 #include "oops/util/ObjectCounter.h"
20 #include "oops/util/Printable.h"
21 
22 namespace lorenz95 {
23 
24 class Resolution;
25 
26 // -----------------------------------------------------------------------------
27 class Iterator: public std::iterator<std::forward_iterator_tag,
28  eckit::geometry::Point2>,
29  public util::Printable,
30  private util::ObjectCounter<Iterator> {
31  public:
32  static const std::string classname() {return "lorenz95::Iterator";}
33 
34  explicit Iterator(const Resolution & res, const int & index = 0);
35  ~Iterator();
36 
37  bool operator==(const Iterator &) const;
38  bool operator!=(const Iterator &) const;
39  eckit::geometry::Point2 operator*() const;
41 
42  int index() const {return index_;}
43 
44  private:
45  void print(std::ostream & os) const {os << index_;}
46  const int res_;
47  int index_;
48 };
49 
50 } // namespace lorenz95
51 
52 #endif // LORENZ95_ITERATOR_H_
lorenz95::Iterator::operator*
eckit::geometry::Point2 operator*() const
Definition: Iterator.cc:33
lorenz95::Resolution
Handles resolution.
Definition: Resolution.h:42
lorenz95::Iterator::index
int index() const
Definition: Iterator.h:42
lorenz95::Iterator::operator!=
bool operator!=(const Iterator &) const
Definition: Iterator.cc:28
lorenz95::Iterator::Iterator
Iterator(const Resolution &res, const int &index=0)
Definition: Iterator.cc:15
lorenz95::Iterator::print
void print(std::ostream &os) const
Definition: Iterator.h:45
lorenz95::Iterator::index_
int index_
Definition: Iterator.h:47
lorenz95::Iterator::operator++
Iterator & operator++()
Definition: Iterator.cc:38
lorenz95::Iterator::~Iterator
~Iterator()
Definition: Iterator.cc:19
lorenz95::Iterator
Definition: Iterator.h:30
lorenz95::Iterator::operator==
bool operator==(const Iterator &) const
Definition: Iterator.cc:23
lorenz95::Iterator::res_
const int res_
Definition: Iterator.h:46
lorenz95::Iterator::classname
static const std::string classname()
Definition: Iterator.h:32
lorenz95
The namespace for the L95 model.
Definition: l95/src/lorenz95/AnalyticInit.cc:17
Resolution.h