LTP GCOV extension - code coverage report
Current view: directory - ogr/ogrsf_frmts/tiger - ogr_tiger.h
Test: gdal_filtered.info
Date: 2010-07-12 Instrumented lines: 14
Code covered: 14.3 % Executed lines: 2

       1                 : /*-*-C++-*-*/
       2                 : /******************************************************************************
       3                 :  * $Id: ogr_tiger.h 17224 2009-06-07 20:20:23Z rouault $
       4                 :  *
       5                 :  * Project:  TIGER/Line Translator
       6                 :  * Purpose:  Main declarations for Tiger translator.
       7                 :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       8                 :  *
       9                 :  ******************************************************************************
      10                 :  * Copyright (c) 1999, Frank Warmerdam
      11                 :  *
      12                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      13                 :  * copy of this software and associated documentation files (the "Software"),
      14                 :  * to deal in the Software without restriction, including without limitation
      15                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      16                 :  * and/or sell copies of the Software, and to permit persons to whom the
      17                 :  * Software is furnished to do so, subject to the following conditions:
      18                 :  *
      19                 :  * The above copyright notice and this permission notice shall be included
      20                 :  * in all copies or substantial portions of the Software.
      21                 :  *
      22                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      23                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      24                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      25                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      26                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      27                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      28                 :  * DEALINGS IN THE SOFTWARE.
      29                 :  ****************************************************************************/
      30                 : 
      31                 : #ifndef _OGR_TIGER_H_INCLUDED
      32                 : #define _OGR_TIGER_H_INCLUDED
      33                 : 
      34                 : #include "cpl_conv.h"
      35                 : #include "ogrsf_frmts.h"
      36                 : 
      37                 : class OGRTigerDataSource;
      38                 : 
      39                 : /*
      40                 : ** TIGER Versions
      41                 : **
      42                 : ** 0000           TIGER/Line Precensus Files, 1990
      43                 : ** 0002           TIGER/Line Initial Voting District Codes Files, 1990
      44                 : ** 0003           TIGER/Line Files, 1990
      45                 : ** 0005           TIGER/Line Files, 1992
      46                 : ** 0021           TIGER/Line Files, 1994
      47                 : ** 0024           TIGER/Line Files, 1995
      48                 : ** 0697 to 1098   TIGER/Line Files, 1997
      49                 : ** 1298 to 0499   TIGER/Line Files, 1998
      50                 : ** 0600 to 0800   TIGER/Line Files, 1999
      51                 : ** 1000 to 1100   TIGER/Line Files, Redistricting Census 2000
      52                 : ** 0301 to 0801   TIGER/Line Files, Census 2000
      53                 : **
      54                 : ** 0302 to 0502   TIGER/Line Files, UA 2000
      55                 : ** ????    ????
      56                 : **
      57                 : ** 0602  & higher TIGER/Line Files, 2002
      58                 : ** ????    ????
      59                 : */
      60                 : 
      61                 : typedef enum {
      62                 :     TIGER_1990_Precensus = 0,
      63                 :     TIGER_1990 = 1,
      64                 :     TIGER_1992 = 2,
      65                 :     TIGER_1994 = 3,
      66                 :     TIGER_1995 = 4,
      67                 :     TIGER_1997 = 5,
      68                 :     TIGER_1998 = 6,
      69                 :     TIGER_1999 = 7,
      70                 :     TIGER_2000_Redistricting = 8,
      71                 :     TIGER_2000_Census = 9,
      72                 :     TIGER_UA2000 = 10,
      73                 :     TIGER_2002 = 11,
      74                 :     TIGER_2003 = 12,
      75                 :     TIGER_2004 = 13,
      76                 :     TIGER_Unknown
      77                 : } TigerVersion;
      78                 : 
      79                 : TigerVersion TigerClassifyVersion( int );
      80                 : const char * TigerVersionString( TigerVersion );
      81                 : 
      82                 : /*****************************************************************************/
      83                 : /* The TigerFieldInfo and TigerRecordInfo structures hold information about  */
      84                 : /* the schema of a TIGER record type.  In each layer implementation file     */
      85                 : /* there are statically initalized variables of these types that describe    */
      86                 : /* the record types associated with that layer.  In the case where different */
      87                 : /* TIGER versions have different schemas, there is a                         */
      88                 : /* TigerFieldInfo/TigerRecordInfo for each version, and the constructor      */
      89                 : /* for the layer chooses a pointer to the correct set based on the version.  */
      90                 : /*****************************************************************************/
      91                 : 
      92                 : typedef struct TigerFieldInfo {
      93                 :   const char    *pszFieldName;  // name of the field
      94                 :   char          cFmt;           // format of the field ('L' or 'R')
      95                 :   char          cType;          // type of the field ('A' or 'N')
      96                 :   OGRFieldType  OGRtype;        // OFTType of the field (OFTInteger, OFTString, ...?)
      97                 :   int           nBeg;           // beginning column number for field
      98                 :   int           nEnd;           // ending column number for field
      99                 :   int           nLen;           // length of field
     100                 : 
     101                 :   int           bDefine;        // whether to add this field to the FeatureDefn
     102                 :   int           bSet;           // whether to set this field in GetFeature()
     103                 :   int           bWrite;         // whether to write this field in CreateFeature()
     104                 : } TigerFieldInfo;
     105                 : 
     106                 : typedef struct TigerRecordInfo {
     107                 :   TigerFieldInfo *pasFields;
     108                 :   int             nFieldCount;
     109                 :   int             nRecordLength;
     110                 : } TigerRecordInfo;
     111                 : 
     112                 : // OGR_TIGER_RECBUF_LEN should be a number that is larger than the
     113                 : // longest possible record length for any record type; it's used to
     114                 : // create arrays to hold the records.  At the time of this writing the
     115                 : // longest record (RT1) has length 228, but I'm choosing 500 because
     116                 : // it's a good round number and will allow for growth without having
     117                 : // to modify this file.  The code never holds more than a few records
     118                 : // in memory at a time, so having OGR_TIGER_RECBUF_LEN be much larger
     119                 : // than is really necessary won't affect the amount of memory required
     120                 : // in a substantial way.
     121                 : // mbp Fri Dec 20 19:19:59 2002
     122                 : #define OGR_TIGER_RECBUF_LEN 500
     123                 : 
     124                 : /************************************************************************/
     125                 : /*                            TigerFileBase                             */
     126                 : /************************************************************************/
     127                 : 
     128                 : class TigerFileBase
     129                 : {
     130                 : protected:
     131                 :   OGRTigerDataSource  *poDS;
     132                 : 
     133                 :   char                *pszModule;
     134                 :   char                *pszShortModule;
     135                 :   FILE                *fpPrimary;
     136                 : 
     137                 :   OGRFeatureDefn      *poFeatureDefn;
     138                 : 
     139                 :   int                 nFeatures;
     140                 :   int                 nRecordLength;
     141                 : 
     142                 :   int                 OpenFile( const char *, const char * );
     143                 :   void                EstablishFeatureCount();
     144                 : 
     145                 :   static int          EstablishRecordLength( FILE * );
     146                 : 
     147                 :   void                SetupVersion();
     148                 : 
     149                 :   int                 nVersionCode;
     150                 :   TigerVersion        nVersion;
     151                 : 
     152                 : public:
     153                 :                       TigerFileBase();
     154                 :   virtual            ~TigerFileBase();
     155                 : 
     156                 :   TigerVersion        GetVersion() { return nVersion; }
     157                 :   int                 GetVersionCode() { return nVersionCode; }
     158                 : 
     159               0 :   virtual const char *GetShortModule() { return pszShortModule; }
     160               0 :   virtual const char *GetModule() { return pszModule; }
     161                 :   virtual int         SetModule( const char * ) = 0;
     162                 :   virtual int         SetWriteModule( const char *, int, OGRFeature * );
     163                 : 
     164               0 :   virtual int         GetFeatureCount() { return nFeatures; }
     165                 :   virtual OGRFeature *GetFeature( int ) = 0;
     166                 : 
     167               0 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature )
     168               0 :                                 { return OGRERR_FAILURE; }
     169                 : 
     170               0 :   OGRFeatureDefn     *GetFeatureDefn() { return poFeatureDefn; }
     171                 : 
     172                 :   static CPLString    GetField( const char *, int, int );
     173                 :   static void         SetField( OGRFeature *, const char *, const char *,
     174                 :                                 int, int );
     175                 : 
     176                 :   int                 WriteField( OGRFeature *, const char *, char *,
     177                 :                                   int, int, char, char );
     178                 :   int                 WriteRecord( char *pachRecord, int nRecLen,
     179                 :                                    const char *pszType, FILE *fp = NULL );
     180                 :   int                 WritePoint( char *pachRecord, int nStart,
     181                 :                                   double dfX, double dfY );
     182                 : 
     183                 :  protected:
     184                 :   void                WriteFields(TigerRecordInfo *psRTInfo,
     185                 :                                   OGRFeature      *poFeature,
     186                 :                                   char            *szRecord);
     187                 : 
     188                 :   void                AddFieldDefns(TigerRecordInfo *psRTInfo,
     189                 :                                     OGRFeatureDefn  *poFeatureDefn);
     190                 : 
     191                 : 
     192                 :   void                SetFields(TigerRecordInfo *psRTInfo,
     193                 :                                 OGRFeature      *poFeature,
     194                 :                                 char            *achRecord);
     195                 : 
     196                 : };
     197                 : 
     198                 : /************************************************************************/
     199                 : /*                          TigerCompleteChain                          */
     200                 : /************************************************************************/
     201                 : 
     202                 : class TigerCompleteChain : public TigerFileBase
     203                 : {
     204                 :   FILE               *fpShape;
     205                 :   int                *panShapeRecordId;
     206                 : 
     207                 :   FILE               *fpRT3;
     208                 :   int                 bUsingRT3;
     209                 :   int                 nRT1RecOffset;
     210                 : 
     211                 :   int                 GetShapeRecordId( int, int );
     212                 :   int                 AddShapePoints( int, int, OGRLineString *, int );
     213                 : 
     214                 :   void                AddFieldDefnsPre2002();
     215                 :   OGRFeature         *GetFeaturePre2002( int );
     216                 :   OGRErr              WriteRecordsPre2002( OGRFeature *, OGRLineString * );
     217                 : 
     218                 :   OGRErr              WriteRecords2002( OGRFeature *, OGRLineString * );
     219                 :   OGRFeature         *GetFeature2002( int );
     220                 :   void                AddFieldDefns2002();
     221                 : 
     222                 :   TigerRecordInfo    *psRT1Info;
     223                 :   TigerRecordInfo    *psRT2Info;
     224                 :   TigerRecordInfo    *psRT3Info;
     225                 : 
     226                 : public:
     227                 :                       TigerCompleteChain( OGRTigerDataSource *,
     228                 :                                           const char * );
     229                 :   virtual            ~TigerCompleteChain();
     230                 : 
     231                 :   virtual int         SetModule( const char * );
     232                 : 
     233                 :   virtual OGRFeature *GetFeature( int );
     234                 : 
     235                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     236                 : 
     237                 :   virtual int         SetWriteModule( const char *, int, OGRFeature * );
     238                 : };
     239                 : 
     240                 : /************************************************************************/
     241                 : /*                    TigerAltName (Type 4 records)                     */
     242                 : /************************************************************************/
     243                 : 
     244                 : class TigerAltName : public TigerFileBase
     245                 : {
     246                 :  private:
     247                 :   TigerRecordInfo    *psRT4Info;
     248                 : 
     249                 :  public:
     250                 :                       TigerAltName( OGRTigerDataSource *,
     251                 :                                           const char * );
     252                 :   virtual            ~TigerAltName();
     253                 : 
     254                 :   virtual int         SetModule( const char * );
     255                 : 
     256                 :   virtual OGRFeature *GetFeature( int );
     257                 : 
     258                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     259                 : };
     260                 : 
     261                 : /************************************************************************/
     262                 : /*                    TigerFeatureIds (Type 5 records)                  */
     263                 : /************************************************************************/
     264                 : 
     265                 : class TigerFeatureIds : public TigerFileBase
     266                 : {
     267                 :  private:
     268                 :   TigerRecordInfo    *psRT5Info;
     269                 : 
     270                 :  public:
     271                 :                       TigerFeatureIds( OGRTigerDataSource *,
     272                 :                                        const char * );
     273                 :   virtual            ~TigerFeatureIds();
     274                 : 
     275                 :   virtual int         SetModule( const char * );
     276                 : 
     277                 :   virtual OGRFeature *GetFeature( int );
     278                 : 
     279                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     280                 : };
     281                 : 
     282                 : /************************************************************************/
     283                 : /*                    TigerZipCodes (Type 6 records)                    */
     284                 : /************************************************************************/
     285                 : 
     286                 : class TigerZipCodes : public TigerFileBase
     287                 : {
     288                 :  private:
     289                 :   TigerRecordInfo    *psRT6Info;
     290                 : 
     291                 : public:
     292                 :                       TigerZipCodes( OGRTigerDataSource *, const char * );
     293                 :   virtual            ~TigerZipCodes();
     294                 : 
     295                 :   virtual int         SetModule( const char * );
     296                 : 
     297                 :   virtual OGRFeature *GetFeature( int );
     298                 : 
     299                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     300                 : };
     301                 : 
     302                 : /************************************************************************/
     303                 : /*                    TigerPoint                                        */
     304                 : /* This is an abstract base class for TIGER layers with point geometry. */
     305                 : /* Since much of the implementation of these layers is similar, I've    */
     306                 : /* put it into this base class to avoid duplication in the actual       */
     307                 : /* layer classes.  mbp Sat Jan  4 16:41:19 2003.                        */
     308                 : /************************************************************************/
     309                 : 
     310                 : class TigerPoint : public TigerFileBase
     311                 : {
     312                 :  protected:
     313                 :                       TigerPoint(int bRequireGeom);
     314                 : 
     315                 :                       // The boolean bRequireGeom indicates whether
     316                 :                       // the layer requires each feature to actual
     317                 :                       // have a geom.  It's used in CreateFeature() to
     318                 :                       // decide whether to report an error when a
     319                 :                       // missing geom is detected.
     320                 : 
     321                 :   virtual             ~TigerPoint();
     322                 : 
     323                 :  private:
     324                 :  int                  bRequireGeom;
     325                 : 
     326                 :  public:
     327                 :   virtual int         SetModule( const char *,
     328                 :                                  const char *pszFileCode );
     329                 : 
     330                 :   virtual OGRFeature *GetFeature( int              nRecordId,
     331                 :                                   TigerRecordInfo *psRTInfo,
     332                 :                                   int nX0, int nX1,
     333                 :                                   int nY0, int nY1 );
     334                 : 
     335                 : 
     336                 :   virtual OGRErr CreateFeature( OGRFeature      *poFeature,
     337                 :                                 TigerRecordInfo *psRTInfo,
     338                 :                                 int nIndex,
     339                 :                                 const char *pszFileCode );
     340                 : 
     341                 : };
     342                 : 
     343                 : /************************************************************************/
     344                 : /*                   TigerLandmarks (Type 7 records)                    */
     345                 : /************************************************************************/
     346                 : 
     347                 : class TigerLandmarks : public TigerPoint
     348                 : {
     349                 :  private:
     350                 :   TigerRecordInfo    *psRT7Info;
     351                 : 
     352                 :  public:
     353                 :                       TigerLandmarks( OGRTigerDataSource *, const char * );
     354                 :   virtual            ~TigerLandmarks();
     355                 : 
     356                 :   virtual int         SetModule( const char * );
     357                 : 
     358                 :   virtual OGRFeature *GetFeature( int );
     359                 : 
     360                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     361                 : };
     362                 : 
     363                 : /************************************************************************/
     364                 : /*                   TigerAreaLandmarks (Type 8 records)                */
     365                 : /************************************************************************/
     366                 : 
     367                 : class TigerAreaLandmarks : public TigerFileBase
     368                 : {
     369                 :  private:
     370                 :   TigerRecordInfo    *psRT8Info;
     371                 : 
     372                 : public:
     373                 :                       TigerAreaLandmarks( OGRTigerDataSource *, const char * );
     374                 :   virtual            ~TigerAreaLandmarks();
     375                 : 
     376                 :   virtual int         SetModule( const char * );
     377                 : 
     378                 :   virtual OGRFeature *GetFeature( int );
     379                 : 
     380                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     381                 : };
     382                 : 
     383                 : /************************************************************************/
     384                 : /*                   TigerKeyFeatures (Type 9 records)                  */
     385                 : /************************************************************************/
     386                 : 
     387                 : class TigerKeyFeatures : public TigerFileBase
     388                 : {
     389                 :  private:
     390                 :   TigerRecordInfo    *psRT9Info;
     391                 : 
     392                 : public:
     393                 :                       TigerKeyFeatures( OGRTigerDataSource *, const char * );
     394                 :   virtual            ~TigerKeyFeatures();
     395                 : 
     396                 :   virtual int         SetModule( const char * );
     397                 : 
     398                 :   virtual OGRFeature *GetFeature( int );
     399                 : 
     400                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     401                 : };
     402                 : 
     403                 : /************************************************************************/
     404                 : /*                   TigerPolygon (Type A&S records)                    */
     405                 : /************************************************************************/
     406                 : 
     407                 : class TigerPolygon : public TigerFileBase
     408                 : {
     409                 :  private:
     410                 :   TigerRecordInfo    *psRTAInfo;
     411                 :   TigerRecordInfo    *psRTSInfo;
     412                 : 
     413                 :   FILE               *fpRTS;
     414                 :   int                 bUsingRTS;
     415                 :   int                 nRTSRecLen;
     416                 : 
     417                 : public:
     418                 :                       TigerPolygon( OGRTigerDataSource *, const char * );
     419                 :   virtual            ~TigerPolygon();
     420                 : 
     421                 :   virtual int         SetModule( const char * );
     422                 : 
     423                 :   virtual OGRFeature *GetFeature( int );
     424                 : 
     425                 :   virtual int         SetWriteModule( const char *, int, OGRFeature * );
     426                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     427                 : };
     428                 : 
     429                 : /************************************************************************/
     430                 : /*                    TigerPolygonCorrections (Type B records)          */
     431                 : /************************************************************************/
     432                 : 
     433                 : class TigerPolygonCorrections : public TigerFileBase
     434                 : {
     435                 :  private:
     436                 :   TigerRecordInfo    *psRTBInfo;
     437                 : 
     438                 : public:
     439                 :                       TigerPolygonCorrections( OGRTigerDataSource *, const char * );
     440                 :   virtual            ~TigerPolygonCorrections();
     441                 : 
     442                 :   virtual int         SetModule( const char * );
     443                 : 
     444                 :   virtual OGRFeature *GetFeature( int );
     445                 : 
     446                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     447                 : };
     448                 : 
     449                 : /************************************************************************/
     450                 : /*                  TigerEntityNames (Type C records)                   */
     451                 : /************************************************************************/
     452                 : 
     453                 : class TigerEntityNames : public TigerFileBase
     454                 : {
     455                 :  private:
     456                 :   TigerRecordInfo    *psRTCInfo;
     457                 : 
     458                 : public:
     459                 :                       TigerEntityNames( OGRTigerDataSource *, const char * );
     460                 :   virtual            ~TigerEntityNames();
     461                 : 
     462                 :   virtual int         SetModule( const char * );
     463                 : 
     464                 :   virtual OGRFeature *GetFeature( int );
     465                 : 
     466                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     467                 : };
     468                 : 
     469                 : /************************************************************************/
     470                 : /*                    TigerPolygonEconomic (Type E records)             */
     471                 : /************************************************************************/
     472                 : 
     473                 : class TigerPolygonEconomic : public TigerFileBase
     474                 : {
     475                 :  private:
     476                 :   TigerRecordInfo    *psRTEInfo;
     477                 : 
     478                 : public:
     479                 :                       TigerPolygonEconomic( OGRTigerDataSource *, const char * );
     480                 :   virtual            ~TigerPolygonEconomic();
     481                 : 
     482                 :   virtual int         SetModule( const char * );
     483                 : 
     484                 :   virtual OGRFeature *GetFeature( int );
     485                 : 
     486                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     487                 : };
     488                 : 
     489                 : /************************************************************************/
     490                 : /*                  TigerIDHistory (Type H records)                     */
     491                 : /************************************************************************/
     492                 : 
     493                 : class TigerIDHistory : public TigerFileBase
     494                 : {
     495                 :  private:
     496                 :   TigerRecordInfo    *psRTHInfo;
     497                 : 
     498                 : public:
     499                 :                       TigerIDHistory( OGRTigerDataSource *, const char * );
     500                 :   virtual            ~TigerIDHistory();
     501                 : 
     502                 :   virtual int         SetModule( const char * );
     503                 : 
     504                 :   virtual OGRFeature *GetFeature( int );
     505                 : 
     506                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     507                 : };
     508                 : 
     509                 : /************************************************************************/
     510                 : /*                   TigerPolyChainLink (Type I records)                */
     511                 : /************************************************************************/
     512                 : 
     513                 : class TigerPolyChainLink : public TigerFileBase
     514                 : {
     515                 :  private:
     516                 :   TigerRecordInfo    *psRTIInfo;
     517                 : 
     518                 : public:
     519                 :                       TigerPolyChainLink( OGRTigerDataSource *, const char * );
     520                 :   virtual            ~TigerPolyChainLink();
     521                 : 
     522                 :   virtual int         SetModule( const char * );
     523                 : 
     524                 :   virtual OGRFeature *GetFeature( int );
     525                 : 
     526                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     527                 : };
     528                 : 
     529                 : /************************************************************************/
     530                 : /*                TigerSpatialMetadata (Type M records)                 */
     531                 : /************************************************************************/
     532                 : 
     533                 : class TigerSpatialMetadata : public TigerFileBase
     534                 : {
     535                 :  private:
     536                 :   TigerRecordInfo    *psRTMInfo;
     537                 : 
     538                 : public:
     539                 :                       TigerSpatialMetadata( OGRTigerDataSource *, const char * );
     540                 :   virtual            ~TigerSpatialMetadata();
     541                 : 
     542                 :   virtual int         SetModule( const char * );
     543                 : 
     544                 :   virtual OGRFeature *GetFeature( int );
     545                 : 
     546                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     547                 : };
     548                 : 
     549                 : /************************************************************************/
     550                 : /*                   TigerPIP (Type P records)                          */
     551                 : /************************************************************************/
     552                 : 
     553                 : class TigerPIP : public TigerPoint
     554                 : {
     555                 :  private:
     556                 :   TigerRecordInfo    *psRTPInfo;
     557                 : 
     558                 : public:
     559                 :                       TigerPIP( OGRTigerDataSource *, const char * );
     560                 :   virtual            ~TigerPIP();
     561                 : 
     562                 :   virtual int         SetModule( const char * );
     563                 : 
     564                 :   virtual OGRFeature *GetFeature( int );
     565                 : 
     566                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     567                 : };
     568                 : 
     569                 : /************************************************************************/
     570                 : /*                   TigerTLIDRange (Type R records)                    */
     571                 : /************************************************************************/
     572                 : 
     573                 : class TigerTLIDRange : public TigerFileBase
     574                 : {
     575                 :  private:
     576                 :   TigerRecordInfo    *psRTRInfo;
     577                 : 
     578                 : public:
     579                 :                       TigerTLIDRange( OGRTigerDataSource *, const char * );
     580                 :   virtual            ~TigerTLIDRange();
     581                 : 
     582                 :   virtual int         SetModule( const char * );
     583                 : 
     584                 :   virtual OGRFeature *GetFeature( int );
     585                 : 
     586                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     587                 : };
     588                 : 
     589                 : /************************************************************************/
     590                 : /*                    TigerZeroCellID (Type T records)                  */
     591                 : /************************************************************************/
     592                 : 
     593                 : class TigerZeroCellID : public TigerFileBase
     594                 : {
     595                 :  private:
     596                 :   TigerRecordInfo    *psRTTInfo;
     597                 : 
     598                 : public:
     599                 :                       TigerZeroCellID( OGRTigerDataSource *, const char * );
     600                 :   virtual            ~TigerZeroCellID();
     601                 : 
     602                 :   virtual int         SetModule( const char * );
     603                 : 
     604                 :   virtual OGRFeature *GetFeature( int );
     605                 : 
     606                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     607                 : };
     608                 : 
     609                 : /************************************************************************/
     610                 : /*                    TigerOverUnder (Type U records)                   */
     611                 : /************************************************************************/
     612                 : 
     613                 : class TigerOverUnder : public TigerPoint
     614                 : {
     615                 :  private:
     616                 :   TigerRecordInfo    *psRTUInfo;
     617                 : 
     618                 : public:
     619                 :                       TigerOverUnder( OGRTigerDataSource *, const char * );
     620                 :   virtual            ~TigerOverUnder();
     621                 : 
     622                 :   virtual int         SetModule( const char * );
     623                 : 
     624                 :   virtual OGRFeature *GetFeature( int );
     625                 : 
     626                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     627                 : };
     628                 : 
     629                 : /************************************************************************/
     630                 : /*                    TigerZipPlus4 (Type Z records)                    */
     631                 : /************************************************************************/
     632                 : 
     633                 : class TigerZipPlus4 : public TigerFileBase
     634                 : {
     635                 :  private:
     636                 :   TigerRecordInfo    *psRTZInfo;
     637                 : 
     638                 :  public:
     639                 :                       TigerZipPlus4( OGRTigerDataSource *, const char * );
     640                 :   virtual            ~TigerZipPlus4();
     641                 : 
     642                 :   virtual int         SetModule( const char * );
     643                 : 
     644                 :   virtual OGRFeature *GetFeature( int );
     645                 : 
     646                 :   virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     647                 : };
     648                 : 
     649                 : /************************************************************************/
     650                 : /*                            OGRTigerLayer                             */
     651                 : /************************************************************************/
     652                 : 
     653                 : class OGRTigerLayer : public OGRLayer
     654                 : {
     655                 :     TigerFileBase      *poReader;
     656                 : 
     657                 :     OGRTigerDataSource   *poDS;
     658                 : 
     659                 :     int                 nFeatureCount;
     660                 :     int                 *panModuleFCount;
     661                 :     int                 *panModuleOffset;
     662                 : 
     663                 :     int                 iLastFeatureId;
     664                 :     int                 iLastModule;
     665                 : 
     666                 :   public:
     667                 :                         OGRTigerLayer( OGRTigerDataSource * poDS,
     668                 :                                        TigerFileBase * );
     669                 :     virtual             ~OGRTigerLayer();
     670                 : 
     671                 :     void                ResetReading();
     672                 :     OGRFeature *        GetNextFeature();
     673                 :     OGRFeature         *GetFeature( long nFeatureId );
     674                 : 
     675                 :     OGRFeatureDefn *    GetLayerDefn();
     676                 : 
     677                 :     int                 GetFeatureCount( int );
     678                 : 
     679                 :     int                 TestCapability( const char * );
     680                 : 
     681                 :     virtual OGRSpatialReference *GetSpatialRef();
     682                 : 
     683                 :     virtual OGRErr      CreateFeature( OGRFeature *poFeature );
     684                 :     virtual OGRErr      CreateField( OGRFieldDefn *poField,
     685                 :                                      int bApproxOK = TRUE );
     686                 : };
     687                 : 
     688                 : /************************************************************************/
     689                 : /*                          OGRTigerDataSource                          */
     690                 : /************************************************************************/
     691                 : 
     692                 : class OGRTigerDataSource : public OGRDataSource
     693                 : {
     694                 :     char                *pszName;
     695                 : 
     696                 :     int                 nLayers;
     697                 :     OGRTigerLayer       **papoLayers;
     698                 : 
     699                 :     OGRSpatialReference *poSpatialRef;
     700                 : 
     701                 :     char                **papszOptions;
     702                 : 
     703                 :     char                *pszPath;
     704                 : 
     705                 :     int                 nModules;
     706                 :     char                **papszModules;
     707                 : 
     708                 :     int                 nVersionCode;
     709                 :     TigerVersion        nVersion;
     710                 : 
     711                 :     int                 bWriteMode;
     712                 : 
     713                 :     TigerVersion        TigerCheckVersion( TigerVersion, const char * );
     714                 : 
     715                 :   public:
     716                 :                         OGRTigerDataSource();
     717                 :                         ~OGRTigerDataSource();
     718                 : 
     719               0 :     int                 GetWriteMode() { return bWriteMode; }
     720                 : 
     721               0 :     TigerVersion        GetVersion() { return nVersion; }
     722               0 :     int                 GetVersionCode() { return nVersionCode; }
     723                 : 
     724                 :     void                SetOptionList( char ** );
     725                 :     const char         *GetOption( const char * );
     726                 : 
     727                 :     int                 Open( const char * pszName, int bTestOpen = FALSE,
     728                 :                               char ** papszFileList = NULL );
     729                 : 
     730                 :     int                 Create( const char *pszName, char **papszOptions );
     731                 : 
     732               0 :     const char          *GetName() { return pszName; }
     733                 :     int                 GetLayerCount();
     734                 :     OGRLayer            *GetLayer( int );
     735                 :     OGRLayer            *GetLayer( const char *pszLayerName );
     736                 : 
     737                 :     void                AddLayer( OGRTigerLayer * );
     738                 :     int                 TestCapability( const char * );
     739                 : 
     740               0 :     OGRSpatialReference *GetSpatialRef() { return poSpatialRef; }
     741                 : 
     742             606 :     const char          *GetDirPath() { return pszPath; }
     743                 :     char                *BuildFilename( const char * pszModule,
     744                 :                                         const char * pszExtension );
     745                 : 
     746                 : 
     747               0 :     int                 GetModuleCount() { return nModules; }
     748                 :     const char         *GetModule( int );
     749                 :     int                 CheckModule( const char *pszModule );
     750                 :     void                AddModule( const char *pszModule );
     751                 : 
     752                 :     void                DeleteModuleFiles( const char *pszModule );
     753                 : 
     754                 :     virtual OGRLayer    *CreateLayer( const char *,
     755                 :                                       OGRSpatialReference * = NULL,
     756                 :                                       OGRwkbGeometryType = wkbUnknown,
     757                 :                                       char ** = NULL );
     758                 : };
     759                 : 
     760                 : /************************************************************************/
     761                 : /*                            OGRTigerDriver                            */
     762                 : /************************************************************************/
     763                 : 
     764                 : class OGRTigerDriver : public OGRSFDriver
     765              80 : {
     766                 :   public:
     767                 :                 ~OGRTigerDriver();
     768                 : 
     769                 :     const char *GetName();
     770                 : 
     771                 :     OGRDataSource *Open( const char *, int );
     772                 : 
     773                 :     virtual OGRDataSource *CreateDataSource( const char *pszName,
     774                 :                                              char ** = NULL );
     775                 : 
     776                 :     int         TestCapability( const char * );
     777                 : };
     778                 : 
     779                 : #endif /* ndef _OGR_TIGER_H_INCLUDED */

Generated by: LTP GCOV extension version 1.5