@@ -35,28 +35,24 @@ void Command::Execute() {}
35
35
void Command::End (bool interrupted) {}
36
36
37
37
CommandPtr Command::WithTimeout (units::second_t duration) && {
38
- return CommandPtr ( std::move (*this ).TransferOwnership () ).WithTimeout (duration);
38
+ return std::move (*this ).ToPtr ( ).WithTimeout (duration);
39
39
}
40
40
41
41
CommandPtr Command::Until (std::function<bool ()> condition) && {
42
- return CommandPtr (std::move (*this ).TransferOwnership ())
43
- .Until (std::move (condition));
42
+ return std::move (*this ).ToPtr ().Until (std::move (condition));
44
43
}
45
44
46
45
CommandPtr Command::IgnoringDisable (bool doesRunWhenDisabled) && {
47
- return CommandPtr (std::move (*this ).TransferOwnership ())
48
- .IgnoringDisable (doesRunWhenDisabled);
46
+ return std::move (*this ).ToPtr ().IgnoringDisable (doesRunWhenDisabled);
49
47
}
50
48
51
49
CommandPtr Command::WithInterruptBehavior (
52
50
InterruptionBehavior interruptBehavior) && {
53
- return CommandPtr (std::move (*this ).TransferOwnership ())
54
- .WithInterruptBehavior (interruptBehavior);
51
+ return std::move (*this ).ToPtr ().WithInterruptBehavior (interruptBehavior);
55
52
}
56
53
57
54
CommandPtr Command::WithInterrupt (std::function<bool ()> condition) && {
58
- return CommandPtr (std::move (*this ).TransferOwnership ())
59
- .Until (std::move (condition));
55
+ return std::move (*this ).ToPtr ().Until (std::move (condition));
60
56
}
61
57
62
58
CommandPtr Command::BeforeStarting (
@@ -68,8 +64,8 @@ CommandPtr Command::BeforeStarting(
68
64
69
65
CommandPtr Command::BeforeStarting (
70
66
std::function<void ()> toRun, std::span<Subsystem* const > requirements) && {
71
- return CommandPtr ( std::move (*this ).TransferOwnership ())
72
- . BeforeStarting ( std::move (toRun), requirements);
67
+ return std::move (*this ).ToPtr (). BeforeStarting ( std::move (toRun),
68
+ requirements);
73
69
}
74
70
75
71
CommandPtr Command::AndThen (std::function<void ()> toRun,
@@ -80,8 +76,7 @@ CommandPtr Command::AndThen(std::function<void()> toRun,
80
76
81
77
CommandPtr Command::AndThen (std::function<void ()> toRun,
82
78
std::span<Subsystem* const > requirements) && {
83
- return CommandPtr (std::move (*this ).TransferOwnership ())
84
- .AndThen (std::move (toRun), requirements);
79
+ return std::move (*this ).ToPtr ().AndThen (std::move (toRun), requirements);
85
80
}
86
81
87
82
PerpetualCommand Command::Perpetually () && {
@@ -91,26 +86,23 @@ PerpetualCommand Command::Perpetually() && {
91
86
}
92
87
93
88
CommandPtr Command::Repeatedly () && {
94
- return CommandPtr ( std::move (*this ).TransferOwnership () ).Repeatedly ();
89
+ return std::move (*this ).ToPtr ( ).Repeatedly ();
95
90
}
96
91
97
92
CommandPtr Command::AsProxy () && {
98
- return CommandPtr ( std::move (*this ).TransferOwnership () ).AsProxy ();
93
+ return std::move (*this ).ToPtr ( ).AsProxy ();
99
94
}
100
95
101
96
CommandPtr Command::Unless (std::function<bool ()> condition) && {
102
- return CommandPtr (std::move (*this ).TransferOwnership ())
103
- .Unless (std::move (condition));
97
+ return std::move (*this ).ToPtr ().Unless (std::move (condition));
104
98
}
105
99
106
100
CommandPtr Command::FinallyDo (std::function<void (bool )> end) && {
107
- return CommandPtr (std::move (*this ).TransferOwnership ())
108
- .FinallyDo (std::move (end));
101
+ return std::move (*this ).ToPtr ().FinallyDo (std::move (end));
109
102
}
110
103
111
104
CommandPtr Command::HandleInterrupt (std::function<void (void )> handler) && {
112
- return CommandPtr (std::move (*this ).TransferOwnership ())
113
- .HandleInterrupt (std::move (handler));
105
+ return std::move (*this ).ToPtr ().HandleInterrupt (std::move (handler));
114
106
}
115
107
116
108
void Command::Schedule () {
0 commit comments