MI - Fimex
CDMReaderWriter.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Fimex, CDMReaderWriter.h
3  *
4  * (C) Copyright 2013, met.no
5  *
6  * Project Info: https://wiki.met.no/fimex/start
7  *
8  * This library is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21  * USA.
22  *
23  * Created on: Feb 4, 2013
24  * Author: heikok
25  */
26 
27 #ifndef CDMREADERWRITER_H_
28 #define CDMREADERWRITER_H_
29 
30 #include "fimex/CDMReader.h"
31 
32 namespace MetNoFimex
33 {
34 
42 {
43 public:
45  virtual ~CDMReaderWriter();
46 
47 ;
51  virtual void sync() = 0;
52 
67  virtual void putDataSlice(const std::string& varName, size_t unLimDimPos, const DataPtr data) = 0;
77  virtual void putDataSlice(const std::string& varName, const SliceBuilder& sb, const DataPtr data) = 0;
78 
90  virtual void putScaledDataSlice(const std::string& varName, size_t unLimDimPos, const DataPtr data);
105  virtual void putScaledDataSliceInUnit(const std::string& varName, const std::string& unit, size_t unLimDimPos, const DataPtr data);
114  virtual void putScaledDataSlice(const std::string& varName, const SliceBuilder& sb, const DataPtr data);
124  virtual void putScaledDataSliceInUnit(const std::string& varName, const std::string& dataUnit, const SliceBuilder& sb, const DataPtr data);
125 
126 private:
127  DataPtr unscaleDataOf(const std::string& varName, DataPtr data, double unitScale=1, double unitOffset=0);
128  DataPtr unscaleDataOf(const std::string& varName, DataPtr data, boost::shared_ptr<UnitsConverter> uc);
129  DataPtr unscaleDataFromUnitOf(const std::string& varName, DataPtr data, const std::string& dataUnit);
130 }; /* class */
131 
132 } /* MetNoFimex */
133 #endif /* CDMREADERWRITER_H_ */
basic_string< char > string
boost::shared_ptr< Data > DataPtr
Definition: DataDecl.h:39
Definition: SliceBuilder.h:46
virtual void putDataSlice(const std::string &varName, size_t unLimDimPos, const DataPtr data)=0
data-writing function
virtual void putScaledDataSlice(const std::string &varName, size_t unLimDimPos, const DataPtr data)
unscale and write a dataslice
Definition: CDMReaderWriter.h:41
Definition: C_CDMReader.h:35
Basic interface for CDM reading and manipulation classes.
Definition: CDMReader.h:53
virtual void putScaledDataSliceInUnit(const std::string &varName, const std::string &unit, size_t unLimDimPos, const DataPtr data)
unscale and write a dataslice from a known unit
virtual void sync()=0
flush data to disc