| 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/TeDecoderMemoryMap.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_DECODERMEMORYMAP_H
    00027 #define  __TERRALIB_INTERNAL_DECODERMEMORYMAP_H
    00028
    00029 #include "TeDecoder.h"
    00030
    00031 #ifdef WIN32
    00032 #include <windows.h>
    00033 #include <winbase.h>
    00034 #else
    00035 #include <sys/mman.h>
    00036 #endif
    00037
    00038
    00040 /*
    00041            Due to limits set by the operating system, the maximum amount of data you can map
    00042            with a single instance of a memory map is 2^31 - 1 (or 2 GB).
    00043 */
    00044 class TL_DLL TeDecoderMemoryMap : public TeDecoder
    00045 {
    00046 public:
    00048            TeDecoderMemoryMap ( const TeRasterParams& );
    00049
    00051            ~TeDecoderMemoryMap ();
    00052
    00054            bool setElement (int col,int lin, double val, int band=0);
    00055
    00057            bool getElement (int col,int lin, double &val,int band=0);
    00058
    00060            virtual void init();
    00061
    00063            virtual bool clear();
    00064
    00065 private:
    00066            long       dataInitPos_;
    00067 #ifdef WIN32
    00068 // Windows support to file memory mapping
    00069            HANDLE  m_hFile;                            // Handle to file we're currently zapping
    00070            HANDLE     m_hMapping;                                 // Handle to memory-mapping of that file
    00071            LPVOID  m_lpszFile;                         // Pointer to view of file mapped to memory
    00072            DWORD      m_dwSize;
    00073 #else
    00074 // Linux support to file memory mapping
    00075            int        m_hFile;                         //(fd) Handle to file we're currently zapping
    00076            void*      m_lpszFile;                                 // Pointer to view of file mapped to memory
    00077            off_t      m_dwSize;
    00078 #endif
    00079 };
    00080
    00082 class TL_DLL TeDecoderMemoryMapFactory : public TeDecoderFactory
    00083 {
    00084 public:
    00085
    00087            TeDecoderMemoryMapFactory(const string& name);
    00088
    00090            virtual TeDecoder* build (const TeRasterParams& arg)
    00091            {  return new TeDecoderMemoryMap(arg); }
    00092 };
    00093 #endif
    00094

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines