Loading...
Searching...
No Matches
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
34namespace 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
58
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
Band implementation for the In-Memory Raster.
Definition: Band.h:47
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
int getBlockSize() const
It returns the number of bytes ocuppied by a data block.
void setIValue(unsigned int c, unsigned int r, const double value)
Sets the imaginary attribute value in a complex band of a cell.
void write(int x, int y, void *buffer)
It writes a data block from the specified buffer.
Band(const Band &rhs)
int m_ncols
Buffered number of cols.
Definition: Band.h:92
void setValue(unsigned int c, unsigned int r, const double value)
Sets the cell attribute value.
void getIValue(unsigned int c, unsigned int r, double &value) const
Returns the imaginary attribute value in a complex band of a cell.
Raster * m_raster
Definition: Band.h:86
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
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
te::rst::Raster * getRaster() const
Returns the associated raster.
Band(Raster *r, te::rst::BandProperty *p, std::size_t idx, void *externalBuffer=0)
int m_blksize
The data block size.
Definition: Band.h:94
bool m_releaseBuffer
A flag that indicates if the buffer must be released when the band goes out of scope.
Definition: Band.h:95
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
int m_nrows
Buffered number of rows.
Definition: Band.h:93
void read(int x, int y, void *buffer) const
It reads a data block to the specified buffer.
void setRaster(Raster *r)
void * read(int x, int y)
It reads and returns a data block.
void getValue(unsigned int c, unsigned int r, double &value) const
Returns the cell attribute value.
unsigned char * m_buff
A pointer to a block buffer.
Definition: Band.h:87
~Band()
Virtual destructor.
Band & operator=(const Band &rhs)
A raster class for memory.
Definition: Raster.h:45
A raster band description.
Definition: BandProperty.h:62
A raster band description.
Definition: Band.h:64
An abstract class for raster data strucutures.
Definition: Raster.h:72
void(* SetBufferValueFPtr)(int index, void *buffer, const double *value)
The type of function used to extract data from a buffer.
Definition: BlockUtils.h:40
void(* GetBufferValueFPtr)(int index, void *buffer, double *value)
The type of function used to extract data from a buffer.
Definition: BlockUtils.h:37
TerraLib.
#define TEMEMORYEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:84
Proxy configuration file for TerraView (see terraview_config.h).