.. _program_listing_file_include_profile_manager.h: Program Listing for File profile_manager.h ========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/profile_manager.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2023 Intel Corporation. All Rights Reserved. // // 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. #pragma once #include #include #define STREAM_NAME(sip) (static_cast(std::ostringstream() << create_graph_resource_name(ros_stream_to_string(sip.first)) << ((sip.second>0) ? std::to_string(sip.second) : ""))).str() using namespace rs2; namespace realsense2_camera { typedef std::pair stream_index_pair; class ProfilesManager { public: ProfilesManager(std::shared_ptr parameters, rclcpp::Logger logger); virtual bool isWantedProfile(const rs2::stream_profile& profile) = 0; virtual void registerProfileParameters(std::vector all_profiles, std::function update_sensor_func) = 0; bool isTypeExist(); static std::string profile_string(const rs2::stream_profile& profile); void registerSensorQOSParam(std::string template_name, std::set unique_sips, std::map >& params, std::string value); template void registerSensorUpdateParam(std::string template_name, std::set unique_sips, std::map >& params, T value, std::function update_sensor_func); void addWantedProfiles(std::vector& wanted_profiles); void clearParameters(); bool hasSIP(const stream_index_pair& sip) const; rmw_qos_profile_t getQOS(const stream_index_pair& sip) const; rmw_qos_profile_t getInfoQOS(const stream_index_pair& sip) const; protected: std::map getDefaultProfiles(); protected: rclcpp::Logger _logger; SensorParams _params; std::map> _enabled_profiles; std::map> _profiles_image_qos_str, _profiles_info_qos_str; std::vector _all_profiles; std::vector _parameters_names; }; class VideoProfilesManager : public ProfilesManager { public: VideoProfilesManager(std::shared_ptr parameters, const std::string& module_name, rclcpp::Logger logger, bool force_image_default_qos = false); bool isWantedProfile(const rs2::stream_profile& profile) override; void registerProfileParameters(std::vector all_profiles, std::function update_sensor_func) override; int getHeight(rs2_stream stream_type) {return _height[stream_type];}; int getWidth(rs2_stream stream_type) {return _width[stream_type];}; int getFPS(rs2_stream stream_type) {return _fps[stream_type];}; private: bool isSameProfileValues(const rs2::stream_profile& profile, const int width, const int height, const int fps, const rs2_format format); rs2::stream_profile validateAndGetSuitableProfile(rs2_stream stream_type, rs2::stream_profile given_profile); void registerVideoSensorProfileFormat(stream_index_pair sip); void registerVideoSensorParams(std::set sips); std::string get_profiles_descriptions(rs2_stream stream_type); std::string getProfileFormatsDescriptions(stream_index_pair sip); private: std::string _module_name; std::map _formats; std::map _fps, _width, _height; bool _force_image_default_qos; }; class MotionProfilesManager : public ProfilesManager { public: using ProfilesManager::ProfilesManager; bool isWantedProfile(const rs2::stream_profile& profile) override; void registerProfileParameters(std::vector all_profiles, std::function update_sensor_func) override; private: void registerFPSParams(); bool isSameProfileValues(const rs2::stream_profile& profile, const rs2_stream stype, const int fps); std::map> getAvailableFPSValues(); protected: std::map > _fps; }; }