Skip to content

Commit b901f59

Browse files
authored
[RSDK-10768] Use the expected name for single input tensors (#439)
1 parent 777f1fd commit b901f59

34 files changed

+158
-114
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ docker build --build-arg BASE_TAG=base/bullseye --build-arg GIT_TAG=[...] -f etc
3737
```
3838

3939
This will use `base/bullseye` as a base to build the SDK version provided in `GIT_TAG`,
40-
which should be a tagged release version. The SDK will be cloned from
40+
which should be a tagged release version. The SDK will be cloned from
4141
https://github.com/viamrobotics/viam-cpp-sdk/. This is the recommended approach for
4242
C++ module development, which should generally be done against a tagged release.
4343

@@ -47,22 +47,22 @@ docker build --build-arg BASE_TAG=base/bullseye --build-arg REPO_SETUP=copy -f e
4747
```
4848

4949
Note the use of the build argument `REPO_SETUP=copy`, which adds a Docker instruction
50-
to copy the SDK repo from the current working directory, rather than cloning from
50+
to copy the SDK repo from the current working directory, rather than cloning from
5151
GitHub. This approach may make more sense for developing on the SDK itself, or if
5252
your C++ SDK development relies on a localversion of the SDK.
5353

5454
The examples above illustrated the use of several `--build-arg` arguments, namely
55-
`BASE_TAG`, `GIT_TAG`, and `REPO_SETUP`. Please see
55+
`BASE_TAG`, `GIT_TAG`, and `REPO_SETUP`. Please see
5656
[Dockerfile.sdk-build](etc/docker/Dockerfile.sdk-build) for a complete account of
5757
all build arguments and their defaults.
5858

5959
## Building Documentation Locally for Testing
6060
The C++ sdk uses [Doxygen](https://www.doxygen.nl/) to generate documentation.
6161
An automated workflow will generate and update our documentation on each merge,
62-
and publish it to [cpp.viam.dev](https://cpp.viam.dev).
62+
and publish it to [cpp.viam.dev](https://cpp.viam.dev).
6363

6464
Generating documentation locally to observe changes while developing with the
65-
C++ SDK is simple.
65+
C++ SDK is simple.
6666
First, make sure doxygen is installed, e.g.,
6767
```
6868
(on mac) brew install doxygen
@@ -91,10 +91,10 @@ quickly as possible.
9191
## A note on logging
9292

9393
Users should only interact with logging via the macros, classes, and functions in
94-
[`viam/sdk/log/logging.hpp`](src/viam/sdk/log/logging.hpp). Logging is
94+
[`viam/sdk/log/logging.hpp`](src/viam/sdk/log/logging.hpp). Logging is
9595
implemented using Boost.Log, but this is an implementation detail subject
9696
to change without warning. In particular, using Boost.Log macros such as
97-
`BOOST_LOG_TRIVIAL` or `BOOST_LOG_SEV` is undefined behavior which will likely
97+
`BOOST_LOG_TRIVIAL` or `BOOST_LOG_SEV` is undefined behavior which will likely
9898
fail to output log messages.
9999

100100
## License

src/viam/examples/modules/complex/gizmo/api.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ API API::traits<Gizmo>::api() {
2424
return {"viam", "component", "gizmo"};
2525
}
2626

27-
Gizmo::Gizmo(std::string name) : Component(std::move(name)){};
27+
Gizmo::Gizmo(std::string name) : Component(std::move(name)) {}
2828

2929
/* Gizmo server methods */
3030

3131
GizmoServer::GizmoServer(std::shared_ptr<ResourceManager> manager)
32-
: ResourceServer(std::move(manager)){};
32+
: ResourceServer(std::move(manager)) {}
3333

3434
grpc::Status GizmoServer::DoOne(grpc::ServerContext* context,
3535
const DoOneRequest* request,
@@ -170,7 +170,7 @@ grpc::Status GizmoServer::DoTwo(::grpc::ServerContext* context,
170170
/* Gizmo client methods */
171171

172172
GizmoClient::GizmoClient(std::string name, std::shared_ptr<grpc::Channel> channel)
173-
: Gizmo(std::move(name)), stub_(GizmoService::NewStub(channel)), channel_(std::move(channel)){};
173+
: Gizmo(std::move(name)), stub_(GizmoService::NewStub(channel)), channel_(std::move(channel)) {}
174174

175175
bool GizmoClient::do_one(std::string arg1) {
176176
return make_client_helper(this, *stub_, &StubType::DoOne)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ using namespace viam::sdk;
1414
// `validate` method that checks config validity.
1515
class MyGizmo : public Gizmo, public Reconfigurable {
1616
public:
17-
MyGizmo(std::string name, std::string arg1) : Gizmo(std::move(name)), arg1_(std::move(arg1)){};
17+
MyGizmo(std::string name, std::string arg1) : Gizmo(std::move(name)), arg1_(std::move(arg1)) {}
1818
MyGizmo(const Dependencies& deps, const ResourceConfig& cfg) : Gizmo(cfg.name()) {
1919
this->reconfigure(deps, cfg);
20-
};
20+
}
2121
void reconfigure(const Dependencies& deps, const ResourceConfig& cfg) override;
2222
static std::vector<std::string> validate(ResourceConfig cfg);
2323

src/viam/examples/modules/complex/summation/api.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ API API::traits<Summation>::api() {
2424
return {"viam", "service", "summation"};
2525
}
2626

27-
Summation::Summation(std::string name) : Service(std::move(name)){};
27+
Summation::Summation(std::string name) : Service(std::move(name)) {}
2828

2929
/* Summation server methods */
3030

3131
SummationServer::SummationServer(std::shared_ptr<ResourceManager> manager)
32-
: ResourceServer(std::move(manager)){};
32+
: ResourceServer(std::move(manager)) {}
3333

3434
grpc::Status SummationServer::Sum(grpc::ServerContext* context,
3535
const SumRequest* request,
@@ -58,7 +58,7 @@ grpc::Status SummationServer::Sum(grpc::ServerContext* context,
5858
SummationClient::SummationClient(std::string name, std::shared_ptr<grpc::Channel> channel)
5959
: Summation(std::move(name)),
6060
stub_(SummationService::NewStub(channel)),
61-
channel_(std::move(channel)){};
61+
channel_(std::move(channel)) {}
6262

6363
double SummationClient::sum(std::vector<double> numbers) {
6464
return make_client_helper(this, *stub_, &StubType::Sum)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ using namespace viam::sdk;
1313
class MySummation : public Summation, public Reconfigurable {
1414
public:
1515
MySummation(std::string name, bool subtract)
16-
: Summation(std::move(name)), subtract_(subtract){};
16+
: Summation(std::move(name)), subtract_(subtract) {}
1717
MySummation(const Dependencies& deps, const ResourceConfig& cfg) : Summation(cfg.name()) {
1818
this->reconfigure(deps, cfg);
19-
};
19+
}
2020
void reconfigure(const Dependencies& deps, const ResourceConfig& cfg) override;
2121
static std::vector<std::string> validate(ResourceConfig cfg);
2222

src/viam/sdk/components/base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ bool operator==(const Base::properties& lhs, const Base::properties& rhs) {
2424
lhs.turning_radius_meters == rhs.turning_radius_meters;
2525
}
2626

27-
Base::Base(std::string name) : Component(std::move(name)){};
27+
Base::Base(std::string name) : Component(std::move(name)) {}
2828

2929
} // namespace sdk
3030
} // namespace viam

src/viam/sdk/components/board.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ API API::traits<Board>::api() {
1616
return {kRDK, kComponent, "board"};
1717
}
1818

19-
Board::Board(std::string name) : Component(std::move(name)){};
19+
Board::Board(std::string name) : Component(std::move(name)) {}
2020

2121
bool operator==(const Board::status& lhs, const Board::status& rhs) {
2222
return (lhs.analog_reader_values == rhs.analog_reader_values &&

src/viam/sdk/components/camera.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ std::string Camera::normalize_mime_type(const std::string& str) {
130130
return mime_type;
131131
}
132132

133-
Camera::Camera(std::string name) : Component(std::move(name)){};
133+
Camera::Camera(std::string name) : Component(std::move(name)) {}
134134

135135
bool operator==(const Camera::point_cloud& lhs, const Camera::point_cloud& rhs) {
136136
return lhs.mime_type == rhs.mime_type && lhs.pc == rhs.pc;

src/viam/sdk/components/encoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ API API::traits<Encoder>::api() {
1515
return {kRDK, kComponent, "encoder"};
1616
}
1717

18-
Encoder::Encoder(std::string name) : Component(std::move(name)){};
18+
Encoder::Encoder(std::string name) : Component(std::move(name)) {}
1919

2020
bool operator==(const Encoder::position& lhs, const Encoder::position& rhs) {
2121
return (lhs.value == rhs.value && lhs.type == rhs.type);

src/viam/sdk/components/generic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ API API::traits<GenericComponent>::api() {
1111
return {kRDK, kComponent, "generic"};
1212
}
1313

14-
GenericComponent::GenericComponent(std::string name) : Component(std::move(name)){};
14+
GenericComponent::GenericComponent(std::string name) : Component(std::move(name)) {}
1515

1616
} // namespace sdk
1717
} // namespace viam

src/viam/sdk/components/motor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ API API::traits<Motor>::api() {
1616
return {kRDK, kComponent, "motor"};
1717
}
1818

19-
Motor::Motor(std::string name) : Component(std::move(name)){};
19+
Motor::Motor(std::string name) : Component(std::move(name)) {}
2020

2121
bool operator==(const Motor::power_status& lhs, const Motor::power_status& rhs) {
2222
return (lhs.is_on == rhs.is_on && lhs.power_pct == rhs.power_pct);

src/viam/sdk/components/movement_sensor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class MovementSensor : public Component {
118118
virtual std::vector<GeometryConfig> get_geometries(const ProtoStruct& extra) = 0;
119119

120120
protected:
121-
explicit MovementSensor(std::string name) : Component(std::move(name)){};
121+
explicit MovementSensor(std::string name) : Component(std::move(name)) {}
122122
};
123123

124124
template <>

src/viam/sdk/components/power_sensor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class PowerSensor : public Component {
8989
virtual ProtoStruct do_command(const ProtoStruct& command) = 0;
9090

9191
protected:
92-
explicit PowerSensor(std::string name) : Component(std::move(name)){};
92+
explicit PowerSensor(std::string name) : Component(std::move(name)) {}
9393
};
9494

9595
template <>

src/viam/sdk/components/private/camera_client.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class CameraClient : public Camera {
5050
// avoid use of this constructor outside of tests.
5151
CameraClient(std::string name,
5252
std::unique_ptr<viam::component::camera::v1::CameraService::StubInterface> stub)
53-
: Camera(std::move(name)), stub_(std::move(stub)){};
53+
: Camera(std::move(name)), stub_(std::move(stub)) {}
5454

5555
private:
5656
using StubType = viam::component::camera::v1::CameraService::StubInterface;

src/viam/sdk/components/private/generic_client.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class GenericComponentClient : public GenericComponent {
3131
GenericComponentClient(
3232
std::string name,
3333
std::unique_ptr<viam::component::generic::v1::GenericService::StubInterface> stub)
34-
: GenericComponent(std::move(name)), stub_(std::move(stub)){};
34+
: GenericComponent(std::move(name)), stub_(std::move(stub)) {}
3535

3636
private:
3737
using StubType = viam::component::generic::v1::GenericService::StubInterface;

src/viam/sdk/components/sensor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Sensor : public Component {
5151
virtual ProtoStruct get_readings(const ProtoStruct& extra) = 0;
5252

5353
protected:
54-
explicit Sensor(std::string name) : Component(std::move(name)){};
54+
explicit Sensor(std::string name) : Component(std::move(name)) {}
5555
};
5656

5757
template <>

src/viam/sdk/components/servo.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class Servo : public Component, public Stoppable {
6868
virtual std::vector<GeometryConfig> get_geometries(const ProtoStruct& extra) = 0;
6969

7070
protected:
71-
explicit Servo(std::string name) : Component(std::move(name)){};
71+
explicit Servo(std::string name) : Component(std::move(name)) {}
7272
};
7373

7474
template <>

src/viam/sdk/resource/resource_server_base.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ResourceServer {
1010
const std::shared_ptr<ResourceManager>& resource_manager() const;
1111

1212
protected:
13-
ResourceServer(std::shared_ptr<ResourceManager> manager) : manager_(manager){};
13+
ResourceServer(std::shared_ptr<ResourceManager> manager) : manager_(manager) {}
1414

1515
private:
1616
std::shared_ptr<ResourceManager> manager_;

src/viam/sdk/services/generic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ API API::traits<GenericService>::api() {
1616
return {kRDK, kService, "generic"};
1717
}
1818

19-
GenericService::GenericService(std::string name) : Service(std::move(name)){};
19+
GenericService::GenericService(std::string name) : Service(std::move(name)) {}
2020

2121
} // namespace sdk
2222
} // namespace viam

src/viam/sdk/services/motion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace viam {
99
namespace sdk {
1010

11-
Motion::Motion(std::string name) : Service(std::move(name)){};
11+
Motion::Motion(std::string name) : Service(std::move(name)) {}
1212

1313
API Motion::api() const {
1414
return API::get<Motion>();

src/viam/sdk/services/private/generic_client.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class GenericServiceClient : public GenericService {
3030
GenericServiceClient(
3131
std::string name,
3232
std::unique_ptr<viam::service::generic::v1::GenericService::StubInterface> stub)
33-
: GenericService(std::move(name)), stub_(std::move(stub)){};
33+
: GenericService(std::move(name)), stub_(std::move(stub)) {}
3434

3535
private:
3636
using StubType = viam::service::generic::v1::GenericService::StubInterface;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ::grpc::Status MLModelServiceServer::Infer(
5454
<< static_cast<ut>(tensor_type);
5555
return helper.fail(::grpc::INVALID_ARGUMENT, message.str().c_str());
5656
}
57-
inputs.emplace(tensor_pair.first, std::move(tensor));
57+
inputs.emplace(input.name, std::move(tensor));
5858
} else {
5959
// Normal case: multiple tensors, do metadata checks
6060
// If there are extra tensors in the inputs that not found in the metadata,

src/viam/sdk/tests/mocks/camera_mocks.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class MockCamera : public Camera {
1717
std::vector<GeometryConfig> get_geometries(const sdk::ProtoStruct& extra) override;
1818
properties get_properties() override;
1919
static std::shared_ptr<MockCamera> get_mock_camera();
20-
MockCamera(std::string name) : Camera(std::move(name)){};
20+
MockCamera(std::string name) : Camera(std::move(name)) {}
2121

2222
private:
2323
Camera::intrinsic_parameters intrinsic_parameters_;

src/viam/sdk/tests/mocks/generic_mocks.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ using namespace viam::sdk;
1313

1414
class MockGenericComponent : public GenericComponent {
1515
public:
16-
MockGenericComponent(std::string name) : GenericComponent(std::move(name)){};
16+
MockGenericComponent(std::string name) : GenericComponent(std::move(name)) {}
1717
ProtoStruct do_command(const ProtoStruct& command) override;
1818

1919
static std::shared_ptr<MockGenericComponent> get_mock_generic();
@@ -26,7 +26,7 @@ class MockGenericComponent : public GenericComponent {
2626

2727
class MockGenericService : public GenericService {
2828
public:
29-
MockGenericService(std::string name) : GenericService(std::move(name)){};
29+
MockGenericService(std::string name) : GenericService(std::move(name)) {}
3030
ProtoStruct do_command(const ProtoStruct& command) override;
3131

3232
static std::shared_ptr<MockGenericService> get_mock_generic();

src/viam/sdk/tests/mocks/mock_base.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class MockBase : public sdk::Base {
3939
bool peek_stop_called;
4040
sdk::ProtoStruct peek_do_command_command;
4141

42-
MockBase(std::string name) : Base(std::move(name)){};
42+
MockBase(std::string name) : Base(std::move(name)) {}
4343
};
4444

4545
} // namespace base

src/viam/sdk/tests/mocks/mock_board.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace board {
1010

1111
using namespace viam::sdk;
1212

13-
MockBoard::MockBoard(std::string name) : Board(std::move(name)){};
13+
MockBoard::MockBoard(std::string name) : Board(std::move(name)) {}
1414

1515
void MockBoard::set_gpio(const std::string& pin, bool high, const ProtoStruct&) {
1616
this->peek_pin = pin;

src/viam/sdk/tests/mocks/mock_encoder.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class MockEncoder : public viam::sdk::Encoder {
1717
viam::sdk::ProtoStruct do_command(const viam::sdk::ProtoStruct& command) override;
1818
static std::shared_ptr<MockEncoder> get_mock_encoder();
1919

20-
MockEncoder(std::string name) : Encoder(std::move(name)){};
20+
MockEncoder(std::string name) : Encoder(std::move(name)) {}
2121

2222
// For testing purposes only.
2323
bool peek_reset_position_called;

src/viam/sdk/tests/mocks/mock_motion.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class MockMotion : public sdk::Motion {
100100
std::shared_ptr<sdk::WorldState> peek_world_state;
101101

102102
MockMotion(std::string name)
103-
: sdk::Motion(std::move(name)), current_location(init_fake_pose()){};
103+
: sdk::Motion(std::move(name)), current_location(init_fake_pose()) {}
104104
};
105105

106106
} // namespace motion

src/viam/sdk/tests/mocks/mock_motor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class MockMotor : public Motor {
2626
static std::shared_ptr<MockMotor> get_mock_motor();
2727
virtual std::vector<sdk::GeometryConfig> get_geometries(const sdk::ProtoStruct& extra) override;
2828

29-
MockMotor(std::string name) : Motor(std::move(name)){};
29+
MockMotor(std::string name) : Motor(std::move(name)) {}
3030

3131
using Motor::get_geometries;
3232
using Motor::get_position;

src/viam/sdk/tests/mocks/mock_movement_sensor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class MockMovementSensor : public sdk::MovementSensor {
3131
std::unordered_map<std::string, float> peek_accuracy;
3232
sdk::ProtoStruct peek_do_command_command;
3333

34-
MockMovementSensor(std::string name) : MovementSensor(std::move(name)){};
34+
MockMovementSensor(std::string name) : MovementSensor(std::move(name)) {}
3535
};
3636

3737
} // namespace movementsensor

src/viam/sdk/tests/mocks/mock_power_sensor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class MockPowerSensor : public sdk::PowerSensor {
2222
sdk::PowerSensor::current peek_current;
2323
double peek_power;
2424

25-
MockPowerSensor(std::string name) : PowerSensor(std::move(name)){};
25+
MockPowerSensor(std::string name) : PowerSensor(std::move(name)) {}
2626
};
2727

2828
} // namespace powersensor

src/viam/sdk/tests/mocks/mock_sensor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class MockSensor : public sdk::Sensor {
1414
static std::shared_ptr<MockSensor> get_mock_sensor();
1515
std::vector<sdk::GeometryConfig> get_geometries(const sdk::ProtoStruct& extra) override;
1616

17-
MockSensor(std::string name) : Sensor(std::move(name)){};
17+
MockSensor(std::string name) : Sensor(std::move(name)) {}
1818
};
1919

2020
} // namespace sensor

src/viam/sdk/tests/mocks/mock_servo.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class MockServo : public Servo {
1919
static std::shared_ptr<MockServo> get_mock_servo();
2020
virtual std::vector<sdk::GeometryConfig> get_geometries(const sdk::ProtoStruct& extra) override;
2121

22-
MockServo(std::string name) : Servo(std::move(name)){};
22+
MockServo(std::string name) : Servo(std::move(name)) {}
2323

2424
using Servo::get_geometries;
2525
using Servo::get_position;

0 commit comments

Comments
 (0)