-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_hitKey_moment_policy.hpp
More file actions
executable file
·83 lines (70 loc) · 1.66 KB
/
check_hitKey_moment_policy.hpp
File metadata and controls
executable file
·83 lines (70 loc) · 1.66 KB
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
#ifndef GARD_CHECK_HITKEY_MOMENT_POLICY
#define GARD_CHECK_HITKEY_MOMENT_POLICY
namespace turara_soft{
namespace function{
class NoarmalWait{
public:
bool check(){return false;}
void clear(){}
private:
};
//離されるか一定ステップたつまで検出しない
template<int Step>
class StepWait{
public:
StepWait();
bool check();//{return false;}
void clear();
private:
int StepCounter;
enum{WaitStep=Step};
};
//最初の数ステップは検出し、その後検出しない
template<int Step>
class PretermitFewStepWait{
public:
PretermitFewStepWait();
bool check();
void clear();
private:
int StepCounter;
enum{WaitStep=Step};
};
//離されるか一定時間[ms]たつまで検出しない
template<int Time>
class TimeWait{
public:
bool check(){return false;}
void clear(){}
private:
enum{WaitStep=Time};
};
}
}
//ポリシー実体
//StepWait
template<int StepWait>
turara_soft::function::StepWait<StepWait>::StepWait():StepCounter(0){}
template<int StepWait>
bool turara_soft::function::StepWait<StepWait>::check(){
if (StepCounter==StepWait){
this->clear();
return true;
}
StepCounter++;
return false;
}
template<int StepWait>
void turara_soft::function::StepWait<StepWait>::clear(){StepCounter=0;}
//PretermitFewStepWait
template<int StepWait>
turara_soft::function::PretermitFewStepWait<StepWait>::PretermitFewStepWait():StepCounter(0){}
template<int StepWait>
bool turara_soft::function::PretermitFewStepWait<StepWait>::check(){
StepCounter++;
if (StepCounter<StepWait) return true;
return false;
}
template<int StepWait>
void turara_soft::function::PretermitFewStepWait<StepWait>::clear(){StepCounter=0;}
#endif