MI - Fimex
IndexedData.h
Go to the documentation of this file.
1 /*
2  * Fimex, IndexedData.h
3  *
4  * (C) Copyright 2012, 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: Jul 18, 2012
24  * Author: Heiko Klein
25  */
26 
27 #ifndef INDEXEDDATA_H_
28 #define INDEXEDDATA_H_
29 
30 #include <vector>
31 #include "fimex/DataDecl.h"
32 #include "fimex/DataIndex.h"
33 
34 namespace MetNoFimex
35 {
36 
37 // forward decl
38 class IndexedDataImpl;
39 
44 {
45 public:
46  IndexedData();
52  explicit IndexedData(DataPtr data, std::vector<std::size_t> dimSizes);
53  ~IndexedData();
68  const DataIndex& idx() const;
72  DataPtr getDataPtr() const;
83  double getDouble(size_t pos) const;
85  double getDouble(size_t a, size_t b) const {return getDouble(idx().getPos(a,b));}
87  double getDouble(size_t a, size_t b, size_t c) const {return getDouble(idx().getPos(a,b,c));}
89  double getDouble(size_t a, size_t b, size_t c, size_t d) const {return getDouble(idx().getPos(a,b,c,d));}
94  long long getLongLong(size_t pos) const;
96  double getLongLong(size_t a, size_t b) const {return getLongLong(idx().getPos(a,b));}
98  double getLongLong(size_t a, size_t b, size_t c) const {return getLongLong(idx().getPos(a,b,c));}
100  double getLongLong(size_t a, size_t b, size_t c, size_t d) const {return getLongLong(idx().getPos(a,b,c,d));}
101 private:
102  boost::shared_ptr<IndexedDataImpl> p_;
103  void init(DataPtr data, std::vector<std::size_t> dimSizes);
104 
105 };
106 
107 } /* namespace MetNoFimex */
108 #endif /* INDEXEDDATA_H_ */
double getDouble(size_t a, size_t b, size_t c) const
shortcut for 3d
Definition: IndexedData.h:87
boost::shared_ptr< Data > DataPtr
Definition: DataDecl.h:39
Definition: DataIndex.h:39
double getDouble(size_t pos) const
DataPtr getDataPtr() const
Definition: C_CDMReader.h:35
double getLongLong(size_t a, size_t b) const
shortcut for 2d
Definition: IndexedData.h:96
const DataIndex & idx() const
get the index belonging to the data
double getLongLong(size_t a, size_t b, size_t c) const
shortcut for 3d
Definition: IndexedData.h:98
double getDouble(size_t a, size_t b, size_t c, size_t d) const
shortcut for 4d
Definition: IndexedData.h:89
double getLongLong(size_t a, size_t b, size_t c, size_t d) const
shortcut for 4d
Definition: IndexedData.h:100
void setDims(std::vector< std::size_t > dims)
set the dimension sizes of data
double getDouble(size_t a, size_t b) const
shortcut for 2d
Definition: IndexedData.h:85
Definition: IndexedData.h:43
long long getLongLong(size_t pos) const