| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeDecoderMemory.h
Go to the documentation of this file.

    00001 /************************************************************************************
    00002 TerraLib - a library for developing GIS applications.
    00003 Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio.
    00004
    00005 This code is part of the TerraLib library.
    00006 This library is free software; you can redistribute it and/or
    00007 modify it under the terms of the GNU Lesser General Public
    00008 License as published by the Free Software Foundation; either
    00009 version 2.1 of the License, or (at your option) any later version.
    00010
    00011 You should have received a copy of the GNU Lesser General Public
    00012 License along with this library.
    00013
    00014 The authors reassure the license terms regarding the warranties.
    00015 They specifically disclaim any warranties, including, but not limited to,
    00016 the implied warranties of merchantability and fitness for a particular purpose.
    00017 The library provided hereunder is on an "as is" basis, and the authors have no
    00018 obligation to provide maintenance, support, updates, enhancements, or modifications.
    00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
    00020 indirect, special, incidental, or consequential damages arising out of the use
    00021 of this library and its documentation.
    00022 *************************************************************************************/
    00026 #ifndef  __TERRALIB_INTERNAL_DECODERMEMORY_H
    00027 #define  __TERRALIB_INTERNAL_DECODERMEMORY_H
    00028
    00029 #include "TeDecoder.h"
    00030
    00032 /*
    00033            This classes tries to allocate the matrix in the memory RAM. No strategies or policies
    00034            to allocate huge matrices are applied. It also doesn't support multiple bands with different types.
    00035            For overcome this limitations use the class TeDecoderSmartMem.
    00036            \sa TeDecoderSmartMem
    00037 */
    00038 class TL_DLL TeDecoderMemory : public TeDecoder
    00039 {
    00040 public:
    00042            TeDecoderMemory();
    00043
    00045            TeDecoderMemory (const TeRasterParams& par);
    00046
    00048            ~TeDecoderMemory ();
    00049
    00051            bool setElement (int col,int lin, double val, int band=0);
    00052
    00054            bool getElement (int col,int lin, double &val,int band=0);
    00055
    00057            /*
    00058                       \note This method is applicable only when band interleaved organization
    00059            */
    00060            void* data (int band=0);
    00061
    00063            void init();
    00064
    00066            bool clear();
    00067
    00069            bool allocateMemory();
    00070
    00072            bool resetMemory();
    00073
    00074 private:
    00075
    00076            unsigned int nelems_;
    00077            unsigned int size_;
    00078
    00080            typedef void (TeDecoderMemory::*GetEleFunctPtrT)( const long& pos, double& val );
    00081
    00083            typedef void (TeDecoderMemory::*SetEleFunctPtrT)( const long& pos, const double& val );
    00084
    00086            GetEleFunctPtrT getelement_ptr_;
    00087
    00089            SetEleFunctPtrT setelement_ptr_;
    00090
    00092            unsigned char* data_TeUNSIGNEDCHAR_;
    00093
    00095            char* data_TeCHAR_;
    00096
    00098            unsigned short* data_TeUNSIGNEDSHORT_;
    00099
    00101            short* data_TeSHORT_;
    00102
    00104            int* data_TeINTEGER_;
    00105
    00107            unsigned long* data_TeUNSIGNEDLONG_;
    00108
    00110            long* data_TeLONG_;
    00111
    00113            float* data_TeFLOAT_;
    00114
    00116            double* data_TeDOUBLE_;
    00117
    00119            void updateFuncPtr();
    00120
    00127            inline void setElement_TeUNSIGNEDCHAR( const long& pos, const double& val );
    00128
    00135            inline void setElement_TeCHAR( const long& pos, const double& val );
    00136
    00143            inline void setElement_TeUNSIGNEDSHORT( const long& pos, const double& val );
    00144
    00151            inline void setElement_TeSHORT( const long& pos, const double& val );
    00152
    00159            inline void setElement_TeINTEGER( const long& pos, const double& val );
    00160
    00167            inline void setElement_TeUNSIGNEDLONG( const long& pos, const double& val );
    00168
    00175            inline void setElement_TeLONG( const long& pos, const double& val );
    00176
    00183            inline void setElement_TeFLOAT( const long& pos, const double& val );
    00184
    00191            inline void setElement_TeDOUBLE( const long& pos, const double& val );
    00192
    00199            inline void getElement_TeUNSIGNEDCHAR( const long& pos, double& val );
    00200
    00207            inline void getElement_TeCHAR( const long& pos, double& val );
    00208
    00215            inline void getElement_TeUNSIGNEDSHORT( const long& pos, double& val );
    00216
    00223            inline void getElement_TeSHORT( const long& pos, double& val );
    00224
    00231            inline void getElement_TeINTEGER( const long& pos, double& val );
    00232
    00239            inline void getElement_TeUNSIGNEDLONG( const long& pos, double& val );
    00240
    00247            inline void getElement_TeLONG( const long& pos, double& val );
    00248
    00255            inline void getElement_TeFLOAT( const long& pos, double& val );
    00256
    00263            inline void getElement_TeDOUBLE( const long& pos, double& val );
    00264 };
    00265
    00267 class TL_DLL TeDecoderMemoryFactory : public TeDecoderFactory
    00268 {
    00269 public:
    00270
    00272            TeDecoderMemoryFactory(const string& name) : TeDecoderFactory(name) {}
    00273
    00275            TeDecoder* build (const TeRasterParams& arg)
    00276            {  return new TeDecoderMemory(arg); }
    00277 };
    00278 #endif
    00279

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines