LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/mem - ogr_mem.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 4 3 75.0 %
Date: 2012-04-28 Functions: 4 3 75.0 %

       1                 : /******************************************************************************
       2                 :  * $Id: ogr_mem.h 24174 2012-03-29 21:10:56Z rouault $
       3                 :  *
       4                 :  * Project:  OpenGIS Simple Features Reference Implementation
       5                 :  * Purpose:  Private definitions within the OGR Memory driver.
       6                 :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2003, Frank Warmerdam <warmerdam@pobox.com>
      10                 :  *
      11                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      12                 :  * copy of this software and associated documentation files (the "Software"),
      13                 :  * to deal in the Software without restriction, including without limitation
      14                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15                 :  * and/or sell copies of the Software, and to permit persons to whom the
      16                 :  * Software is furnished to do so, subject to the following conditions:
      17                 :  *
      18                 :  * The above copyright notice and this permission notice shall be included
      19                 :  * in all copies or substantial portions of the Software.
      20                 :  *
      21                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      22                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      24                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      27                 :  * DEALINGS IN THE SOFTWARE.
      28                 :  ****************************************************************************/
      29                 : 
      30                 : #ifndef _OGRMEM_H_INCLUDED
      31                 : #define _OGRMEM_H_INCLUDED
      32                 : 
      33                 : #include "ogrsf_frmts.h"
      34                 : 
      35                 : /************************************************************************/
      36                 : /*                             OGRMemLayer                              */
      37                 : /************************************************************************/
      38                 : 
      39                 : class OGRMemLayer : public OGRLayer
      40                 : {
      41                 :     OGRSpatialReference *poSRS;
      42                 :     OGRFeatureDefn     *poFeatureDefn;
      43                 :     
      44                 :     int                 nFeatureCount;
      45                 :     int                 nMaxFeatureCount;
      46                 :     OGRFeature        **papoFeatures;
      47                 : 
      48                 :     int                 iNextReadFID;
      49                 :     int                 iNextCreateFID;
      50                 : 
      51                 :     OGRwkbGeometryType  eWkbType;
      52                 : 
      53                 :     int                 bUpdatable;
      54                 :     int                 bAdvertizeUTF8;
      55                 : 
      56                 :     int                 bHasHoles;
      57                 : 
      58                 :   public:
      59                 :                         OGRMemLayer( const char * pszName,
      60                 :                                      OGRSpatialReference *poSRS,
      61                 :                                      OGRwkbGeometryType eGeomType );
      62                 :                         ~OGRMemLayer();
      63                 : 
      64                 :     void                ResetReading();
      65                 :     OGRFeature *        GetNextFeature();
      66                 :     virtual OGRErr      SetNextByIndex( long nIndex );
      67                 : 
      68                 :     OGRFeature         *GetFeature( long nFeatureId );
      69                 :     OGRErr              SetFeature( OGRFeature *poFeature );
      70                 :     OGRErr              CreateFeature( OGRFeature *poFeature );
      71                 :     virtual OGRErr      DeleteFeature( long nFID );
      72                 :     
      73               0 :     OGRFeatureDefn *    GetLayerDefn() { return poFeatureDefn; }
      74                 : 
      75                 :     int                 GetFeatureCount( int );
      76                 : 
      77                 :     virtual OGRErr      CreateField( OGRFieldDefn *poField,
      78                 :                                      int bApproxOK = TRUE );
      79                 :     virtual OGRErr      DeleteField( int iField );
      80                 :     virtual OGRErr      ReorderFields( int* panMap );
      81                 :     virtual OGRErr      AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn, int nFlags );
      82                 : 
      83                 :     virtual OGRSpatialReference *GetSpatialRef();
      84                 :     
      85                 :     int                 TestCapability( const char * );
      86                 : 
      87                 :     void                SetUpdatable(int bUpdatableIn) { bUpdatable = bUpdatableIn; }
      88                 :     void                SetAdvertizeUTF8(int bAdvertizeUTF8In) { bAdvertizeUTF8 = bAdvertizeUTF8In; }
      89                 : 
      90                 :     int                 GetNextReadFID() { return iNextReadFID; }
      91                 : };
      92                 : 
      93                 : /************************************************************************/
      94                 : /*                           OGRMemDataSource                           */
      95                 : /************************************************************************/
      96                 : 
      97                 : class OGRMemDataSource : public OGRDataSource
      98                 : {
      99                 :     OGRMemLayer     **papoLayers;
     100                 :     int                 nLayers;
     101                 :     
     102                 :     char                *pszName;
     103                 : 
     104                 :   public:
     105                 :                         OGRMemDataSource( const char *, char ** );
     106                 :                         ~OGRMemDataSource();
     107                 : 
     108              60 :     const char          *GetName() { return pszName; }
     109             350 :     int                 GetLayerCount() { return nLayers; }
     110                 :     OGRLayer            *GetLayer( int );
     111                 : 
     112                 :     virtual OGRLayer    *CreateLayer( const char *, 
     113                 :                                       OGRSpatialReference * = NULL,
     114                 :                                       OGRwkbGeometryType = wkbUnknown,
     115                 :                                       char ** = NULL );
     116                 :     OGRErr              DeleteLayer( int iLayer );
     117                 : 
     118                 :     int                 TestCapability( const char * );
     119                 : };
     120                 : 
     121                 : /************************************************************************/
     122                 : /*                             OGRMemDriver                             */
     123                 : /************************************************************************/
     124                 : 
     125                 : class OGRMemDriver : public OGRSFDriver
     126             389 : {
     127                 :   public:
     128                 :                 ~OGRMemDriver();
     129                 :                 
     130                 :     const char *GetName();
     131                 :     OGRDataSource *Open( const char *, int );
     132                 : 
     133                 :     virtual OGRDataSource *CreateDataSource( const char *pszName,
     134                 :                                              char ** = NULL );
     135                 :     
     136                 :     int                 TestCapability( const char * );
     137                 : };
     138                 : 
     139                 : 
     140                 : #endif /* ndef _OGRMEM_H_INCLUDED */

Generated by: LCOV version 1.7