-
Notifications
You must be signed in to change notification settings - Fork 0
/
DgBoundedRF.h
148 lines (100 loc) · 5.63 KB
/
DgBoundedRF.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
////////////////////////////////////////////////////////////////////////////////
//
// DgBoundedRF.h: DgBoundedRF class definitions
//
// Version 6.1 - Kevin Sahr, 5/23/13
//
////////////////////////////////////////////////////////////////////////////////
#ifndef DGBOUNDEDRF_H
#define DGBOUNDEDRF_H
#include <cstdint>
#include "DgBoundedRFBase.h"
#include "DgDiscRF.h"
#include "DgPolygon.h"
class DgLocation;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
template<class A, class B, class DB> class DgBoundedRF
: public DgBoundedRFBase<B, DB> {
public:
DgBoundedRF<A, B, DB> (const DgDiscRF<A, B, DB>& rfIn,
const A& firstAddIn,
const A& lastAddIn, const A& endAddIn,
bool zBasedIn = true);
const DgDiscRF<A, B, DB>& discRF (void) const { return discRF_; }
virtual bool validLocation (const DgLocation& loc,
bool convert = true) const;
virtual DgLocation& incrementLocation (DgLocation& loc,
bool convert = true) const;
virtual DgLocation& decrementLocation (DgLocation& loc,
bool convert = true) const;
virtual std::uint64_t seqNum (const DgLocation& loc,
bool convert = true) const;
virtual DgLocation* locFromSeqNum (std::uint64_t sNum) const;
const A& firstAdd (void) const { return firstAdd_; }
const A& lastAdd (void) const { return lastAdd_; }
const A& endAdd (void) const { return endAdd_; }
// provide a generic interface to the discrete grid functionality
virtual const DgRF<B, DB>& backFrame (void) const
{ return discRF().backFrame(); }
virtual string dist2str (const std::int64_t& dist) const
{ return discRF().dist2str(dist); }
virtual long double dist2dbl (const std::int64_t& dist) const
{ return discRF().dist2dbl(dist); }
virtual std::uint64_t dist2int (const std::int64_t& dist) const
{ return discRF().dist2int(dist); }
virtual void setPoint (const DgLocation& loc, DgLocation& point) const
{ discRF().setPoint(loc, point); }
virtual void setPoint (const DgLocation& loc, const DgRFBase& rf,
DgLocation& point) const
{ discRF().setPoint(loc, rf, point); }
virtual void setPoint (const A& add, const DgRFBase& rf,
DgLocation& point) const
{ discRF().setPoint(add, rf, point); }
virtual void setPoint (const A& add, DgLocation& pt) const
{ discRF().setPoint(add, pt); }
virtual void setVertices (const DgLocation& loc, DgPolygon& vec) const
{ discRF().setVertices(loc, vec); }
virtual void setVertices (const DgLocation& loc, const DgRFBase& rf,
DgPolygon& vec) const
{ discRF().setVertices(loc, rf, vec); }
virtual void setVertices (const A& add, const DgRFBase& rf,
DgPolygon& vec) const
{ discRF().setVertices(add, rf, vec); }
virtual void setNeighbors (const DgLocation& loc, DgLocVector& vec) const
{ discRF().setNeighbors(loc, vec); }
virtual void setNeighbors (const A& add, const DgRFBase& rf,
DgLocVector& vec) const
{ discRF().setNeighbors(add, rf, vec); }
virtual void setNeighbors (const A& add, DgLocVector& vec) const
{ discRF().setNeighbors(add, vec); }
virtual void setVertices (const A& add, DgPolygon& vec) const
{ discRF().setVertices(add, vec); }
virtual DgLocation* makePoint (const DgLocation& loc) const
{ return discRF().makePoint(loc); }
virtual DgPolygon* makeVertices (const DgLocation& loc) const
{ return discRF().makeVertices(loc); }
virtual DgLocVector* makeNeighbors (const DgLocation& loc) const
{ return discRF().makeNeighbors(loc); }
// pure virtual functions that must be defined by sub-classes
virtual bool validAddress (const A& add) const = 0;
virtual A& incrementAddress (A& add) const = 0;
virtual A& decrementAddress (A& add) const = 0;
virtual std::uint64_t seqNumAddress (const A& loc) const = 0;
virtual A addFromSeqNum (std::uint64_t sNum) const = 0;
virtual bool lessThanAddress (const A& a1, const A& a2) const
{ return (seqNumAddress(a1) < seqNumAddress(a2)); }
protected:
void setFirstAdd (const A& firstAddIn) { firstAdd_ = firstAddIn; }
void setLastAdd (const A& lastAddIn) { lastAdd_ = lastAddIn; }
void setEndAdd (const A& endAddIn) { endAdd_ = endAddIn; }
private:
const DgDiscRF<A, B, DB>& discRF_;
A firstAdd_;
A lastAdd_;
A endAdd_;
};
#include "DgBoundedRF_template.h"
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#endif