Skip to content

Commit 4783dd6

Browse files
committed
proto constructors, unique_ptr
1 parent e8e2aab commit 4783dd6

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/viam/sdk/services/navigation.hpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,19 @@ class Navigation : public Service {
3737
};
3838

3939
struct Waypoint {
40-
public:
40+
Waypoint(const viam::service::navigation::v1::Waypoint& proto) {
41+
this->id = proto.id();
42+
this->location = proto.location();
43+
}
4144
std::string id;
4245
GeoPoint location;
4346
};
4447

4548
struct Path {
49+
Path(const viam::service::navigation::v1::Path& proto) {
50+
this->destination_waypoint_id = proto.destination_waypoint_id();
51+
this->geopoints = std::vector<GeoPoint>(proto.geopoints().begin(), proto.geopoints().end());
52+
}
4653
std::string destination_waypoint_id;
4754
std::vector<GeoPoint> geopoints;
4855
};
@@ -52,11 +59,11 @@ class Navigation : public Service {
5259
virtual Mode get_mode(const std::string name, const ProtoStruct& extra) = 0;
5360
virtual void set_mode(const std::string name, const Mode mode, const ProtoStruct& extra) = 0;
5461
virtual LocationResponse get_location(const std::string name, const ProtoStruct& extra) = 0;
55-
virtual std::vector<Waypoint> get_waypoints(const std::string name, const ProtoStruct& extra) = 0;
62+
virtual std::unique_ptr<std::vector<Waypoint>> get_waypoints(const std::string name, const ProtoStruct& extra) = 0;
5663
virtual void add_waypoint(const std::string name, const GeoPoint& location, const ProtoStruct& extra) = 0;
5764
virtual void remove_waypoint(const std::string name, const std::string id, const ProtoStruct& extra) = 0;
58-
virtual std::vector<GeoGeometry> get_obstacles(const std::string name, const ProtoStruct& extra) = 0;
59-
virtual std::vector<Path> get_paths(const std::string name, const ProtoStruct& extra) = 0;
65+
virtual std::unique_ptr<std::vector<GeoGeometry>> get_obstacles(const std::string name, const ProtoStruct& extra) = 0;
66+
virtual std::unique_ptr<std::vector<Path>> get_paths(const std::string name, const ProtoStruct& extra) = 0;
6067
virtual MapType get_properties(const std::string) = 0;
6168
virtual ProtoStruct do_command(const ProtoStruct& command) = 0;
6269

0 commit comments

Comments
 (0)