.. _program_listing_file_include_controller_interface_helpers.hpp: Program Listing for File helpers.hpp ==================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/controller_interface/helpers.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright (c) 2021, Stogl Robotics Consulting UG (haftungsbeschränkt) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef CONTROLLER_INTERFACE__HELPERS_HPP_ #define CONTROLLER_INTERFACE__HELPERS_HPP_ #include #include #include namespace controller_interface { template bool get_ordered_interfaces( std::vector & unordered_interfaces, const std::vector & ordered_names, const std::string & interface_type, std::vector> & ordered_interfaces) { ordered_interfaces.reserve(ordered_names.size()); for (const auto & name : ordered_names) { for (auto & interface : unordered_interfaces) { if (!interface_type.empty()) { // check case where: // ( == AND == ) OR / == 'full name' if ( ((name == interface.get_prefix_name()) && (interface_type == interface.get_interface_name())) || ((name + "/" + interface_type) == interface.get_name())) { ordered_interfaces.push_back(std::ref(interface)); } } else { if (name == interface.get_name()) { ordered_interfaces.push_back(std::ref(interface)); } } } } return ordered_names.size() == ordered_interfaces.size(); } inline bool interface_list_contains_interface_type( const std::vector & interface_type_list, const std::string & interface_type) { return std::find(interface_type_list.begin(), interface_type_list.end(), interface_type) != interface_type_list.end(); } } // namespace controller_interface #endif // CONTROLLER_INTERFACE__HELPERS_HPP_