Skip to content

Commit 7e72ae2

Browse files
committed
shared_ptr<X> -> X::SharedPtr
1 parent 0dcea6f commit 7e72ae2

File tree

8 files changed

+22
-26
lines changed

8 files changed

+22
-26
lines changed

controller_interface/include/controller_interface/chainable_controller_interface.hpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,10 @@ class ChainableControllerInterface : public ControllerInterfaceBase
5959
bool is_chainable() const final;
6060

6161
CONTROLLER_INTERFACE_PUBLIC
62-
std::vector<std::shared_ptr<hardware_interface::StateInterface>> export_state_interfaces() final;
62+
std::vector<hardware_interface::StateInterface::SharedPtr> export_state_interfaces() final;
6363

6464
CONTROLLER_INTERFACE_PUBLIC
65-
std::vector<std::shared_ptr<hardware_interface::CommandInterface>> export_reference_interfaces()
66-
final;
65+
std::vector<hardware_interface::CommandInterface::SharedPtr> export_reference_interfaces() final;
6766

6867
CONTROLLER_INTERFACE_PUBLIC
6968
bool set_chained_mode(bool chained_mode) final;
@@ -134,9 +133,8 @@ class ChainableControllerInterface : public ControllerInterfaceBase
134133

135134
/// Storage of values for state interfaces
136135
std::vector<std::string> exported_state_interface_names_;
137-
std::vector<std::shared_ptr<hardware_interface::StateInterface>>
138-
ordered_exported_state_interfaces_;
139-
std::unordered_map<std::string, std::shared_ptr<hardware_interface::StateInterface>>
136+
std::vector<hardware_interface::StateInterface::SharedPtr> ordered_exported_state_interfaces_;
137+
std::unordered_map<std::string, hardware_interface::StateInterface::SharedPtr>
140138
exported_state_interfaces_;
141139
// BEGIN (Handle export change): for backward compatibility
142140
std::vector<double> state_interfaces_values_;
@@ -147,8 +145,8 @@ class ChainableControllerInterface : public ControllerInterfaceBase
147145
// BEGIN (Handle export change): for backward compatibility
148146
std::vector<double> reference_interfaces_;
149147
// END
150-
std::vector<std::shared_ptr<hardware_interface::CommandInterface>> ordered_reference_interfaces_;
151-
std::unordered_map<std::string, std::shared_ptr<hardware_interface::CommandInterface>>
148+
std::vector<hardware_interface::CommandInterface::SharedPtr> ordered_reference_interfaces_;
149+
std::unordered_map<std::string, hardware_interface::CommandInterface::SharedPtr>
152150
reference_interfaces_ptrs_;
153151

154152
private:

controller_interface/include/controller_interface/controller_interface.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,15 @@ class ControllerInterface : public controller_interface::ControllerInterfaceBase
4747
* \returns empty list.
4848
*/
4949
CONTROLLER_INTERFACE_PUBLIC
50-
std::vector<std::shared_ptr<hardware_interface::StateInterface>> export_state_interfaces() final;
50+
std::vector<hardware_interface::StateInterface::SharedPtr> export_state_interfaces() final;
5151

5252
/**
5353
* Controller has no reference interfaces.
5454
*
5555
* \returns empty list.
5656
*/
5757
CONTROLLER_INTERFACE_PUBLIC
58-
std::vector<std::shared_ptr<hardware_interface::CommandInterface>> export_reference_interfaces()
59-
final;
58+
std::vector<hardware_interface::CommandInterface::SharedPtr> export_reference_interfaces() final;
6059

6160
/**
6261
* Controller is not chainable, therefore no chained mode can be set.

controller_interface/include/controller_interface/controller_interface_base.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class ControllerInterfaceBase : public rclcpp_lifecycle::node_interfaces::Lifecy
235235
* \returns list of command interfaces for preceding controllers.
236236
*/
237237
CONTROLLER_INTERFACE_PUBLIC
238-
virtual std::vector<std::shared_ptr<hardware_interface::CommandInterface>>
238+
virtual std::vector<hardware_interface::CommandInterface::SharedPtr>
239239
export_reference_interfaces() = 0;
240240

241241
/**
@@ -245,8 +245,7 @@ class ControllerInterfaceBase : public rclcpp_lifecycle::node_interfaces::Lifecy
245245
* \returns list of state interfaces for preceding controllers.
246246
*/
247247
CONTROLLER_INTERFACE_PUBLIC
248-
virtual std::vector<std::shared_ptr<hardware_interface::StateInterface>>
249-
export_state_interfaces() = 0;
248+
virtual std::vector<hardware_interface::StateInterface::SharedPtr> export_state_interfaces() = 0;
250249

251250
/**
252251
* Set chained mode of a chainable controller. This method triggers internal processes to switch

controller_interface/src/chainable_controller_interface.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ return_type ChainableControllerInterface::update(
4444
return ret;
4545
}
4646

47-
std::vector<std::shared_ptr<hardware_interface::StateInterface>>
47+
std::vector<hardware_interface::StateInterface::SharedPtr>
4848
ChainableControllerInterface::export_state_interfaces()
4949
{
5050
auto state_interfaces = on_export_state_interfaces();
51-
std::vector<std::shared_ptr<hardware_interface::StateInterface>> state_interfaces_ptrs_vec;
51+
std::vector<hardware_interface::StateInterface::SharedPtr> state_interfaces_ptrs_vec;
5252
state_interfaces_ptrs_vec.reserve(state_interfaces.size());
5353
ordered_exported_state_interfaces_.reserve(state_interfaces.size());
5454
exported_state_interface_names_.reserve(state_interfaces.size());
@@ -94,11 +94,11 @@ ChainableControllerInterface::export_state_interfaces()
9494
return state_interfaces_ptrs_vec;
9595
}
9696

97-
std::vector<std::shared_ptr<hardware_interface::CommandInterface>>
97+
std::vector<hardware_interface::CommandInterface::SharedPtr>
9898
ChainableControllerInterface::export_reference_interfaces()
9999
{
100100
auto reference_interfaces = on_export_reference_interfaces();
101-
std::vector<std::shared_ptr<hardware_interface::CommandInterface>> reference_interfaces_ptrs_vec;
101+
std::vector<hardware_interface::CommandInterface::SharedPtr> reference_interfaces_ptrs_vec;
102102
reference_interfaces_ptrs_vec.reserve(reference_interfaces.size());
103103
exported_reference_interface_names_.reserve(reference_interfaces.size());
104104
ordered_reference_interfaces_.reserve(reference_interfaces.size());
@@ -134,7 +134,7 @@ ChainableControllerInterface::export_reference_interfaces()
134134
throw std::runtime_error(error_msg);
135135
}
136136

137-
std::shared_ptr<hardware_interface::CommandInterface> reference_interface =
137+
hardware_interface::CommandInterface::SharedPtr reference_interface =
138138
std::make_shared<hardware_interface::CommandInterface>(std::move(interface));
139139
const auto inteface_name = reference_interface->get_name();
140140
// check the exported interface name is unique

controller_interface/src/controller_interface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ ControllerInterface::ControllerInterface() : ControllerInterfaceBase() {}
2222

2323
bool ControllerInterface::is_chainable() const { return false; }
2424

25-
std::vector<std::shared_ptr<hardware_interface::StateInterface>>
25+
std::vector<hardware_interface::StateInterface::SharedPtr>
2626
ControllerInterface::export_state_interfaces()
2727
{
2828
return {};
2929
}
3030

31-
std::vector<std::shared_ptr<hardware_interface::CommandInterface>>
31+
std::vector<hardware_interface::CommandInterface::SharedPtr>
3232
ControllerInterface::export_reference_interfaces()
3333
{
3434
return {};

controller_interface/test/test_chainable_controller_interface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ TEST_F(ChainableControllerInterfaceTest, interfaces_prefix_is_not_node_name)
8989
controller.set_name_prefix_of_reference_interfaces("some_not_correct_interface_prefix");
9090

9191
// expect empty return because interface prefix is not equal to the node name
92-
std::vector<std::shared_ptr<hardware_interface::CommandInterface>> exported_reference_interfaces;
92+
std::vector<hardware_interface::CommandInterface::SharedPtr> exported_reference_interfaces;
9393
EXPECT_THROW(
9494
{ exported_reference_interfaces = controller.export_reference_interfaces(); },
9595
std::runtime_error);
9696
ASSERT_THAT(exported_reference_interfaces, IsEmpty());
9797
// expect empty return because interface prefix is not equal to the node name
98-
std::vector<std::shared_ptr<hardware_interface::StateInterface>> exported_state_interfaces;
98+
std::vector<hardware_interface::StateInterface::SharedPtr> exported_state_interfaces;
9999
EXPECT_THROW(
100100
{ exported_state_interfaces = controller.export_state_interfaces(); }, std::runtime_error);
101101
ASSERT_THAT(exported_state_interfaces, IsEmpty());

controller_manager/src/controller_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,8 @@ controller_interface::return_type ControllerManager::configure_controller(
771771
get_logger(),
772772
"Controller '%s' is chainable. Interfaces are being exported to resource manager.",
773773
controller_name.c_str());
774-
std::vector<std::shared_ptr<hardware_interface::StateInterface>> state_interfaces;
775-
std::vector<std::shared_ptr<hardware_interface::CommandInterface>> ref_interfaces;
774+
std::vector<hardware_interface::StateInterface::SharedPtr> state_interfaces;
775+
std::vector<hardware_interface::CommandInterface::SharedPtr> ref_interfaces;
776776
try
777777
{
778778
state_interfaces = controller->export_state_interfaces();

hardware_interface_testing/test/test_resource_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ TEST_F(ResourceManagerTest, managing_controllers_reference_interfaces)
12301230
CONTROLLER_NAME + "/" + REFERENCE_INTERFACE_NAMES[1],
12311231
CONTROLLER_NAME + "/" + REFERENCE_INTERFACE_NAMES[2]};
12321232

1233-
std::vector<std::shared_ptr<hardware_interface::CommandInterface>> reference_interfaces;
1233+
std::vector<hardware_interface::CommandInterface::SharedPtr> reference_interfaces;
12341234
std::vector<double> reference_interface_values = {1.0, 2.0, 3.0};
12351235

12361236
for (size_t i = 0; i < REFERENCE_INTERFACE_NAMES.size(); ++i)

0 commit comments

Comments
 (0)