ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Tree-M/object.h
Revision: 1.1
Committed: Sun May 6 00:45:51 2001 UTC (23 years ago) by root
Content type: text/plain
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# Content
1 #ifndef OBJECT_H
2 #define OBJECT_H
3
4 #include <cstdlib>
5 #include <stdio.h>
6
7 #include "PMT.h"
8
9 inline double maxDist() { return ACC->maxDist; }
10 inline int sizeofObject() { return ACC->ndims * ACC->elemsize; }
11
12 class Object : public GiSTobject // the DB object class
13 {
14 double *k;
15 public:
16 Object() {
17 k = new double [NDIMS];
18 for (int i = NDIMS; i--; )
19 k[i] = 0.;
20 }
21
22 Object(double *pkey)
23 {
24 k = pkey;
25 }
26
27 Object(const Object& obj) {
28 k = new double [NDIMS];
29 memcpy (k, obj.k, NDIMS * sizeof (double));
30 }
31
32 ~Object() {
33 delete [] k;
34 }
35
36 Object& operator=(const Object& obj) {
37 delete [] k;
38
39 k = new double [NDIMS];
40 memcpy (k, obj.k, NDIMS * sizeof (double));
41 }
42
43 double area(double r) {
44 return 0;
45 }
46
47 double *data() {
48 return k;
49 }
50
51 double distance(const Object& other) const; // distance method (needed)
52
53 int operator==(const Object& obj)
54 {
55 return !memcmp (k, obj.k, NDIMS * sizeof (double));
56 }
57
58 int operator!=(const Object& obj) { return !(*this==obj); }; // inequality operator (needed)
59
60 int CompressedLength() const {
61 return sizeofObject();
62 }
63
64 Object(char *key);
65 void Compress(char *key);
66 };
67
68 #endif