-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMRVecIndex.cpp
83 lines (68 loc) · 1.17 KB
/
CMRVecIndex.cpp
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
#include "CMRVecIndex.h"
namespace Daetk
{
CMRVecIndex::CMRVecIndex():
start_(0),
end_(0),
all_(true)
{}
CMRVecIndex::CMRVecIndex( int i1):
start_(i1),
end_(i1),
all_(false)
{}
CMRVecIndex::CMRVecIndex( int i1, int i2):
start_(i1),
end_(i2),
all_(false)
{
assert(i1 <= i2);
}
CMRVecIndex::CMRVecIndex(const CMRVecIndex &s):
start_(s.start_),
end_(s.end_),
all_(s.all_)
{}
int CMRVecIndex::start() const
{
return (all_==true) ? 0 : start_;
}
int CMRVecIndex::end() const
{
return (all_ ==true) ? 0 : end_;
}
int CMRVecIndex::length() const
{
return (all_==true) ? 0 : (end_-start_+1);
}
bool CMRVecIndex::all() const
{
return all_;
}
CMRVecIndex& CMRVecIndex::operator=(const CMRVecIndex& VI)
{
start_=VI.start_;
end_ = VI.end_;
return *this;
}
CMRVecIndex CMRVecIndex::operator+(int i)
{
return CMRVecIndex(start_ +i, end_ +i);
}
CMRVecIndex& CMRVecIndex::operator+=(int i)
{
start_ += i;
end_ += i;
return *this;
}
CMRVecIndex CMRVecIndex::operator-(int i)
{
return CMRVecIndex(start_ -i, end_ -i);
}
CMRVecIndex& CMRVecIndex::operator-=(int i)
{
start_ -= i;
end_ -= i;
return *this;
}
}//Daetk