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/dataaccess/memory/Band.h
22 
23  \brief Band implementation for the In-Memory Raster.
24 */
25 
26 #ifndef __TERRALIB_MEMORY_INTERNAL_BAND_H
27 #define __TERRALIB_MEMORY_INTERNAL_BAND_H
28 
29 // TerraLib
30 #include "../raster/Band.h"
31 #include "../raster/BlockUtils.h"
32 #include "Config.h"
33 
34 namespace te
35 {
36  namespace mem
37  {
38 // Forward declaration
39  class Raster;
40 
41  /*!
42  \class Band
43 
44  \brief Band implementation for the In-Memory Raster.
45  */
47  {
48  public:
49 
50  /*!
51  \param externalBuffer If provided the band will use the referenced buffer and will not deallocate it at the end.
52  */
53  Band(Raster* r, te::rst::BandProperty* p, std::size_t idx, void* externalBuffer = 0);
54 
55  Band(const Band& rhs);
56 
57  ~Band();
58 
59  te::rst::Raster* getRaster() const;
60 
61  Band& operator=(const Band& rhs);
62 
63  void getValue(unsigned int c, unsigned int r, double& value) const;
64 
65  void setValue(unsigned int c, unsigned int r, const double value);
66 
67  void getIValue(unsigned int c, unsigned int r, double& value) const;
68 
69  void setIValue(unsigned int c, unsigned int r, const double value);
70 
71  void read(int x, int y, void* buffer) const;
72 
73  void* read(int x, int y);
74 
75  void write(int x, int y, void* buffer);
76 
77  /*!
78  \note In-Memory driver extended method.
79  */
80  void setRaster(Raster* r);
81 
82  int getBlockSize() const;
83 
84  private:
85 
87  unsigned char* m_buff; //!< A pointer to a block buffer.
88  te::rst::GetBufferValueFPtr m_getBuff; //!< A pointer to a function that helps to extract a double or complex value from a specific buffer data type (char, int16, int32, float, ...).
89  te::rst::GetBufferValueFPtr m_getBuffI; //!< A pointer to a function that helps to extract the imaginary part value from a specific buffer data type (cint16, cint32, cfloat, cdouble).
90  te::rst::SetBufferValueFPtr m_setBuff; //!< A pointer to a function that helps to insert a double or complex value into a specific buffer data type (char, int16, int32, float, ...).
91  te::rst::SetBufferValueFPtr m_setBuffI; //!< A pointer to a function that helps to insert the imaginary part value into a specific buffer data type (cint16, cint32, cfloat, cdouble).
92  int m_ncols; //!< Buffered number of cols.
93  int m_nrows; //!< Buffered number of rows.
94  int m_blksize; //!< The data block size.
95  bool m_releaseBuffer; //!< A flag that indicates if the buffer must be released when the band goes out of scope.
96  };
97 
98  } // end namespace mem
99 } // end namespace te
100 
101 #endif // __TERRALIB_MEMORY_INTERNAL_BAND_H
A raster class for memory.
Definition: Raster.h:44
te::rst::GetBufferValueFPtr m_getBuffI
A pointer to a function that helps to extract the imaginary part value from a specific buffer data ty...
Definition: Band.h:89
#define TEMEMORYEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:84
A raster band description.
Definition: BandProperty.h:61
int m_nrows
Buffered number of rows.
Definition: Band.h:93
Raster * m_raster
Definition: Band.h:86
int m_blksize
The data block size.
Definition: Band.h:94
Configuration flags for the TerraLib In-memory Data Access driver.
void(* SetBufferValueFPtr)(int index, void *buffer, const double *value)
The type of function used to extract data from a buffer.
Definition: BlockUtils.h:40
te::rst::SetBufferValueFPtr m_setBuffI
A pointer to a function that helps to insert the imaginary part value into a specific buffer data typ...
Definition: Band.h:91
te::rst::GetBufferValueFPtr m_getBuff
A pointer to a function that helps to extract a double or complex value from a specific buffer data t...
Definition: Band.h:88
void(* GetBufferValueFPtr)(int index, void *buffer, double *value)
The type of function used to extract data from a buffer.
Definition: BlockUtils.h:37
te::rst::SetBufferValueFPtr m_setBuff
A pointer to a function that helps to insert a double or complex value into a specific buffer data ty...
Definition: Band.h:90
An abstract class for raster data strucutures.
Definition: Raster.h:71
URI C++ Library.
bool m_releaseBuffer
A flag that indicates if the buffer must be released when the band goes out of scope.
Definition: Band.h:95
A raster band description.
Definition: Band.h:63
Band implementation for the In-Memory Raster.
Definition: Band.h:46
int m_ncols
Buffered number of cols.
Definition: Band.h:92
unsigned char * m_buff
A pointer to a block buffer.
Definition: Band.h:87