MI - Fimex
WdbCDMReader.h
Go to the documentation of this file.
1 /*
2  fimex
3 
4  Copyright (C) 2011 met.no
5 
6  Contact information:
7  Norwegian Meteorological Institute
8  Box 43 Blindern
9  0313 OSLO
10  NORWAY
11  E-mail: post@met.no
12 
13  This program is free software; you can redistribute it and/or modify
14  it under the terms of the GNU General Public License as published by
15  the Free Software Foundation; either version 2 of the License, or
16  (at your option) any later version.
17 
18  This program is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  GNU General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with this program; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26  MA 02110-1301, USA
27  */
28 
29 #ifndef WDBCDMREADER_H_
30 #define WDBCDMREADER_H_
31 
32 #ifndef MIFI_IO_READER_SUPPRESS_DEPRECATED
33 #warning \
34  This header-file is deprecated and \
35  may be removed without further notice at a future date. Please use a \
36  non-deprecated interface with equivalent functionality instead, i.e. \
37  instead of \
38  *CDMReader(file,config) \
39  use \
40  CDMFileReaderFactory::create(MIFI_FILETYPE_*,file,config)
41 #endif
42 
43 #include "fimex/CDMReader.h"
44 #include "fimex/XMLInput.h"
45 #include <string>
46 
47 
48 
49 
50 namespace MetNoFimex
51 {
52 
83 class WdbCDMReader: public CDMReader
84 {
85 public:
86 
92  WdbCDMReader(const std::string& source, const XMLInput& configXML);
93 
94  WdbCDMReader(const std::string& source, const std::string & configFile );
95 
96 
97  virtual ~WdbCDMReader();
98 
99  virtual DataPtr getDataSlice(const std::string& varName, size_t unLimDimPos);
100 
101  virtual DataPtr getDataSlice(const std::string& varName, const SliceBuilder& sb);
102 
103 private:
104  std::size_t getXSize(const CDMVariable& variable) const;
105  std::size_t getYSize(const CDMVariable& variable) const;
106  std::size_t getGridSize(const CDMVariable& variable) const;
107  DataPtr extractDataFromField(const CDMVariable& variable, const std::vector<long long> & fieldIdentifiers) const;
108 
109  DataPtr cutGrid(const DataPtr & d, const CDMVariable& variable, const SliceBuilder & sb) const;
110 
111  DataPtr getDatabaseFields(const CDMVariable& variable, size_t unLimDimPos) const;
112  DataPtr getDatabaseFields(const CDMVariable& variable, const SliceBuilder & sb) const;
113 
114  class InternalData;
115  InternalData * d_;
116 };
117 
118 
119 }
120 
121 #endif /* WDBCDMREADER_H_ */
basic_string< char > string
boost::shared_ptr< Data > DataPtr
Definition: DataDecl.h:39
virtual DataPtr getDataSlice(const std::string &varName, size_t unLimDimPos)
data-reading function to be called from the CDMWriter
Definition: WdbCDMReader.h:83
Definition: SliceBuilder.h:46
STL class.
Definition: C_CDMReader.h:35
Basic interface for CDM reading and manipulation classes.
Definition: CDMReader.h:53
Definition: XMLInput.h:49
Definition: CDMVariable.h:41
WdbCDMReader(const std::string &source, const XMLInput &configXML)