Skip to content

Commit d0b0974

Browse files
committed
[RSDK-10385] Eliminate wrapper struct for VS2019 compat
1 parent d550712 commit d0b0974

File tree

4 files changed

+11
-22
lines changed

4 files changed

+11
-22
lines changed

src/viam/sdk/services/motion.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ bool operator==(const obstacle_detector& lhs, const obstacle_detector& rhs) {
2222
return lhs.vision_service == rhs.vision_service && lhs.camera == rhs.camera;
2323
}
2424

25-
bool operator==(const Motion::steps& lhs, const Motion::steps& rhs) {
26-
return lhs.steps == rhs.steps;
27-
}
28-
2925
bool operator==(const Motion::plan_status& lhs, const Motion::plan_status& rhs) {
3026
return std::tie(lhs.reason, lhs.state, lhs.timestamp) ==
3127
std::tie(rhs.reason, rhs.state, rhs.timestamp);

src/viam/sdk/services/motion.hpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,13 @@ class Motion : public Service {
113113
friend bool operator==(const plan_status_with_id& lhs, const plan_status_with_id& rhs);
114114
};
115115

116-
/// @struct steps
116+
/// @brief An individual "step", representing the state each component (keyed as a fully
117+
/// qualified component name) should reach while executing that step of the plan.
118+
using step = std::unordered_map<std::string, pose>;
119+
117120
/// @brief An ordered list of plan steps.
118121
/// @ingroup Motion
119-
struct steps {
120-
/// @brief An individual "step", representing the state each component (keyed as a fully
121-
/// qualified component name) should reach while executing that step of the plan.
122-
typedef std::unordered_map<std::string, pose> step;
123-
124-
/// @brief The ordered list of steps.
125-
std::vector<step> steps;
126-
127-
friend bool operator==(const struct steps& lhs, const struct steps& rhs);
128-
};
122+
using steps = std::vector<step>;
129123

130124
/// @struct plan
131125
/// @brief Describes a motion plan.
@@ -142,7 +136,7 @@ class Motion : public Service {
142136
std::string execution_id;
143137

144138
/// @brief An ordered list of plan steps.
145-
struct steps steps;
139+
steps steps;
146140

147141
friend bool operator==(const plan& lhs, const plan& rhs);
148142
};

src/viam/sdk/services/private/motion_client.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,16 @@ Motion::plan_status_with_id from_proto(const service::motion::v1::PlanStatusWith
139139

140140
Motion::steps steps_from_proto(
141141
const google::protobuf::RepeatedPtrField<service::motion::v1::PlanStep>& proto) {
142-
using step = Motion::steps::step;
143-
std::vector<step> steps;
142+
Motion::steps steps;
144143
for (const auto& ps : proto) {
145-
step step;
144+
Motion::step step;
146145
for (const auto& component : ps.step()) {
147146
step.emplace(component.first, from_proto(component.second.pose()));
148147
}
149148
steps.push_back(std::move(step));
150149
}
151150

152-
return {steps};
151+
return steps;
153152
}
154153

155154
Motion::plan plan_from_proto(const service::motion::v1::Plan& proto) {

src/viam/sdk/services/private/motion_server.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ service::motion::v1::PlanStatus to_proto(const Motion::plan_status& ps) {
5151
return proto;
5252
}
5353

54-
service::motion::v1::PlanStep to_proto(const Motion::steps::step& step) {
54+
service::motion::v1::PlanStep to_proto(const Motion::step& step) {
5555
service::motion::v1::PlanStep proto;
5656
for (const auto& kv : step) {
5757
service::motion::v1::ComponentState cs;
@@ -67,7 +67,7 @@ service::motion::v1::Plan to_proto(const Motion::plan& plan) {
6767
*proto.mutable_id() = plan.id;
6868
*proto.mutable_component_name() = to_proto(plan.component_name);
6969
*proto.mutable_execution_id() = plan.execution_id;
70-
for (const auto& step : plan.steps.steps) {
70+
for (const auto& step : plan.steps) {
7171
*proto.mutable_steps()->Add() = to_proto(step);
7272
}
7373

0 commit comments

Comments
 (0)