-
Notifications
You must be signed in to change notification settings - Fork 1
/
ICompact.h
127 lines (107 loc) · 3.58 KB
/
ICompact.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef ICOMPACT_H
#define ICOMPACT_H
#include "IVector.h"
#include "SHARED_EXPORT.h"
class SHARED_EXPORT ICompact
{
public:
enum InterfaceTypes
{
INTERFACE_0,
DIMENSION_INTERFACE_IMPL
};
virtual int getId() const = 0;
/*factories*/
static ICompact* createCompact(IVector const* const begin, IVector const* const end, IVector const* const step = 0);
/*operations*/
virtual int Intersection(ICompact const& c)
{
qt_assert("NOT IMPLEMENTED", __FILE__, __LINE__);
return ERR_NOT_IMPLEMENTED;
}
virtual int Union(ICompact const& c)
{
qt_assert("NOT IMPLEMENTED", __FILE__, __LINE__);
return ERR_NOT_IMPLEMENTED;
}
virtual int Difference(ICompact const& c)
{
qt_assert("NOT IMPLEMENTED", __FILE__, __LINE__);
return ERR_NOT_IMPLEMENTED;
}
virtual int SymDifference(ICompact const& c)
{
qt_assert("NOT IMPLEMENTED", __FILE__, __LINE__);
return ERR_NOT_IMPLEMENTED;
}
virtual int MakeConvex() { return ERR_OK; }
/*static operations*/
static ICompact* Intersection(ICompact const* const left, ICompact const* const right)
{
qt_assert("NOT IMPLEMENTED", __FILE__, __LINE__);
return static_cast<ICompact*>(0);
}
static ICompact* Union(ICompact const* const left, ICompact const* const right)
{
qt_assert("NOT IMPLEMENTED", __FILE__, __LINE__);
return static_cast<ICompact*>(0);
}
static ICompact* Difference(ICompact const* const left, ICompact const* const right)
{
qt_assert("NOT IMPLEMENTED", __FILE__, __LINE__);
return static_cast<ICompact*>(0);
}
static ICompact* SymDifference(ICompact const* const left, ICompact const* const right)
{
qt_assert("NOT IMPLEMENTED", __FILE__, __LINE__);
return static_cast<ICompact*>(0);
}
static ICompact* MakeConvex(ICompact const* const src)
{
if (!src) return static_cast<ICompact*>(0);
else return src->clone();
}
virtual int deleteIterator(IIterator * pIter) = 0;
virtual int getByIterator(IIterator const* pIter, IVector*& pItem) const = 0;
virtual IIterator* end(IVector const* const step = 0) = 0;
virtual IIterator* begin(IVector const* const step = 0) = 0;
virtual int isContains(IVector const* const vec, bool& result) const = 0;
virtual int isSubSet(ICompact const* const other) const = 0;
virtual int isSimplyConn(bool& result) const
{
result = true;
return ERR_OK;
}
virtual int isIntersects(ICompact const* const other, bool& result) const
{
qt_assert("NOT IMPLEMENTED", __FILE__, __LINE__);
return ERR_NOT_IMPLEMENTED;
}
virtual int getNearestNeighbor(IVector const* vec, IVector *& nn) const = 0;
virtual ICompact* clone() const = 0;
/*dtor*/
virtual ~ICompact() = default;
class IIterator
{
public:
//adds step to current value in iterator
virtual int doStep() = 0;
//change step
virtual int setStep(IVector const* const step) = 0;
protected:
IIterator(ICompact const* const compact, int pos, IVector const* const step);
/*dtor*/
virtual ~IIterator() = default;
private:
/*non default copyable*/
IIterator(const IIterator& other) = delete;
void operator=(const IIterator& other) = delete;
};
protected:
ICompact() = default;
private:
/*non default copyable*/
ICompact(const ICompact& other) = delete;
void operator=(const ICompact& other) = delete;
};
#endif // ICOMPACT_H