Skip to content

Commit 7a6edda

Browse files
committed
Enhance compatibility between control_t and base_control_t:
* Add conversion operator in control_t to convert instances to base_control_t
1 parent 6d319c5 commit 7a6edda

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

features/frameworks/utest/utest/utest_types.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,13 @@ namespace v1 {
171171
control_t(uint32_t timeout_ms) :
172172
base_control_t(make_base_control_t(REPEAT_UNDECLR, timeout_ms)) {}
173173

174-
control_t(base_control_t other) :
174+
control_t(base_control_t other) :
175175
base_control_t(other) {}
176176

177-
control_t
178-
inline operator+(const control_t& rhs) const {
177+
friend control_t operator+(const control_t& lhs, const control_t& rhs) {
179178
control_t result(
180-
repeat_t(this->repeat | rhs.repeat),
181-
(rhs.timeout == TIMEOUT_NONE) ? rhs.timeout : this->timeout);
179+
repeat_t(lhs.repeat | rhs.repeat),
180+
(rhs.timeout == TIMEOUT_NONE) ? rhs.timeout : lhs.timeout);
182181

183182
if (result.timeout != TIMEOUT_NONE && result.timeout > rhs.timeout) {
184183
result.timeout = rhs.timeout;
@@ -208,15 +207,23 @@ namespace v1 {
208207
return timeout;
209208
}
210209

211-
private:
212-
static base_control_t make_base_control_t(repeat_t repeat, uint32_t timeout) {
210+
operator base_control_t() const {
213211
base_control_t result = {
214212
repeat,
215213
timeout
216214
};
217215
return result;
218216
}
219217

218+
private:
219+
static base_control_t make_base_control_t(repeat_t repeat, uint32_t timeout) {
220+
base_control_t result = {
221+
repeat,
222+
timeout
223+
};
224+
return result;
225+
}
226+
220227
friend class Harness;
221228
};
222229

0 commit comments

Comments
 (0)