IODA Bundle
SplitTool.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 #ifndef SplitTool_H
12 #define SplitTool_H
13 
14 #include <string>
15 #include <vector>
16 #include <ostream>
17 
18 #include "eckit/io/Length.h"
19 #include "eckit/io/Offset.h"
20 #include "Tool.h"
21 
22 namespace odc {
23 namespace tool {
24 
25 class SplitTool : public Tool {
26 public:
27  SplitTool (int argc, char *argv[]);
28 
29  void run();
30 
31  static void help(std::ostream &o)
32  {
33  o << "Splits file according to given template";
34  }
35 
36  static void usage(const std::string& name, std::ostream &o)
37  {
38  o << name << " [-no_verification] [-maxopenfiles <N>] <input.odb> <output_template.odb>";
39  }
40 
41  static void split(const eckit::PathName&, const std::string&, size_t, bool verify=true);
42  static void presortAndSplit(const eckit::PathName&, const std::string&);
43 
44  static std::vector<std::pair<eckit::Offset,eckit::Length> > getChunks(const eckit::PathName&, size_t maxExpandedSize = 100*1024*1024);
45 private:
46 // No copy allowed
49 
50  static std::string genOrderBySelect(const std::string&, const std::string&);
51 
53  bool sort_;
54 };
55 
56 } // namespace tool
57 } // namespace odc
58 
59 #endif
SplitTool & operator=(const SplitTool &)
static void help(std::ostream &o)
Definition: SplitTool.h:31
static void split(const eckit::PathName &, const std::string &, size_t, bool verify=true)
Definition: SplitTool.cc:141
static std::vector< std::pair< eckit::Offset, eckit::Length > > getChunks(const eckit::PathName &, size_t maxExpandedSize=100 *1024 *1024)
Definition: SplitTool.cc:66
SplitTool(int argc, char *argv[])
Definition: SplitTool.cc:31
static void usage(const std::string &name, std::ostream &o)
Definition: SplitTool.h:36
SplitTool(const SplitTool &)
static std::string genOrderBySelect(const std::string &, const std::string &)
Definition: SplitTool.cc:106
static void presortAndSplit(const eckit::PathName &, const std::string &)
Definition: SplitTool.cc:124
std::string name()
Definition: Tool.h:34
Definition: ColumnInfo.h:23