OOPS
oops/base/Variables.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2017-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 OOPS_BASE_VARIABLES_H_
9 #define OOPS_BASE_VARIABLES_H_
10 
11 #include <ostream>
12 #include <string>
13 #include <vector>
14 
15 
16 #include "eckit/config/LocalConfiguration.h"
17 #include "oops/util/Printable.h"
18 
19 namespace oops {
20 
21 // -----------------------------------------------------------------------------
22 
23 class Variables : public util::Printable {
24  public:
25  static const std::string classname() {return "oops::Variables";}
26 
27  Variables();
28  Variables(const eckit::Configuration &, const std::string &);
29  explicit Variables(const std::vector<std::string> &, const std::string & conv = "");
30  Variables(const std::vector<std::string> & vars, const std::vector<int> & channels);
31 
32  ~Variables();
33 
34  Variables(const Variables &);
35  Variables & operator+=(const Variables &);
36 
37  size_t size() const {return vars_.size();}
38  const std::string & operator[](const size_t kk) const {return vars_.at(kk);}
39  bool operator==(const Variables &) const;
40  bool operator<=(const Variables &) const;
41 
42  bool has(const std::string &) const;
43  size_t find(const std::string &) const;
44 
45  const std::vector<std::string> & variables() const {return vars_;}
46  const std::vector<int> & channels() const {return channels_;}
47  void push_back(const std::string &);
48 
49  private:
50  void print(std::ostream &) const;
51  void setConf();
52 
53  std::string convention_;
54  std::vector<std::string> vars_;
55  std::vector<int> channels_; // channel indices
56 };
57 
58 // -----------------------------------------------------------------------------
59 
60 } // namespace oops
61 
62 #endif // OOPS_BASE_VARIABLES_H_
bool operator==(const Variables &) const
bool has(const std::string &) const
std::string convention_
const std::vector< std::string > & variables() const
size_t size() const
void push_back(const std::string &)
const std::string & operator[](const size_t kk) const
const std::vector< int > & channels() const
void print(std::ostream &) const
std::vector< std::string > vars_
static const std::string classname()
size_t find(const std::string &) const
bool operator<=(const Variables &) const
Variables & operator+=(const Variables &)
std::vector< int > channels_
The namespace for the main oops code.