| 1 |
// -*- Mode: C++ -*- |
| 2 |
|
| 3 |
// GiSTdefs.h |
| 4 |
// |
| 5 |
// Copyright (c) 1996, Regents of the University of California |
| 6 |
// $Header: /usr/local/devel/GiST/libGiST/libGiST/GiSTdefs.h,v 1.1.1.1 1996/08/06 23:47:21 jmh Exp $ |
| 7 |
|
| 8 |
#ifndef GISTDEFS_H |
| 9 |
#define GISTDEFS_H |
| 10 |
|
| 11 |
#include <assert.h> |
| 12 |
#include <stdlib.h> |
| 13 |
#include <math.h> |
| 14 |
|
| 15 |
#ifdef PRINTING_OBJECTS |
| 16 |
#include <iostream.h> |
| 17 |
#endif |
| 18 |
|
| 19 |
// A GiSTpage is a disk page number (a "pointer" to a disk page) |
| 20 |
typedef unsigned long GiSTpage; |
| 21 |
|
| 22 |
// GiSTobjid's are used to identify objects |
| 23 |
// You can add new ones as you define new objects, or simply |
| 24 |
// make things be GISTOBJECT_CLASS if you don't want to bother. |
| 25 |
typedef enum { |
| 26 |
GISTOBJECT_CLASS, |
| 27 |
GIST_CLASS, |
| 28 |
BT_CLASS, |
| 29 |
RT_CLASS, |
| 30 |
MT_CLASS, |
| 31 |
GISTENTRY_CLASS, |
| 32 |
GISTNODE_CLASS, |
| 33 |
BTNODE_CLASS, |
| 34 |
BTENTRY_CLASS, |
| 35 |
BTKEY_CLASS, |
| 36 |
RTNODE_CLASS, |
| 37 |
RTENTRY_CLASS, |
| 38 |
RTKEY_CLASS, |
| 39 |
MTNODE_CLASS, |
| 40 |
MTENTRY_CLASS, |
| 41 |
MTKEY_CLASS, |
| 42 |
GISTPREDICATE_CLASS, |
| 43 |
BTPREDICATE_CLASS, |
| 44 |
RTPREDICATE_CLASS, |
| 45 |
MTPREDICATE_CLASS, |
| 46 |
MTPREDICATE_AND_CLASS, |
| 47 |
MTPREDICATE_OR_CLASS, |
| 48 |
MTPREDICATE_NOT_CLASS, |
| 49 |
GISTCURSOR_CLASS |
| 50 |
} GiSTobjid; |
| 51 |
|
| 52 |
// GiSTobject is the base class for all GiST classes |
| 53 |
// It provides identity, equality tests and display of objects |
| 54 |
|
| 55 |
class GiSTobject |
| 56 |
{ |
| 57 |
public: |
| 58 |
virtual GiSTobjid IsA() const { return GISTOBJECT_CLASS; } |
| 59 |
virtual GiSTobject *Copy() const { return NULL; } |
| 60 |
virtual int IsEqual(const GiSTobject& obj) const { return 0; } |
| 61 |
#ifdef PRINTING_OBJECTS |
| 62 |
virtual void Print(ostream& os) const { os << "No print method\n"; } |
| 63 |
#endif |
| 64 |
virtual ~GiSTobject() {} |
| 65 |
}; |
| 66 |
|
| 67 |
#ifdef PRINTING_OBJECTS |
| 68 |
inline ostream& operator<< (ostream& os, const GiSTobject& obj) { |
| 69 |
obj.Print(os); |
| 70 |
return os; |
| 71 |
} |
| 72 |
|
| 73 |
inline ostream& operator<< (ostream& os, const GiSTobject *obj) { |
| 74 |
obj->Print(os); |
| 75 |
return os; |
| 76 |
} |
| 77 |
#endif |
| 78 |
|
| 79 |
#endif |