-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRange.h
58 lines (47 loc) · 1.04 KB
/
Range.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
#ifndef BaseLib_Policy_Range_h_IsIncluded
#define BaseLib_Policy_Range_h_IsIncluded
#include"BaseLib/Templates/BaseTypes.h"
#include"BaseLib/Policy/MinLimit.h"
#include"BaseLib/Policy/MaxLimit.h"
namespace BaseLib { namespace Policy
{
/**
* @brief The Range class
*/
template <typename T = long>
class Range
{
public:
Range(MinLimit<T> minLimit, MaxLimit<T> maxLimit)
: minLimit_(minLimit)
, maxLimit_(maxLimit)
{}
virtual ~Range()
{}
bool IsInRange(long)
{
return false;
}
static Range<T> Inclusive(MinLimit<T> min, MaxLimit<T> max)
{
return Range<T>(min, max);
}
static Range<T> Exclusive(MinLimit<T> min, MaxLimit<T> max)
{
return Range<T>(min, max);
}
private:
bool isInInclusiveRange(const T &number)
{
return (number >= minLimit_ && number <= maxLimit_);
}
bool isInExclusiveRange(const T &number)
{
return !isInInclusiveRange(number);
}
private:
MinLimit<T> minLimit_;
MaxLimit<T> maxLimit_;
};
}}
#endif