Skip to content

Commit c48fbca

Browse files
authored
Move component and service client/server classes out of the API (#215)
1 parent 5c1e819 commit c48fbca

File tree

131 files changed

+552
-632
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+552
-632
lines changed

src/viam/examples/camera/example_camera.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#include <unistd.h>
44
#include <vector>
55

6-
#include <viam/sdk/components/camera/camera.hpp>
7-
#include <viam/sdk/components/camera/client.hpp>
6+
#include <viam/sdk/components/camera.hpp>
87
#include <viam/sdk/robot/client.hpp>
98
#include <viam/sdk/robot/service.hpp>
109
#include <viam/sdk/rpc/dial.hpp>

src/viam/examples/dial/example_dial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <viam/api/robot/v1/robot.grpc.pb.h>
1818
#include <viam/api/robot/v1/robot.pb.h>
1919

20-
#include <viam/sdk/components/generic/client.hpp>
20+
#include <viam/sdk/components/generic.hpp>
2121
#include <viam/sdk/robot/client.hpp>
2222
#include <viam/sdk/robot/service.hpp>
2323
#include <viam/sdk/rpc/dial.hpp>

src/viam/examples/dial_api_key/example_dial_api_key.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <viam/api/robot/v1/robot.grpc.pb.h>
1818
#include <viam/api/robot/v1/robot.pb.h>
1919

20-
#include <viam/sdk/components/generic/client.hpp>
2120
#include <viam/sdk/robot/client.hpp>
2221
#include <viam/sdk/robot/service.hpp>
2322
#include <viam/sdk/rpc/dial.hpp>

src/viam/examples/mlmodel/example_audio_classification_client.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <boost/program_options.hpp>
3030

3131
#include <viam/sdk/robot/client.hpp>
32-
#include <viam/sdk/services/mlmodel/mlmodel.hpp>
32+
#include <viam/sdk/services/mlmodel.hpp>
3333

3434
namespace {
3535

src/viam/examples/modules/complex/base/impl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include <grpcpp/support/status.h>
99

10-
#include <viam/sdk/components/base/base.hpp>
10+
#include <viam/sdk/components/base.hpp>
1111
#include <viam/sdk/components/component.hpp>
1212
#include <viam/sdk/config/resource.hpp>
1313
#include <viam/sdk/resource/resource.hpp>

src/viam/examples/modules/complex/base/impl.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
22

3-
#include <viam/sdk/components/base/base.hpp>
3+
#include <viam/sdk/components/base.hpp>
44
#include <viam/sdk/components/component.hpp>
5-
#include <viam/sdk/components/motor/motor.hpp>
5+
#include <viam/sdk/components/motor.hpp>
66
#include <viam/sdk/config/resource.hpp>
77
#include <viam/sdk/resource/reconfigurable.hpp>
88
#include <viam/sdk/resource/resource.hpp>

src/viam/examples/modules/complex/client.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <viam/api/robot/v1/robot.grpc.pb.h>
1717
#include <viam/api/robot/v1/robot.pb.h>
1818

19-
#include <viam/sdk/components/base/client.hpp>
19+
#include <viam/sdk/components/base.hpp>
2020
#include <viam/sdk/robot/client.hpp>
2121
#include <viam/sdk/robot/service.hpp>
2222
#include <viam/sdk/rpc/dial.hpp>

src/viam/examples/modules/complex/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <viam/api/component/generic/v1/generic.grpc.pb.h>
1010
#include <viam/api/robot/v1/robot.pb.h>
1111

12-
#include <viam/sdk/components/base/base.hpp>
12+
#include <viam/sdk/components/base.hpp>
1313
#include <viam/sdk/components/component.hpp>
1414
#include <viam/sdk/config/resource.hpp>
1515
#include <viam/sdk/module/module.hpp>

src/viam/examples/modules/complex/test_complex_module.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,23 @@ BOOST_AUTO_TEST_SUITE(test_gizmo_client_server)
8787

8888
BOOST_AUTO_TEST_CASE(test_do_one) {
8989
const auto mock = test_gizmo_impl::get_gizmo();
90-
client_to_mock_pipeline<GizmoClient>(mock, [](Gizmo& client) {
90+
client_to_mock_pipeline<Gizmo>(mock, [](Gizmo& client) {
9191
BOOST_CHECK(client.do_one("foo"));
9292
BOOST_CHECK(!client.do_one("bar"));
9393
});
9494
}
9595

9696
BOOST_AUTO_TEST_CASE(test_do_one_client_stream) {
9797
const auto mock = test_gizmo_impl::get_gizmo();
98-
client_to_mock_pipeline<GizmoClient>(mock, [](Gizmo& client) {
98+
client_to_mock_pipeline<Gizmo>(mock, [](Gizmo& client) {
9999
BOOST_CHECK(client.do_one_client_stream({"foo", "foo"}));
100100
BOOST_CHECK(!client.do_one_client_stream({"foo", "bar"}));
101101
});
102102
}
103103

104104
BOOST_AUTO_TEST_CASE(test_do_one_server_stream) {
105105
const auto mock = test_gizmo_impl::get_gizmo();
106-
client_to_mock_pipeline<GizmoClient>(mock, [](Gizmo& client) {
106+
client_to_mock_pipeline<Gizmo>(mock, [](Gizmo& client) {
107107
std::vector<bool> ret1 = {true, false, true, false};
108108
std::vector<bool> ret2 = {false, false, true, false};
109109
BOOST_CHECK(client.do_one_server_stream("foo") == ret1);
@@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(test_do_one_server_stream) {
113113

114114
BOOST_AUTO_TEST_CASE(test_do_one_bidi_stream) {
115115
const auto mock = test_gizmo_impl::get_gizmo();
116-
client_to_mock_pipeline<GizmoClient>(mock, [](Gizmo& client) {
116+
client_to_mock_pipeline<Gizmo>(mock, [](Gizmo& client) {
117117
std::vector<bool> ret1 = {true, false};
118118
std::vector<bool> ret2 = {false, true};
119119
BOOST_CHECK(client.do_one_bidi_stream({"foo", "bar"}) == ret1);
@@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(test_do_one_bidi_stream) {
123123

124124
BOOST_AUTO_TEST_CASE(test_do_two) {
125125
const auto mock = test_gizmo_impl::get_gizmo();
126-
client_to_mock_pipeline<GizmoClient>(mock, [](Gizmo& client) {
126+
client_to_mock_pipeline<Gizmo>(mock, [](Gizmo& client) {
127127
BOOST_CHECK(client.do_two(true) == "arg1=true");
128128
BOOST_CHECK(client.do_two(false) == "arg1=false");
129129
});
@@ -151,7 +151,7 @@ BOOST_AUTO_TEST_SUITE(test_summation_client_server)
151151

152152
BOOST_AUTO_TEST_CASE(test_sum) {
153153
const auto mock = test_summation_impl::get_summation();
154-
client_to_mock_pipeline<SummationClient>(mock, [](Summation& client) {
154+
client_to_mock_pipeline<Summation>(mock, [](Summation& client) {
155155
double sum = client.sum({0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0});
156156
BOOST_CHECK(sum == 45);
157157
});

src/viam/examples/modules/simple/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <viam/sdk/resource/resource.hpp>
1919
#include <viam/sdk/rpc/dial.hpp>
2020
#include <viam/sdk/rpc/server.hpp>
21-
#include <viam/sdk/services/generic/generic.hpp>
21+
#include <viam/sdk/services/generic.hpp>
2222
#include <viam/sdk/services/service.hpp>
2323

2424
using namespace viam::sdk;

src/viam/examples/modules/tflite/main.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
#include <viam/sdk/resource/reconfigurable.hpp>
3434
#include <viam/sdk/resource/stoppable.hpp>
3535
#include <viam/sdk/rpc/server.hpp>
36-
#include <viam/sdk/services/mlmodel/mlmodel.hpp>
37-
#include <viam/sdk/services/mlmodel/server.hpp>
36+
#include <viam/sdk/services/mlmodel.hpp>
3837

3938
namespace {
4039

src/viam/examples/motor/example_motor.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
#include <unistd.h>
55
#include <vector>
66

7-
#include <viam/sdk/components/motor/client.hpp>
8-
#include <viam/sdk/components/motor/motor.hpp>
7+
#include <viam/sdk/components/motor.hpp>
98
#include <viam/sdk/robot/client.hpp>
109
#include <viam/sdk/robot/service.hpp>
1110
#include <viam/sdk/rpc/dial.hpp>

src/viam/sdk/CMakeLists.txt

+55-81
Original file line numberDiff line numberDiff line change
@@ -44,37 +44,37 @@ target_sources(viamsdk
4444
common/service_helper.cpp
4545
common/utils.cpp
4646
common/world_state.cpp
47-
components/base/base.cpp
48-
components/base/client.cpp
49-
components/base/server.cpp
50-
components/board/board.cpp
51-
components/board/client.cpp
52-
components/board/server.cpp
53-
components/camera/camera.cpp
54-
components/camera/client.cpp
55-
components/camera/server.cpp
47+
components/base.cpp
48+
components/board.cpp
49+
components/camera.cpp
5650
components/component.cpp
57-
components/encoder/client.cpp
58-
components/encoder/encoder.cpp
59-
components/encoder/server.cpp
60-
components/generic/client.cpp
61-
components/generic/generic.cpp
62-
components/generic/server.cpp
63-
components/motor/motor.cpp
64-
components/motor/client.cpp
65-
components/motor/server.cpp
66-
components/movement_sensor/client.cpp
67-
components/movement_sensor/movement_sensor.cpp
68-
components/movement_sensor/server.cpp
69-
components/power_sensor/client.cpp
70-
components/power_sensor/power_sensor.cpp
71-
components/power_sensor/server.cpp
72-
components/sensor/client.cpp
73-
components/sensor/sensor.cpp
74-
components/sensor/server.cpp
75-
components/servo/client.cpp
76-
components/servo/server.cpp
77-
components/servo/servo.cpp
51+
components/encoder.cpp
52+
components/generic.cpp
53+
components/motor.cpp
54+
components/movement_sensor.cpp
55+
components/power_sensor.cpp
56+
components/private/base_client.cpp
57+
components/private/base_server.cpp
58+
components/private/board_client.cpp
59+
components/private/board_server.cpp
60+
components/private/camera_client.cpp
61+
components/private/camera_server.cpp
62+
components/private/encoder_client.cpp
63+
components/private/encoder_server.cpp
64+
components/private/generic_client.cpp
65+
components/private/generic_server.cpp
66+
components/private/motor_client.cpp
67+
components/private/motor_server.cpp
68+
components/private/movement_sensor_client.cpp
69+
components/private/movement_sensor_server.cpp
70+
components/private/power_sensor_client.cpp
71+
components/private/power_sensor_server.cpp
72+
components/private/sensor_client.cpp
73+
components/private/sensor_server.cpp
74+
components/private/servo_client.cpp
75+
components/private/servo_server.cpp
76+
components/sensor.cpp
77+
components/servo.cpp
7878
config/resource.cpp
7979
module/handler_map.cpp
8080
module/module.cpp
@@ -92,20 +92,20 @@ target_sources(viamsdk
9292
robot/service.cpp
9393
rpc/dial.cpp
9494
rpc/server.cpp
95-
services/generic/client.cpp
96-
services/generic/generic.cpp
97-
services/generic/server.cpp
98-
services/mlmodel/client.cpp
99-
services/mlmodel/mlmodel.cpp
100-
services/mlmodel/private/proto.cpp
101-
services/mlmodel/server.cpp
102-
services/motion/client.cpp
103-
services/motion/motion.cpp
104-
services/motion/server.cpp
95+
services/generic.cpp
96+
services/mlmodel.cpp
97+
services/motion.cpp
98+
services/private/generic_client.cpp
99+
services/private/generic_server.cpp
100+
services/private/mlmodel.cpp
101+
services/private/mlmodel_client.cpp
102+
services/private/mlmodel_server.cpp
103+
services/private/motion_client.cpp
104+
services/private/motion_server.cpp
105105
services/service.cpp
106106
spatialmath/geometry.cpp
107-
spatialmath/orientation_types.cpp
108107
spatialmath/orientation.cpp
108+
spatialmath/orientation_types.cpp
109109
PUBLIC FILE_SET viamsdk_public_includes TYPE HEADERS
110110
BASE_DIRS
111111
../..
@@ -118,37 +118,17 @@ target_sources(viamsdk
118118
../../viam/sdk/common/service_helper.hpp
119119
../../viam/sdk/common/utils.hpp
120120
../../viam/sdk/common/world_state.hpp
121-
../../viam/sdk/components/base/base.hpp
122-
../../viam/sdk/components/base/client.hpp
123-
../../viam/sdk/components/base/server.hpp
124-
../../viam/sdk/components/board/board.hpp
125-
../../viam/sdk/components/board/client.hpp
126-
../../viam/sdk/components/board/server.hpp
127-
../../viam/sdk/components/camera/camera.hpp
128-
../../viam/sdk/components/camera/client.hpp
129-
../../viam/sdk/components/camera/server.hpp
121+
../../viam/sdk/components/base.hpp
122+
../../viam/sdk/components/board.hpp
123+
../../viam/sdk/components/camera.hpp
130124
../../viam/sdk/components/component.hpp
131-
../../viam/sdk/components/encoder/client.hpp
132-
../../viam/sdk/components/encoder/encoder.hpp
133-
../../viam/sdk/components/encoder/server.hpp
134-
../../viam/sdk/components/generic/client.hpp
135-
../../viam/sdk/components/generic/generic.hpp
136-
../../viam/sdk/components/generic/server.hpp
137-
../../viam/sdk/components/motor/motor.hpp
138-
../../viam/sdk/components/motor/client.hpp
139-
../../viam/sdk/components/motor/server.hpp
140-
../../viam/sdk/components/movement_sensor/client.hpp
141-
../../viam/sdk/components/movement_sensor/movement_sensor.hpp
142-
../../viam/sdk/components/movement_sensor/server.hpp
143-
../../viam/sdk/components/power_sensor/client.hpp
144-
../../viam/sdk/components/power_sensor/power_sensor.hpp
145-
../../viam/sdk/components/power_sensor/server.hpp
146-
../../viam/sdk/components/sensor/client.hpp
147-
../../viam/sdk/components/sensor/sensor.hpp
148-
../../viam/sdk/components/sensor/server.hpp
149-
../../viam/sdk/components/servo/client.hpp
150-
../../viam/sdk/components/servo/server.hpp
151-
../../viam/sdk/components/servo/servo.hpp
125+
../../viam/sdk/components/encoder.hpp
126+
../../viam/sdk/components/generic.hpp
127+
../../viam/sdk/components/motor.hpp
128+
../../viam/sdk/components/movement_sensor.hpp
129+
../../viam/sdk/components/power_sensor.hpp
130+
../../viam/sdk/components/sensor.hpp
131+
../../viam/sdk/components/servo.hpp
152132
../../viam/sdk/config/resource.hpp
153133
../../viam/sdk/module/handler_map.hpp
154134
../../viam/sdk/module/module.hpp
@@ -166,19 +146,13 @@ target_sources(viamsdk
166146
../../viam/sdk/robot/service.hpp
167147
../../viam/sdk/rpc/dial.hpp
168148
../../viam/sdk/rpc/server.hpp
169-
../../viam/sdk/services/generic/client.hpp
170-
../../viam/sdk/services/generic/generic.hpp
171-
../../viam/sdk/services/generic/server.hpp
172-
../../viam/sdk/services/mlmodel/client.hpp
173-
../../viam/sdk/services/mlmodel/mlmodel.hpp
174-
../../viam/sdk/services/mlmodel/server.hpp
175-
../../viam/sdk/services/motion/client.hpp
176-
../../viam/sdk/services/motion/motion.hpp
177-
../../viam/sdk/services/motion/server.hpp
149+
../../viam/sdk/services/generic.hpp
150+
../../viam/sdk/services/mlmodel.hpp
151+
../../viam/sdk/services/motion.hpp
178152
../../viam/sdk/services/service.hpp
179153
../../viam/sdk/spatialmath/geometry.hpp
180-
../../viam/sdk/spatialmath/orientation_types.hpp
181154
../../viam/sdk/spatialmath/orientation.hpp
155+
../../viam/sdk/spatialmath/orientation_types.hpp
182156
)
183157

184158
set_target_properties(

src/viam/sdk/components/base/base.cpp src/viam/sdk/components/base.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <viam/sdk/components/base/base.hpp>
1+
#include <viam/sdk/components/base.hpp>
22

33
#include <google/protobuf/descriptor.h>
44

src/viam/sdk/components/base/base.hpp src/viam/sdk/components/base.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// @file components/base/base.hpp
1+
/// @file components/base.hpp
22
///
33
/// @brief Defines a `Base` component.
44
#pragma once
@@ -18,7 +18,7 @@ namespace sdk {
1818

1919
/// @defgroup Base Classes related to the Base component.
2020

21-
/// @class Base base.hpp "components/base/base.hpp"
21+
/// @class Base base.hpp "components/base.hpp"
2222
/// @brief A `Base` is the platform that the other parts of a mobile robot attach to.
2323
/// @ingroup Base
2424
///

src/viam/sdk/components/board/board.cpp src/viam/sdk/components/board.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <viam/sdk/components/board/board.hpp>
1+
#include <viam/sdk/components/board.hpp>
22

33
#include <google/protobuf/descriptor.h>
44

src/viam/sdk/components/board/board.hpp src/viam/sdk/components/board.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// @file components/board/board.hpp
1+
/// @file components/board.hpp
22
///
33
/// @brief Defines a `Board` component.
44
#pragma once
@@ -15,7 +15,7 @@
1515
namespace viam {
1616
namespace sdk {
1717

18-
/// @class Board board.hpp "components/board/board.hpp"
18+
/// @class Board board.hpp "components/board.hpp"
1919
/// @brief Represents a physical board with gpio pins, digital interrupts, and analog voltage
2020
/// reading
2121
/// @ingroup Board

src/viam/sdk/components/camera/camera.cpp src/viam/sdk/components/camera.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <viam/sdk/components/camera/camera.hpp>
1+
#include <viam/sdk/components/camera.hpp>
22

33
#include <google/protobuf/descriptor.h>
44
#include <google/protobuf/util/time_util.h>

src/viam/sdk/components/camera/camera.hpp src/viam/sdk/components/camera.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// @file components/camera/camera.hpp
1+
/// @file components/camera.hpp
22
///
33
/// @brief Defines a `Camera` component.
44
#pragma once
@@ -19,7 +19,7 @@
1919
namespace viam {
2020
namespace sdk {
2121

22-
/// @class Camera camera.hpp "components/camera/camera.hpp"
22+
/// @class Camera camera.hpp "components/camera.hpp"
2323
/// @brief A `Camera` represents any physical hardware that can capture frames.
2424
/// @ingroup Camera
2525
///

src/viam/sdk/components/encoder/encoder.cpp src/viam/sdk/components/encoder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <viam/sdk/components/encoder/encoder.hpp>
1+
#include <viam/sdk/components/encoder.hpp>
22

33
#include <google/protobuf/descriptor.h>
44

0 commit comments

Comments
 (0)