IODA Bundle
ObsDataVector_head.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 OOPS_INTERFACE_OBSDATAVECTOR_HEAD_H_
9 #define OOPS_INTERFACE_OBSDATAVECTOR_HEAD_H_
10 
11 #include <memory>
12 #include <ostream>
13 #include <string>
14 
15 #include "oops/base/Variables.h"
17 #include "oops/util/Logger.h"
18 #include "oops/util/ObjectCounter.h"
19 #include "oops/util/Printable.h"
20 #include "oops/util/Timer.h"
21 
22 namespace oops {
23  template <typename OBS> class ObsVector;
24 
25 // -----------------------------------------------------------------------------
26 
27 template <typename OBS, typename DATATYPE>
28 class ObsDataVector : public util::Printable,
29  private util::ObjectCounter<ObsDataVector<OBS, DATATYPE> > {
30  typedef typename OBS::template ObsDataVector<DATATYPE> ObsDataVec_;
31 
32  public:
33  static const std::string classname() {return "oops::ObsDataVector";}
34 
35  ObsDataVector(const ObsSpace<OBS> &, const Variables &, const std::string name = "");
36  explicit ObsDataVector(const ObsDataVector &);
37  explicit ObsDataVector(ObsVector<OBS> &);
39 
40 /// Interfacing
42  const ObsDataVec_ & obsdatavector() const {return *data_;}
43 
44  std::shared_ptr<ObsDataVec_> obsdatavectorptr() {return data_;}
45  std::shared_ptr<const ObsDataVec_> obsdatavectorptr() const {return data_;}
46 
48 
49  void zero();
50  void mask(const ObsDataVector<OBS, int> &);
51  unsigned int nobs() const {return data_->nobs();}
52 
53 // I/O
54  void read(const std::string &);
55  void save(const std::string &) const;
56 
57  private:
58  void print(std::ostream &) const;
59  std::shared_ptr<ObsDataVec_> data_;
60 };
61 
62 // -----------------------------------------------------------------------------
63 
64 } // namespace oops
65 
66 #endif // OOPS_INTERFACE_OBSDATAVECTOR_HEAD_H_
ObsDataVector(const ObsSpace< OBS > &, const Variables &, const std::string name="")
const ObsDataVec_ & obsdatavector() const
ObsDataVec_ & obsdatavector()
Interfacing.
static const std::string classname()
std::shared_ptr< ObsDataVec_ > data_
std::shared_ptr< ObsDataVec_ > obsdatavectorptr()
OBS::template ObsDataVector< DATATYPE > ObsDataVec_
unsigned int nobs() const
void save(const std::string &) const
ObsDataVector & operator=(const ObsDataVector &)
std::shared_ptr< const ObsDataVec_ > obsdatavectorptr() const
void mask(const ObsDataVector< OBS, int > &)
The namespace for the main oops code.