Band.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/grib/Band.h
22 
23  \brief Band implemntatin for GRIB.
24 */
25 
26 #ifndef __TERRALIB_GRIB_INTERNAL_BAND_H
27 #define __TERRALIB_GRIB_INTERNAL_BAND_H
28 
29 // TerraLib
30 #include "../raster/Band.h"
31 #include "Config.h"
32 
33 // Grib API
34 #include <grib_api.h>
35 
36 namespace te
37 {
38  namespace grib
39  {
40 // Forward declaration
41  class Raster;
42 
43  /*!
44  \class Band
45 
46  \brief Band implemntatin for GRIB.
47  */
49  {
50  public:
51 
52  Band(Raster* r, std::size_t idx, grib_handle* handle);
53 
54  Band(const Band& rhs);
55 
56  ~Band();
57 
58  te::rst::Raster* getRaster() const;
59 
60  Band& operator=(const Band& rhs);
61 
62  void getValue(unsigned int c, unsigned int r, double& value) const;
63 
64  void setValue(unsigned int c, unsigned int r, const double value);
65 
66  void getIValue(unsigned int c, unsigned int r, double& value) const;
67 
68  void setIValue(unsigned int c, unsigned int r, const double value);
69 
70  void read(int x, int y, void* buffer) const;
71 
72  void* read(int x, int y);
73 
74  void write(int x, int y, void* buffer);
75 
76  grib_handle* getHandle() const;
77 
78  long getLong(const char* key) const;
79 
80  double getDouble(const char* key) const;
81 
82  std::string getString(const char* key) const;
83 
84  static std::string getErrMsg(int errCode);
85 
86  private:
87 
88  Raster* m_raster; //!< The associated raster.
89  grib_handle* m_handle; //!< The grib handle.
90  double* m_data; //!< The matrix data.
91  };
92 
93  } // end namespace grib
94 } // end namespace te
95 
96 #endif // __TERRALIB_GRIB_INTERNAL_BAND_H
97 
grib_handle * m_handle
The grib handle.
Definition: Band.h:89
An abstract class for raster data strucutures.
Definition: Raster.h:71
URI C++ Library.
Configuration flags for GRIB.
A raster band description.
Definition: Band.h:63
double * m_data
The matrix data.
Definition: Band.h:90
Band implemntatin for GRIB.
Definition: Band.h:48
A raster class for GRIB format.
Definition: Raster.h:51
#define TEGRIBEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:110
Raster * m_raster
The associated raster.
Definition: Band.h:88