-
Notifications
You must be signed in to change notification settings - Fork 0
/
betweenpoints.h
40 lines (31 loc) · 956 Bytes
/
betweenpoints.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
#ifndef BETWEENPOINTS_H_INCLUDED
#define BETWEENPOINTS_H_INCLUDED
#include <list>
namespace dd {
/**
* Entity located between two points of class T.
*/
template <typename T>
class BetweenPoints {
#define BETWEENPOINTS_NAME "BetweenPoints"
private:
typename list<T *>::iterator next;
typename list<T *>::reverse_iterator prev;
public:
BetweenPoints(typename list<T *>::iterator next, typename list<T *>::reverse_iterator prev) :
next(next), prev(prev) { }
T * getNext() const { return next; }
T * getPrev() const { return prev; }
void forward() {
next++;
prev--;
}
void backward() {
next--;
prev++;
}
virtual string typeName() const { return BETWEENPOINTS_NAME; }
static string staticTypeName() { return BETWEENPOINTS_NAME; }
};
}
#endif // BETWEENPOINTS_H_INCLUDED