diff --git a/Development/nmos-cpp-node/node_implementation.cpp b/Development/nmos-cpp-node/node_implementation.cpp index 9661a109..4d76ab15 100644 --- a/Development/nmos-cpp-node/node_implementation.cpp +++ b/Development/nmos-cpp-node/node_implementation.cpp @@ -1293,7 +1293,7 @@ void node_implementation_init(nmos::node_model& model, nmos::experimental::contr utility::ostringstream_t role; role << U("receiver-monitor-") << ++count; - const auto& receiver = nmos::find_resource(model.node_resources, receiver_id); + const auto receiver = nmos::find_resource(model.node_resources, receiver_id); auto receiver_monitor = nmos::make_receiver_monitor(++oid, true, receivers_block_oid, role.str(), nmos::fields::label(receiver->data), nmos::fields::description(receiver->data), value_of({ { nmos::nc::details::make_touchpoint_nmos({nmos::ncp_touchpoint_resource_types::receiver, receiver_id}) } })); // optionally indicate dependencies within the device model nmos::set_object_dependency_paths(receiver_monitor, {{U("root"), U("receivers")}}); @@ -1314,7 +1314,7 @@ void node_implementation_init(nmos::node_model& model, nmos::experimental::contr utility::ostringstream_t role; role << U("sender-monitor-") << ++count; - const auto& sender = nmos::find_resource(model.node_resources, sender_id); + const auto sender = nmos::find_resource(model.node_resources, sender_id); const auto sender_monitor = nmos::make_sender_monitor(++oid, true, nmos::root_block_oid, role.str(), nmos::fields::label(sender->data), nmos::fields::description(sender->data), value_of({ { nmos::nc::details::make_touchpoint_nmos({nmos::ncp_touchpoint_resource_types::sender, sender_id}) } })); // add sender-monitor to root-block diff --git a/Development/nmos/configuration_api.cpp b/Development/nmos/configuration_api.cpp index ea85ba7b..e92ca6d4 100644 --- a/Development/nmos/configuration_api.cpp +++ b/Development/nmos/configuration_api.cpp @@ -74,7 +74,7 @@ namespace nmos { // get resource based on the oid const auto& oid = nmos::fields::nc::oid(member); - const auto& found = nmos::find_resource(resources, utility::s2us(std::to_string(oid))); + const auto found = nmos::find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != found) { build_role_paths(resources, *found, role_path, role_paths); diff --git a/Development/nmos/configuration_methods.cpp b/Development/nmos/configuration_methods.cpp index 1e1babca..376f1966 100644 --- a/Development/nmos/configuration_methods.cpp +++ b/Development/nmos/configuration_methods.cpp @@ -68,7 +68,7 @@ namespace nmos for (const auto& member : members) { - const auto& found = find_resource(resources, utility::s2us(std::to_string(nmos::fields::nc::oid(member)))); + const auto found = find_resource(resources, utility::s2us(std::to_string(nmos::fields::nc::oid(member)))); if (resources.end() != found) { diff --git a/Development/nmos/configuration_utils.cpp b/Development/nmos/configuration_utils.cpp index f297db97..5286c726 100644 --- a/Development/nmos/configuration_utils.cpp +++ b/Development/nmos/configuration_utils.cpp @@ -326,7 +326,7 @@ namespace nmos { // If constant oid then check oid from property holder and verify with oid from block member // Is this oid already in use? - const auto& child = find_resource(resources, utility::s2us(std::to_string(oid))); + const auto child = find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != child) { @@ -577,7 +577,7 @@ namespace nmos while (utility::s2us(std::to_string(nmos::root_block_oid)) != oid.as_string()) { - const auto& found = nmos::find_resource(resources, utility::s2us(std::to_string(nmos::fields::nc::owner(found_resource.data)))); + const auto found = nmos::find_resource(resources, utility::s2us(std::to_string(nmos::fields::nc::owner(found_resource.data)))); if (resources.end() == found) { break; diff --git a/Development/nmos/control_protocol_utils.cpp b/Development/nmos/control_protocol_utils.cpp index e9fae7f8..f611dbd1 100644 --- a/Development/nmos/control_protocol_utils.cpp +++ b/Development/nmos/control_protocol_utils.cpp @@ -366,7 +366,7 @@ namespace nmos { // get resource based on the oid const auto& oid = nmos::fields::nc::oid(*member_found); - const auto& found = nmos::find_resource(resources, utility::s2us(std::to_string(oid))); + const auto found = nmos::find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != found) { return get_nc_block_member_descriptor(resources, *found, role_path_segments); @@ -411,7 +411,7 @@ namespace nmos auto transition_counter = get_property(resources, oid, status_transition_counter_property_id, get_control_protocol_class_descriptor, gate).as_integer(); set_property_and_notify(resources, oid, status_transition_counter_property_id, ++transition_counter, get_control_protocol_class_descriptor, gate); } - const auto& found = find_resource(resources, utility::s2us(std::to_string(oid))); + const auto found = find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != found) { if (nmos::nc::is_sender_monitor(parse_class_id(nmos::fields::nc::class_id(found->data)))) @@ -721,7 +721,7 @@ namespace nmos { // get resource based on the oid const auto& oid = nmos::fields::nc::oid(member); - const auto& found = find_resource(resources, utility::s2us(std::to_string(oid))); + const auto found = find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != found) { nc::get_member_descriptors(resources, *found, recurse, descriptors); @@ -775,7 +775,7 @@ namespace nmos { // get resource based on the oid const auto& oid = nmos::fields::nc::oid(member); - const auto& found = find_resource(resources, utility::s2us(std::to_string(oid))); + const auto found = find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != found) { nc::find_members_by_role(resources, *found, role, match_whole_string, case_sensitive, recurse, descriptors); @@ -823,7 +823,7 @@ namespace nmos { // get resource based on the oid const auto& oid = nmos::fields::nc::oid(member); - const auto& found = find_resource(resources, utility::s2us(std::to_string(oid))); + const auto found = find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != found) { nc::find_members_by_class_id(resources, *found, class_id_, include_derived, recurse, descriptors); @@ -1025,7 +1025,7 @@ namespace nmos if (!block_member_descriptor.is_null()) { const auto& oid = nmos::fields::nc::oid(block_member_descriptor); - const auto& found = nmos::find_resource(resources, utility::s2us(std::to_string(oid))); + const auto found = nmos::find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != found) { return found; @@ -1113,7 +1113,7 @@ namespace nmos web::json::value get_property(const resources& resources, nc_oid oid, const nc_property_id& property_id, get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor, slog::base_gate& gate) { // get resource based on the oid - const auto& found = find_resource(resources, utility::s2us(std::to_string(oid))); + const auto found = find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != found) { // find the relevant nc_property_descriptor @@ -1130,7 +1130,7 @@ namespace nmos bool set_property_and_notify(resources& resources, nc_oid oid, const nc_property_id& property_id, const web::json::value& value, get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor, slog::base_gate& gate) { - const auto& found = find_resource(resources, utility::s2us(std::to_string(oid))); + const auto found = find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != found) { const auto& property = nc::find_property_descriptor(property_id, nc::details::parse_class_id(nmos::fields::nc::class_id(found->data)), get_control_protocol_class_descriptor); @@ -1184,7 +1184,7 @@ namespace nmos web::json::value get_property(const resources& resources, nc_oid oid, const utility::string_t& property_name, slog::base_gate& gate) { // get resource based on the oid - const auto& found = find_resource(resources, utility::s2us(std::to_string(oid))); + const auto found = find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != found) { // find the relevant nc_property_descriptor @@ -1323,7 +1323,7 @@ namespace nmos // domain specific statuses offering an Inactive option MUST transition immediately to the Healthy state. // Furthermore, after activation, as long as the monitor isn't being deactivated, it MUST delay the reporting // of non Healthy states for the duration specified by statusReportingDelay, and then transition to any other appropriate state. - const auto& found = find_resource(resources, utility::s2us(std::to_string(oid))); + const auto found = find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != found && nc::is_status_monitor(nc::details::parse_class_id(nmos::fields::nc::class_id(found->data)))) { const auto& class_id = nc::details::parse_class_id(nmos::fields::nc::class_id(found->data)); @@ -1382,7 +1382,7 @@ namespace nmos bool deactivate_monitor(resources& resources, nc_oid oid, get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor, slog::base_gate& gate) { - const auto& found = find_resource(resources, utility::s2us(std::to_string(oid))); + const auto found = find_resource(resources, utility::s2us(std::to_string(oid))); if (resources.end() != found && nc::is_status_monitor(nc::details::parse_class_id(nmos::fields::nc::class_id(found->data)))) { const auto& class_id = nc::details::parse_class_id(nmos::fields::nc::class_id(found->data)); diff --git a/Development/nmos/test/configuration_utils_test.cpp b/Development/nmos/test/configuration_utils_test.cpp index 88543fcc..20e9641b 100644 --- a/Development/nmos/test/configuration_utils_test.cpp +++ b/Development/nmos/test/configuration_utils_test.cpp @@ -407,7 +407,7 @@ BST_TEST_CASE(testApplyBackupDataSet) }; // Capture initial state of device model so we can reset after each check - const auto& root_resource = nmos::nc::find_resource_by_role_path(resources, value_of({ U("root") }).as_array()); + const auto root_resource = nmos::nc::find_resource_by_role_path(resources, value_of({ U("root") }).as_array()); auto initial_backup_dataset = nmos::get_properties_by_path(resources, *root_resource, true, false, get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor, nullptr); auto& initial_object_properties_holders = nmos::fields::nc::values(nmos::fields::nc::value(initial_backup_dataset));