-
Notifications
You must be signed in to change notification settings - Fork 0
/
stHyperCube.h
74 lines (59 loc) · 1.94 KB
/
stHyperCube.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// stHyperCube.h: interface for the stHyperCube class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_STHYPERCUBE_H__868DAFC6_34E5_4CC9_A461_032F45D9DE9C__INCLUDED_)
#define AFX_STHYPERCUBE_H__868DAFC6_34E5_4CC9_A461_032F45D9DE9C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <cassert>
#include <cmath>
#include "stMBR.h"
#define OBJECT_SIZE ((2 * sizeof(stDistance) ) * DIMENSION + sizeof(stPageID));
class stHyperCube : public stMBR{
public:
struct stInterval {
stDistance Begin;
stDistance End;
};
public:
stHyperCube();
stHyperCube(const stHyperCube& obj) ;
~stHyperCube();
bool operator == (const stHyperCube& obj) const ;
virtual void AddInterval(int idx, stDistance origin) ;
virtual void AddInterval(int idx, stDistance begin, stDistance end) ;
virtual stSize GetDimension() const;
virtual void SetDimension() ;
virtual stDistance& GetBegin(int idx) ;
virtual stDistance& GetEnd(int idx) ;
virtual stDistance GetBegin(int idx) const;
virtual stDistance GetEnd(int idx) const;
virtual stDistance GetArea() ;
virtual stDistance IntersectionArea(stMBR* mbr);
virtual bool Intersection(stMBR* mbr);
virtual stMBR* GetUnionMBR(stMBR* mbr);
virtual stHyperCube* Clone() {
return new stHyperCube(*this);
}
virtual bool IsEqual(stHyperCube* obj);
virtual stSize GetSerializedSize() const;
virtual const stByte* Serialize();
virtual void Unserialize(const stByte * data, stSize datasize);
virtual void Print(std::ostream &out) const;
virtual stDistance GetMinDist(const Point &p);
stDistance GetMinDist(stHyperCube* p);
void SetOID(stPageID oid) {
this->ObjectID = oid;
}
stPageID GetOID() const {
return ObjectID;
}
public:
static int NumberOfDC;
private:
stInterval Interval[DIMENSION];
stByte* Buffer;
stPageID ObjectID;
};
#endif // !defined(AFX_STHYPERCUBE_H__868DAFC6_34E5_4CC9_A461_032F45D9DE9C__INCLUDED_)