Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

index.h

Go to the documentation of this file.
00001 /*  $Id: index.h,v 1.8 2003/08/16 19:59:39 gkunkel Exp $
00002 
00003     Xbase project source code
00004 
00005     This file contains a header file for the NTX object, which is used
00006     for handling NTX type indices. NTX are the Clipper equivalant of xbNdx
00007     files.
00008 
00009     Copyright (C) 1998  SynXis Corp., Bob Cotton
00010 
00011     This library is free software; you can redistribute it and/or
00012     modify it under the terms of the GNU Lesser General Public
00013     License as published by the Free Software Foundation; either
00014     version 2.1 of the License, or (at your option) any later version.
00015 
00016     This library is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019     Lesser General Public License for more details.
00020 
00021     You should have received a copy of the GNU Lesser General Public
00022     License along with this library; if not, write to the Free Software
00023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 
00025     Contact:
00026 
00027       Mail:
00028 
00029         Technology Associates, Inc.
00030         XBase Project
00031         1455 Deming Way #11
00032         Sparks, NV 89434
00033         USA
00034 
00035       Email:
00036 
00037         xbase@techass.com
00038 
00039       See our website at:
00040 
00041         xdb.sourceforge.net
00042 
00043 */
00044 
00045 #ifndef __XB_INDEX_H__
00046 #define __XB_INDEX_H__
00047 
00048 #ifdef __GNUG__
00049 #pragma interface
00050 #endif
00051 
00052 #include <xbase/xbase.h>
00053 #include <string.h>
00054 
00058 #define XB_UNIQUE     1
00059 #define XB_NOT_UNIQUE 0
00060 
00062 
00065 class XBDLLEXPORT xbIndex
00066 {
00067  public:
00068     xbIndex *index;
00069     xbDbf *dbf;
00070     xbExpNode *ExpressionTree;
00071 
00072     xbString IndexName;
00073     FILE *indexfp;
00074 
00075     int IndexStatus;            /* 0 = closed, 1 = open */
00076 
00077     xbULong  CurDbfRec;     /* current Dbf record number */
00078     char  *KeyBuf;               /* work area key buffer */
00079     char  *KeyBuf2;              /* work area key buffer */
00080 
00081 #ifdef XB_LOCKING_ON
00082 protected:
00083     int CurLockCount;
00084     int CurLockType;
00085 #endif
00086 
00087     xbShort NodeSize;
00088 
00089 public:
00090     xbIndex() {}
00091     xbIndex(xbDbf *);
00092 
00093     virtual ~xbIndex() {}
00094 
00095     virtual xbShort  OpenIndex ( const char * ) = 0;
00096     virtual xbShort  CloseIndex() = 0;
00097 #ifdef XBASE_DEBUG
00098     virtual void     DumpHdrNode() = 0;
00099     virtual void     DumpNodeRec( xbLong ) = 0;
00100     virtual void     DumpNodeChain() = 0;
00101     virtual xbShort  CheckIndexIntegrity( const xbShort ) = 0;
00102 #endif
00103     virtual xbShort  CreateIndex( const char *, const char *, xbShort, xbShort ) = 0;
00104     virtual xbLong   GetTotalNodes() = 0;
00105     virtual xbULong   GetCurDbfRec() = 0;
00106     virtual xbShort  CreateKey( xbShort, xbShort ) = 0;
00107     virtual xbShort  GetCurrentKey(char *key) = 0;
00108     virtual xbShort  AddKey( xbLong ) = 0;
00109     virtual xbShort  UniqueIndex() = 0;
00110     virtual xbShort  DeleteKey( xbLong ) = 0;
00111     virtual xbShort  KeyWasChanged() = 0;
00112     virtual xbShort  FindKey( const char * ) = 0;
00113     virtual xbShort  FindKey() = 0;
00114     virtual xbShort  FindKey( xbDouble ) = 0;
00115     virtual xbShort  GetNextKey() = 0;
00116     virtual xbShort  GetLastKey() = 0;
00117     virtual xbShort  GetFirstKey() = 0;
00118     virtual xbShort  GetPrevKey() = 0;
00119     virtual xbShort  ReIndex(void (*statusFunc)(xbLong itemNum, xbLong numItems) = 0) = 0;
00120 //   virtual xbShort  KeyExists( char * Key ) { return FindKey( Key, strlen( Key ), 0 ); }
00121     virtual xbShort  KeyExists( xbDouble ) = 0;
00122 
00123 #ifdef XB_LOCKING_ON
00124     virtual xbShort  LockIndex( const xbShort, const xbShort );
00125 #else
00126     virtual xbShort  LockIndex( const xbShort, const xbShort ) const { return XB_NO_ERROR; }
00127 #endif
00128 
00129     virtual xbShort TouchIndex( void ) { return XB_NO_ERROR; }
00130 
00131     virtual void    SetNodeSize(xbShort size) {}
00132     virtual xbShort GetNodeSize(void) { return NodeSize; }
00133 
00134     virtual void    GetExpression(char *buf, int len) = 0;
00135 
00136     virtual void    Flush();
00137 };
00138 
00139 
00140 #endif /* __XB_INDEX_H__ */

Generated on Wed Jan 26 11:45:09 2005 for Xbase Class Library by  doxygen 1.4.1