IODA Bundle
Partition.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 /// @author Piotr Kuchta, ECMWF, Oct 2015
12 
13 #ifndef odc_Partition_H
14 #define odc_Partition_H
15 
16 #include "odc/Block.h"
17 
18 #include <vector>
19 
20 namespace eckit { class PathName; }
21 
22 namespace odc {
23 
24 class Partition {
25 public:
26  Partition();
27  /// Read pool info from partitions info file
28  Partition(const eckit::PathName&, size_t);
29  Partition(const Partition&);
30  Partition& operator=(const Partition&);
31 
32  //void add(const eckit::PathName&, ullong start, ullong end, ullong seqno, ullong firstRow, ullong nRows);
33  void add(const Block&);
34 
35  ullong numberOfRows() const;
37 
38  std::vector<Block>& blocks() { return blocks_; }
39 
42 
45 
46  ullong write(const eckit::PathName& fileName) const;
47  ullong write(eckit::DataHandle& dh) const;
48 
49  std::string str() const;
50  std::ostream& save(std::ostream&, size_t poolNumber) const;
51 
52 private:
53  std::vector<Block> blocks_;
56 
57  friend std::ostream& operator<< (std::ostream&, const Partition&);
58 };
59 
60 } // namespace odc
61 
62 #endif
ullong numberOfRowsOnLastBlock() const
Definition: Partition.cc:106
ullong rowsOnLastBlock_
Definition: Partition.h:55
void add(const Block &)
Definition: Partition.cc:112
void startOfLastBlock(ullong n)
Definition: Partition.h:44
ullong startOfLastBlock_
Definition: Partition.h:54
std::string str() const
std::vector< Block > & blocks()
Definition: Partition.h:38
ullong write(const eckit::PathName &fileName) const
Partition(const eckit::PathName &, size_t)
Read pool info from partitions info file.
ullong rowsOnLastBlock() const
Definition: Partition.h:40
Partition & operator=(const Partition &)
Definition: Partition.cc:90
std::vector< Block > blocks_
Definition: Partition.h:53
friend std::ostream & operator<<(std::ostream &, const Partition &)
Definition: Partition.cc:33
std::ostream & save(std::ostream &, size_t poolNumber) const
Definition: Partition.cc:42
ullong numberOfRows() const
Definition: Partition.cc:98
ullong startOfLastBlock()
Definition: Partition.h:43
void rowsOnLastBlock(ullong n)
Definition: Partition.h:41
Definition: ColumnInfo.h:23
unsigned long long ullong
Definition: Block.h:27