IODA Bundle
ODAUpdatingIterator.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 1996-2012 ECMWF.
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  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 ///
12 /// \file ODAUpdatingIterator.h
13 ///
14 /// @author Piotr Kuchta, June 2009
15 
16 #ifndef ODAUpdatingIterator_H
17 #define ODAUpdatingIterator_H
18 
19 namespace odc {
20 
21 namespace core { class MetaData; }
22 
23 template <typename T>
25 {
26 public:
27  ODAUpdatingIterator (T& inputIterator, const T& end, const std::vector<std::string>& columns, const std::vector<double>& values);
28  ODAUpdatingIterator (const T& end);
30 
31  bool isNewDataset();
32  double* data() { return data_; }
33 
34  const core::MetaData& columns() { return ii_->columns(); }
35  const core::MetaData& columns(core::MetaData& md) { return ii_->columns(md); }
36 
37  ODAUpdatingIterator& operator++() { next(0); return *this; }
38 
39  bool operator!=(const ODAUpdatingIterator& o) { ASSERT(&o == 0); return ii_ != end_; }
40 
41 //protected:
42  bool next();
43 
44 private:
45 // No copy allowed.
48 
49  void update();
50  void updateIndices();
51 
52  // Input iterator.
53  T ii_;
54  const T& end_;
55 
56  std::vector<std::string> columns_;
57  std::vector<size_t> columnIndices_;
58  const std::vector<double> values_;
59 
60  double *data_;
61 public:
62  int refCount_;
63  bool noMore_;
64 };
65 
66 } // namespace odc
67 
69 
70 #endif
ODAUpdatingIterator(const ODAUpdatingIterator &)
std::vector< size_t > columnIndices_
const core::MetaData & columns()
ODAUpdatingIterator & operator=(const ODAUpdatingIterator &)
bool operator!=(const ODAUpdatingIterator &o)
ODAUpdatingIterator & operator++()
ODAUpdatingIterator(T &inputIterator, const T &end, const std::vector< std::string > &columns, const std::vector< double > &values)
const core::MetaData & columns(core::MetaData &md)
const std::vector< double > values_
std::vector< std::string > columns_
Definition: ColumnInfo.h:23