-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathposition_wilson_vector.hpp
85 lines (67 loc) · 1.82 KB
/
position_wilson_vector.hpp
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
//Created: 30-06-2014
//Modified: Wed 10 Dec 2014 10:49:24 CET
//Author: Jonas R. Glesaaen ([email protected])
#ifndef POSITION_WILSON_VECTOR_HPP
#define POSITION_WILSON_VECTOR_HPP
#include"std_libs/position/position_container.hpp"
#include"pm.wilson.h"
class PositionWilsonVector : public Position::container
{
private:
std::vector<hop::Wilson> & wvec;
class IteratorWilsonImp : public IteratorImp
{
private:
std::vector<hop::Wilson>::iterator it;
public:
IteratorWilsonImp() : IteratorImp() {};
IteratorWilsonImp(std::vector<hop::Wilson>::iterator it) : it(it) {};
virtual IteratorImp * clone() const
{
IteratorWilsonImp * the_clone = new IteratorWilsonImp(it);
return the_clone;
};
virtual void increment()
{
++it;
};
virtual Position::pos & value()
{
return it->pos;
};
virtual const Position::pos & value() const
{
return it->pos;
};
virtual bool equal(const IteratorImp & right) const
{
return it == dynamic_cast<const IteratorWilsonImp &>(right).it;
};
virtual ~IteratorWilsonImp() {};
};
private:
virtual std::unique_ptr<container> do_clone() const
{
return std::unique_ptr<container> {new PositionWilsonVector(wvec)};
};
public:
virtual iterator begin()
{
return iterator( new IteratorWilsonImp(wvec.begin()) );
};
virtual iterator end()
{
return iterator( new IteratorWilsonImp(wvec.end()) );
};
virtual const_iterator begin() const
{
return const_iterator( new IteratorWilsonImp(wvec.begin()) );
};
virtual const_iterator end() const
{
return const_iterator( new IteratorWilsonImp(wvec.end()) );
};
PositionWilsonVector(std::vector<hop::Wilson> & wvec) : wvec(wvec) {};
virtual ~PositionWilsonVector() {};
};
#endif /* POSITION_WILSON_VECTOR_HPP */