File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
include/rclcpp/node_interfaces
test/rclcpp/node_interfaces Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ struct NodeInterfacesStorage
4444 : interfaces_(init_tuple<decltype (node), InterfaceTs ...>(node))
4545 {}
4646
47+ NodeInterfacesStorage ()
48+ : interfaces_()
49+ {}
50+
4751 explicit NodeInterfacesStorage (std::shared_ptr<InterfaceTs>... args)
4852 : interfaces_(args ...)
4953 {}
Original file line number Diff line number Diff line change @@ -147,6 +147,11 @@ class NodeInterfaces
147147 : NodeInterfacesSupportsT(node)
148148 {}
149149
150+ // Create a NodeInterfaces object with no bound interfaces
151+ NodeInterfaces ()
152+ : NodeInterfacesSupportsT()
153+ {}
154+
150155 explicit NodeInterfaces (std::shared_ptr<InterfaceTs>... args)
151156 : NodeInterfacesSupportsT(args ...)
152157 {}
Original file line number Diff line number Diff line change @@ -33,6 +33,15 @@ class TestNodeInterfaces : public ::testing::Test
3333 }
3434};
3535
36+ TEST_F (TestNodeInterfaces, default_constructor) {
37+ auto node = std::make_shared<rclcpp::Node>(" my_node" );
38+ using rclcpp::node_interfaces::NodeInterfaces;
39+ using rclcpp::node_interfaces::NodeBaseInterface;
40+ using rclcpp::node_interfaces::NodeGraphInterface;
41+ NodeInterfaces<NodeBaseInterface, NodeGraphInterface> interfaces;
42+ interfaces = NodeInterfaces<NodeBaseInterface, NodeGraphInterface>(*node);
43+ }
44+
3645/*
3746 Testing NodeInterfaces construction from nodes.
3847 */
You can’t perform that action at this time.
0 commit comments