diff --git a/third-party/realdds/include/realdds/dds-device-server.h b/third-party/realdds/include/realdds/dds-device-server.h index 8255bf14bc..255e2a4e83 100644 --- a/third-party/realdds/include/realdds/dds-device-server.h +++ b/third-party/realdds/include/realdds/dds-device-server.h @@ -65,6 +65,7 @@ class dds_device_server dds_guid const & guid() const; std::shared_ptr< dds_participant > participant() const; std::shared_ptr< dds_subscriber > subscriber() const { return _subscriber; } + std::shared_ptr< dds_publisher > publisher() const { return _publisher; } std::string const & topic_root() const { return _topic_root; } rsutils::string::slice debug_name() const; diff --git a/third-party/realdds/include/realdds/dds-stream-sensor-bridge.h b/third-party/realdds/include/realdds/dds-stream-sensor-bridge.h index b188b039f8..c94e7e27dd 100644 --- a/third-party/realdds/include/realdds/dds-stream-sensor-bridge.h +++ b/third-party/realdds/include/realdds/dds-stream-sensor-bridge.h @@ -101,6 +101,9 @@ class dds_stream_sensor_bridge // Return true if the stream for the given server is currently streaming bool is_streaming( std::shared_ptr< dds_stream_server > const & ) const; + // Return the profile a server is set to, even if not yet streaming + std::shared_ptr< dds_stream_profile > get_profile( std::shared_ptr< dds_stream_server > const & ) const; + // Notifications public: void on_readers_changed( readers_changed_callback callback ) { _on_readers_changed = std::move( callback ); } diff --git a/third-party/realdds/include/realdds/topics/dds-topic-names.h b/third-party/realdds/include/realdds/topics/dds-topic-names.h index cb0d36e9ef..e99376dd6c 100644 --- a/third-party/realdds/include/realdds/topics/dds-topic-names.h +++ b/third-party/realdds/include/realdds/topics/dds-topic-names.h @@ -16,6 +16,11 @@ constexpr char SEPARATOR = '/'; constexpr char const * ROOT = "realsense/"; constexpr size_t ROOT_LEN = 10; // NOTE: actual streams will be ROS-compatible, meaning rt/ROOT +constexpr char const * ROS2_ROOT = "rt/"; +constexpr char const * ROS2_SERVICE_REQUEST_ROOT = "rq/"; +constexpr char const * ROS2_SERVICE_RESPONSE_ROOT = "rr/"; + +constexpr size_t ROS2_ROOT_LEN = 3; constexpr char const * DEVICE_INFO_TOPIC_NAME = "realsense/device-info"; @@ -25,6 +30,14 @@ constexpr char const * CONTROL_TOPIC_NAME = "/control"; constexpr char const * METADATA_TOPIC_NAME = "/metadata"; constexpr char const * DFU_TOPIC_NAME = "/dfu"; +constexpr char const * GET_PARAMETERS_NAME = "/get_parameters"; +constexpr char const * SET_PARAMETERS_NAME = "/set_parameters"; +constexpr char const * LIST_PARAMETERS_NAME = "/list_parameters"; +constexpr char const * DESCRIBE_PARAMETERS_NAME = "/describe_parameters"; + +constexpr char const * REQUEST_SUFFIX = "Request"; +constexpr char const * RESPONSE_SUFFIX = "Reply"; + namespace notification { namespace key { diff --git a/third-party/realdds/include/realdds/topics/readme.md b/third-party/realdds/include/realdds/topics/readme.md index aa1ca0dd10..51648fcd9f 100644 --- a/third-party/realdds/include/realdds/topics/readme.md +++ b/third-party/realdds/include/realdds/topics/readme.md @@ -16,7 +16,7 @@ The various topics are arranged hierarchically: The code for each message type in this directory is generated from IDL files if the message format is defined by RealDDS. -For [ROS](#ros2), the IDLs are not available. +For [ROS](#ros2), the IDLs are available in the `/opt/ros//share/` installation folder. # Generation diff --git a/third-party/realdds/include/realdds/topics/ros2/DescribeParameters.h b/third-party/realdds/include/realdds/topics/ros2/DescribeParameters.h new file mode 100644 index 0000000000..37634fc1e3 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/DescribeParameters.h @@ -0,0 +1,355 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file DescribeParameters.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_DESCRIBEPARAMETERS_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_DESCRIBEPARAMETERS_H_ + +#include "ParameterDescriptor.h" + +//#include + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(DescribeParameters_SOURCE) +#define DescribeParameters_DllAPI __declspec( dllexport ) +#else +#define DescribeParameters_DllAPI __declspec( dllimport ) +#endif // DescribeParameters_SOURCE +#else +#define DescribeParameters_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define DescribeParameters_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +namespace rcl_interfaces { + namespace srv { + /*! + * @brief This class represents the structure DescribeParameters_Request defined by the user in the IDL file. + * @ingroup DESCRIBEPARAMETERS + */ + class DescribeParameters_Request + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport DescribeParameters_Request(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~DescribeParameters_Request(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::srv::DescribeParameters_Request that will be copied. + */ + eProsima_user_DllExport DescribeParameters_Request( + const DescribeParameters_Request& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::srv::DescribeParameters_Request that will be copied. + */ + eProsima_user_DllExport DescribeParameters_Request( + DescribeParameters_Request&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::srv::DescribeParameters_Request that will be copied. + */ + eProsima_user_DllExport DescribeParameters_Request& operator =( + const DescribeParameters_Request& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::srv::DescribeParameters_Request that will be copied. + */ + eProsima_user_DllExport DescribeParameters_Request& operator =( + DescribeParameters_Request&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::DescribeParameters_Request object to compare. + */ + eProsima_user_DllExport bool operator ==( + const DescribeParameters_Request& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::DescribeParameters_Request object to compare. + */ + eProsima_user_DllExport bool operator !=( + const DescribeParameters_Request& x) const; + + /*! + * @brief This function copies the value in member names + * @param _names New value to be copied in member names + */ + eProsima_user_DllExport void names( + const std::vector& _names); + + /*! + * @brief This function moves the value in member names + * @param _names New value to be moved in member names + */ + eProsima_user_DllExport void names( + std::vector&& _names); + + /*! + * @brief This function returns a constant reference to member names + * @return Constant reference to member names + */ + eProsima_user_DllExport const std::vector& names() const; + + /*! + * @brief This function returns a reference to member names + * @return Reference to member names + */ + eProsima_user_DllExport std::vector& names(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::srv::DescribeParameters_Request& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + std::vector m_names; + }; + /*! + * @brief This class represents the structure DescribeParameters_Response defined by the user in the IDL file. + * @ingroup DESCRIBEPARAMETERS + */ + class DescribeParameters_Response + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport DescribeParameters_Response(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~DescribeParameters_Response(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::srv::DescribeParameters_Response that will be copied. + */ + eProsima_user_DllExport DescribeParameters_Response( + const DescribeParameters_Response& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::srv::DescribeParameters_Response that will be copied. + */ + eProsima_user_DllExport DescribeParameters_Response( + DescribeParameters_Response&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::srv::DescribeParameters_Response that will be copied. + */ + eProsima_user_DllExport DescribeParameters_Response& operator =( + const DescribeParameters_Response& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::srv::DescribeParameters_Response that will be copied. + */ + eProsima_user_DllExport DescribeParameters_Response& operator =( + DescribeParameters_Response&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::DescribeParameters_Response object to compare. + */ + eProsima_user_DllExport bool operator ==( + const DescribeParameters_Response& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::DescribeParameters_Response object to compare. + */ + eProsima_user_DllExport bool operator !=( + const DescribeParameters_Response& x) const; + + /*! + * @brief This function copies the value in member descriptors + * @param _descriptors New value to be copied in member descriptors + */ + eProsima_user_DllExport void descriptors( + const std::vector& _descriptors); + + /*! + * @brief This function moves the value in member descriptors + * @param _descriptors New value to be moved in member descriptors + */ + eProsima_user_DllExport void descriptors( + std::vector&& _descriptors); + + /*! + * @brief This function returns a constant reference to member descriptors + * @return Constant reference to member descriptors + */ + eProsima_user_DllExport const std::vector& descriptors() const; + + /*! + * @brief This function returns a reference to member descriptors + * @return Reference to member descriptors + */ + eProsima_user_DllExport std::vector& descriptors(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::srv::DescribeParameters_Response& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + std::vector m_descriptors; + }; + } // namespace srv +} // namespace rcl_interfaces + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_DESCRIBEPARAMETERS_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/DescribeParametersPubSubTypes.h b/third-party/realdds/include/realdds/topics/ros2/DescribeParametersPubSubTypes.h new file mode 100644 index 0000000000..931a328828 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/DescribeParametersPubSubTypes.h @@ -0,0 +1,160 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file DescribeParametersPubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_DESCRIBEPARAMETERS_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_DESCRIBEPARAMETERS_PUBSUBTYPES_H_ + +#include +#include + +#include "DescribeParameters.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated DescribeParameters is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + +namespace rcl_interfaces +{ + namespace srv + { + /*! + * @brief This class represents the TopicDataType of the type DescribeParameters_Request defined by the user in the IDL file. + * @ingroup DESCRIBEPARAMETERS + */ + class DescribeParameters_RequestPubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef DescribeParameters_Request type; + + eProsima_user_DllExport DescribeParameters_RequestPubSubType(); + + eProsima_user_DllExport virtual ~DescribeParameters_RequestPubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + /*! + * @brief This class represents the TopicDataType of the type DescribeParameters_Response defined by the user in the IDL file. + * @ingroup DESCRIBEPARAMETERS + */ + class DescribeParameters_ResponsePubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef DescribeParameters_Response type; + + eProsima_user_DllExport DescribeParameters_ResponsePubSubType(); + + eProsima_user_DllExport virtual ~DescribeParameters_ResponsePubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + } +} + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_DESCRIBEPARAMETERS_PUBSUBTYPES_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/FloatingPointRange.h b/third-party/realdds/include/realdds/topics/ros2/FloatingPointRange.h new file mode 100644 index 0000000000..bd8ab73832 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/FloatingPointRange.h @@ -0,0 +1,241 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file FloatingPointRange.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_FLOATINGPOINTRANGE_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_FLOATINGPOINTRANGE_H_ + + +//#include + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(FloatingPointRange_SOURCE) +#define FloatingPointRange_DllAPI __declspec( dllexport ) +#else +#define FloatingPointRange_DllAPI __declspec( dllimport ) +#endif // FloatingPointRange_SOURCE +#else +#define FloatingPointRange_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define FloatingPointRange_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +namespace rcl_interfaces { + namespace msg { + /*! + * @brief This class represents the structure FloatingPointRange defined by the user in the IDL file. + * @ingroup FLOATINGPOINTRANGE + */ + class FloatingPointRange + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport FloatingPointRange(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~FloatingPointRange(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::msg::FloatingPointRange that will be copied. + */ + eProsima_user_DllExport FloatingPointRange( + const FloatingPointRange& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::msg::FloatingPointRange that will be copied. + */ + eProsima_user_DllExport FloatingPointRange( + FloatingPointRange&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::msg::FloatingPointRange that will be copied. + */ + eProsima_user_DllExport FloatingPointRange& operator =( + const FloatingPointRange& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::msg::FloatingPointRange that will be copied. + */ + eProsima_user_DllExport FloatingPointRange& operator =( + FloatingPointRange&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::FloatingPointRange object to compare. + */ + eProsima_user_DllExport bool operator ==( + const FloatingPointRange& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::FloatingPointRange object to compare. + */ + eProsima_user_DllExport bool operator !=( + const FloatingPointRange& x) const; + + /*! + * @brief This function sets a value in member from_value + * @param _from_value New value for member from_value + */ + eProsima_user_DllExport void from_value( + double _from_value); + + /*! + * @brief This function returns the value of member from_value + * @return Value of member from_value + */ + eProsima_user_DllExport double from_value() const; + + /*! + * @brief This function returns a reference to member from_value + * @return Reference to member from_value + */ + eProsima_user_DllExport double& from_value(); + + /*! + * @brief This function sets a value in member to_value + * @param _to_value New value for member to_value + */ + eProsima_user_DllExport void to_value( + double _to_value); + + /*! + * @brief This function returns the value of member to_value + * @return Value of member to_value + */ + eProsima_user_DllExport double to_value() const; + + /*! + * @brief This function returns a reference to member to_value + * @return Reference to member to_value + */ + eProsima_user_DllExport double& to_value(); + + /*! + * @brief This function sets a value in member step + * @param _step New value for member step + */ + eProsima_user_DllExport void step( + double _step); + + /*! + * @brief This function returns the value of member step + * @return Value of member step + */ + eProsima_user_DllExport double step() const; + + /*! + * @brief This function returns a reference to member step + * @return Reference to member step + */ + eProsima_user_DllExport double& step(); + + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::msg::FloatingPointRange& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + double m_from_value; + double m_to_value; + double m_step; + }; + } // namespace msg +} // namespace rcl_interfaces + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_FLOATINGPOINTRANGE_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/FloatingPointRangePubSubTypes.h b/third-party/realdds/include/realdds/topics/ros2/FloatingPointRangePubSubTypes.h new file mode 100644 index 0000000000..ca2f2987e3 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/FloatingPointRangePubSubTypes.h @@ -0,0 +1,96 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file FloatingPointRangePubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_FLOATINGPOINTRANGE_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_FLOATINGPOINTRANGE_PUBSUBTYPES_H_ + +#include +#include + +#include "FloatingPointRange.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated FloatingPointRange is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + +namespace rcl_interfaces +{ + namespace msg + { + /*! + * @brief This class represents the TopicDataType of the type FloatingPointRange defined by the user in the IDL file. + * @ingroup FLOATINGPOINTRANGE + */ + class FloatingPointRangePubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef FloatingPointRange type; + + eProsima_user_DllExport FloatingPointRangePubSubType(); + + eProsima_user_DllExport virtual ~FloatingPointRangePubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + new (memory) FloatingPointRange(); + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + } +} + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_FLOATINGPOINTRANGE_PUBSUBTYPES_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/GetParameters.h b/third-party/realdds/include/realdds/topics/ros2/GetParameters.h new file mode 100644 index 0000000000..3af97db457 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/GetParameters.h @@ -0,0 +1,355 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file GetParameters.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_GETPARAMETERS_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_GETPARAMETERS_H_ + +#include "ParameterValue.h" + +//#include + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(GetParameters_SOURCE) +#define GetParameters_DllAPI __declspec( dllexport ) +#else +#define GetParameters_DllAPI __declspec( dllimport ) +#endif // GetParameters_SOURCE +#else +#define GetParameters_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define GetParameters_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +namespace rcl_interfaces { + namespace srv { + /*! + * @brief This class represents the structure GetParameters_Request defined by the user in the IDL file. + * @ingroup GETPARAMETERS + */ + class GetParameters_Request + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport GetParameters_Request(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~GetParameters_Request(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::srv::GetParameters_Request that will be copied. + */ + eProsima_user_DllExport GetParameters_Request( + const GetParameters_Request& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::srv::GetParameters_Request that will be copied. + */ + eProsima_user_DllExport GetParameters_Request( + GetParameters_Request&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::srv::GetParameters_Request that will be copied. + */ + eProsima_user_DllExport GetParameters_Request& operator =( + const GetParameters_Request& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::srv::GetParameters_Request that will be copied. + */ + eProsima_user_DllExport GetParameters_Request& operator =( + GetParameters_Request&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::GetParameters_Request object to compare. + */ + eProsima_user_DllExport bool operator ==( + const GetParameters_Request& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::GetParameters_Request object to compare. + */ + eProsima_user_DllExport bool operator !=( + const GetParameters_Request& x) const; + + /*! + * @brief This function copies the value in member names + * @param _names New value to be copied in member names + */ + eProsima_user_DllExport void names( + const std::vector& _names); + + /*! + * @brief This function moves the value in member names + * @param _names New value to be moved in member names + */ + eProsima_user_DllExport void names( + std::vector&& _names); + + /*! + * @brief This function returns a constant reference to member names + * @return Constant reference to member names + */ + eProsima_user_DllExport const std::vector& names() const; + + /*! + * @brief This function returns a reference to member names + * @return Reference to member names + */ + eProsima_user_DllExport std::vector& names(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::srv::GetParameters_Request& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + std::vector m_names; + }; + /*! + * @brief This class represents the structure GetParameters_Response defined by the user in the IDL file. + * @ingroup GETPARAMETERS + */ + class GetParameters_Response + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport GetParameters_Response(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~GetParameters_Response(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::srv::GetParameters_Response that will be copied. + */ + eProsima_user_DllExport GetParameters_Response( + const GetParameters_Response& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::srv::GetParameters_Response that will be copied. + */ + eProsima_user_DllExport GetParameters_Response( + GetParameters_Response&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::srv::GetParameters_Response that will be copied. + */ + eProsima_user_DllExport GetParameters_Response& operator =( + const GetParameters_Response& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::srv::GetParameters_Response that will be copied. + */ + eProsima_user_DllExport GetParameters_Response& operator =( + GetParameters_Response&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::GetParameters_Response object to compare. + */ + eProsima_user_DllExport bool operator ==( + const GetParameters_Response& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::GetParameters_Response object to compare. + */ + eProsima_user_DllExport bool operator !=( + const GetParameters_Response& x) const; + + /*! + * @brief This function copies the value in member values + * @param _values New value to be copied in member values + */ + eProsima_user_DllExport void values( + const std::vector& _values); + + /*! + * @brief This function moves the value in member values + * @param _values New value to be moved in member values + */ + eProsima_user_DllExport void values( + std::vector&& _values); + + /*! + * @brief This function returns a constant reference to member values + * @return Constant reference to member values + */ + eProsima_user_DllExport const std::vector& values() const; + + /*! + * @brief This function returns a reference to member values + * @return Reference to member values + */ + eProsima_user_DllExport std::vector& values(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::srv::GetParameters_Response& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + std::vector m_values; + }; + } // namespace srv +} // namespace rcl_interfaces + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_GETPARAMETERS_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/GetParametersPubSubTypes.h b/third-party/realdds/include/realdds/topics/ros2/GetParametersPubSubTypes.h new file mode 100644 index 0000000000..20ac8b6500 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/GetParametersPubSubTypes.h @@ -0,0 +1,160 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file GetParametersPubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_GETPARAMETERS_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_GETPARAMETERS_PUBSUBTYPES_H_ + +#include +#include + +#include "GetParameters.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated GetParameters is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + +namespace rcl_interfaces +{ + namespace srv + { + /*! + * @brief This class represents the TopicDataType of the type GetParameters_Request defined by the user in the IDL file. + * @ingroup GETPARAMETERS + */ + class GetParameters_RequestPubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef GetParameters_Request type; + + eProsima_user_DllExport GetParameters_RequestPubSubType(); + + eProsima_user_DllExport virtual ~GetParameters_RequestPubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + /*! + * @brief This class represents the TopicDataType of the type GetParameters_Response defined by the user in the IDL file. + * @ingroup GETPARAMETERS + */ + class GetParameters_ResponsePubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef GetParameters_Response type; + + eProsima_user_DllExport GetParameters_ResponsePubSubType(); + + eProsima_user_DllExport virtual ~GetParameters_ResponsePubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + } +} + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_GETPARAMETERS_PUBSUBTYPES_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/IntegerRange.h b/third-party/realdds/include/realdds/topics/ros2/IntegerRange.h new file mode 100644 index 0000000000..78d7a05314 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/IntegerRange.h @@ -0,0 +1,241 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file IntegerRange.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_INTEGERRANGE_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_INTEGERRANGE_H_ + + +//#include + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(IntegerRange_SOURCE) +#define IntegerRange_DllAPI __declspec( dllexport ) +#else +#define IntegerRange_DllAPI __declspec( dllimport ) +#endif // IntegerRange_SOURCE +#else +#define IntegerRange_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define IntegerRange_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +namespace rcl_interfaces { + namespace msg { + /*! + * @brief This class represents the structure IntegerRange defined by the user in the IDL file. + * @ingroup INTEGERRANGE + */ + class IntegerRange + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport IntegerRange(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~IntegerRange(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::msg::IntegerRange that will be copied. + */ + eProsima_user_DllExport IntegerRange( + const IntegerRange& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::msg::IntegerRange that will be copied. + */ + eProsima_user_DllExport IntegerRange( + IntegerRange&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::msg::IntegerRange that will be copied. + */ + eProsima_user_DllExport IntegerRange& operator =( + const IntegerRange& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::msg::IntegerRange that will be copied. + */ + eProsima_user_DllExport IntegerRange& operator =( + IntegerRange&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::IntegerRange object to compare. + */ + eProsima_user_DllExport bool operator ==( + const IntegerRange& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::IntegerRange object to compare. + */ + eProsima_user_DllExport bool operator !=( + const IntegerRange& x) const; + + /*! + * @brief This function sets a value in member from_value + * @param _from_value New value for member from_value + */ + eProsima_user_DllExport void from_value( + int64_t _from_value); + + /*! + * @brief This function returns the value of member from_value + * @return Value of member from_value + */ + eProsima_user_DllExport int64_t from_value() const; + + /*! + * @brief This function returns a reference to member from_value + * @return Reference to member from_value + */ + eProsima_user_DllExport int64_t& from_value(); + + /*! + * @brief This function sets a value in member to_value + * @param _to_value New value for member to_value + */ + eProsima_user_DllExport void to_value( + int64_t _to_value); + + /*! + * @brief This function returns the value of member to_value + * @return Value of member to_value + */ + eProsima_user_DllExport int64_t to_value() const; + + /*! + * @brief This function returns a reference to member to_value + * @return Reference to member to_value + */ + eProsima_user_DllExport int64_t& to_value(); + + /*! + * @brief This function sets a value in member step + * @param _step New value for member step + */ + eProsima_user_DllExport void step( + uint64_t _step); + + /*! + * @brief This function returns the value of member step + * @return Value of member step + */ + eProsima_user_DllExport uint64_t step() const; + + /*! + * @brief This function returns a reference to member step + * @return Reference to member step + */ + eProsima_user_DllExport uint64_t& step(); + + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::msg::IntegerRange& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + int64_t m_from_value; + int64_t m_to_value; + uint64_t m_step; + }; + } // namespace msg +} // namespace rcl_interfaces + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_INTEGERRANGE_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/IntegerRangePubSubTypes.h b/third-party/realdds/include/realdds/topics/ros2/IntegerRangePubSubTypes.h new file mode 100644 index 0000000000..98449d1b8b --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/IntegerRangePubSubTypes.h @@ -0,0 +1,96 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file IntegerRangePubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_INTEGERRANGE_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_INTEGERRANGE_PUBSUBTYPES_H_ + +#include +#include + +#include "IntegerRange.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated IntegerRange is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + +namespace rcl_interfaces +{ + namespace msg + { + /*! + * @brief This class represents the TopicDataType of the type IntegerRange defined by the user in the IDL file. + * @ingroup INTEGERRANGE + */ + class IntegerRangePubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef IntegerRange type; + + eProsima_user_DllExport IntegerRangePubSubType(); + + eProsima_user_DllExport virtual ~IntegerRangePubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + new (memory) IntegerRange(); + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + } +} + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_INTEGERRANGE_PUBSUBTYPES_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/ListParameters.h b/third-party/realdds/include/realdds/topics/ros2/ListParameters.h new file mode 100644 index 0000000000..c6cc3fdf7d --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/ListParameters.h @@ -0,0 +1,378 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ListParameters.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_LISTPARAMETERS_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_LISTPARAMETERS_H_ + +#include "ListParametersResult.h" + +//#include + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(ListParameters_SOURCE) +#define ListParameters_DllAPI __declspec( dllexport ) +#else +#define ListParameters_DllAPI __declspec( dllimport ) +#endif // ListParameters_SOURCE +#else +#define ListParameters_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define ListParameters_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +namespace rcl_interfaces { + namespace srv { + namespace ListParameters_Request_Constants { + const uint64_t DEPTH_RECURSIVE = 0; + } // namespace ListParameters_Request_Constants + /*! + * @brief This class represents the structure ListParameters_Request defined by the user in the IDL file. + * @ingroup LISTPARAMETERS + */ + class ListParameters_Request + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport ListParameters_Request(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~ListParameters_Request(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::srv::ListParameters_Request that will be copied. + */ + eProsima_user_DllExport ListParameters_Request( + const ListParameters_Request& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::srv::ListParameters_Request that will be copied. + */ + eProsima_user_DllExport ListParameters_Request( + ListParameters_Request&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::srv::ListParameters_Request that will be copied. + */ + eProsima_user_DllExport ListParameters_Request& operator =( + const ListParameters_Request& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::srv::ListParameters_Request that will be copied. + */ + eProsima_user_DllExport ListParameters_Request& operator =( + ListParameters_Request&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::ListParameters_Request object to compare. + */ + eProsima_user_DllExport bool operator ==( + const ListParameters_Request& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::ListParameters_Request object to compare. + */ + eProsima_user_DllExport bool operator !=( + const ListParameters_Request& x) const; + + /*! + * @brief This function copies the value in member prefixes + * @param _prefixes New value to be copied in member prefixes + */ + eProsima_user_DllExport void prefixes( + const std::vector& _prefixes); + + /*! + * @brief This function moves the value in member prefixes + * @param _prefixes New value to be moved in member prefixes + */ + eProsima_user_DllExport void prefixes( + std::vector&& _prefixes); + + /*! + * @brief This function returns a constant reference to member prefixes + * @return Constant reference to member prefixes + */ + eProsima_user_DllExport const std::vector& prefixes() const; + + /*! + * @brief This function returns a reference to member prefixes + * @return Reference to member prefixes + */ + eProsima_user_DllExport std::vector& prefixes(); + /*! + * @brief This function sets a value in member depth + * @param _depth New value for member depth + */ + eProsima_user_DllExport void depth( + uint64_t _depth); + + /*! + * @brief This function returns the value of member depth + * @return Value of member depth + */ + eProsima_user_DllExport uint64_t depth() const; + + /*! + * @brief This function returns a reference to member depth + * @return Reference to member depth + */ + eProsima_user_DllExport uint64_t& depth(); + + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::srv::ListParameters_Request& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + std::vector m_prefixes; + uint64_t m_depth; + }; + /*! + * @brief This class represents the structure ListParameters_Response defined by the user in the IDL file. + * @ingroup LISTPARAMETERS + */ + class ListParameters_Response + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport ListParameters_Response(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~ListParameters_Response(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::srv::ListParameters_Response that will be copied. + */ + eProsima_user_DllExport ListParameters_Response( + const ListParameters_Response& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::srv::ListParameters_Response that will be copied. + */ + eProsima_user_DllExport ListParameters_Response( + ListParameters_Response&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::srv::ListParameters_Response that will be copied. + */ + eProsima_user_DllExport ListParameters_Response& operator =( + const ListParameters_Response& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::srv::ListParameters_Response that will be copied. + */ + eProsima_user_DllExport ListParameters_Response& operator =( + ListParameters_Response&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::ListParameters_Response object to compare. + */ + eProsima_user_DllExport bool operator ==( + const ListParameters_Response& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::ListParameters_Response object to compare. + */ + eProsima_user_DllExport bool operator !=( + const ListParameters_Response& x) const; + + /*! + * @brief This function copies the value in member result + * @param _result New value to be copied in member result + */ + eProsima_user_DllExport void result( + const rcl_interfaces::msg::ListParametersResult& _result); + + /*! + * @brief This function moves the value in member result + * @param _result New value to be moved in member result + */ + eProsima_user_DllExport void result( + rcl_interfaces::msg::ListParametersResult&& _result); + + /*! + * @brief This function returns a constant reference to member result + * @return Constant reference to member result + */ + eProsima_user_DllExport const rcl_interfaces::msg::ListParametersResult& result() const; + + /*! + * @brief This function returns a reference to member result + * @return Reference to member result + */ + eProsima_user_DllExport rcl_interfaces::msg::ListParametersResult& result(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::srv::ListParameters_Response& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + rcl_interfaces::msg::ListParametersResult m_result; + }; + } // namespace srv +} // namespace rcl_interfaces + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_LISTPARAMETERS_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/ListParametersPubSubTypes.h b/third-party/realdds/include/realdds/topics/ros2/ListParametersPubSubTypes.h new file mode 100644 index 0000000000..eb7e23ab9e --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/ListParametersPubSubTypes.h @@ -0,0 +1,163 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ListParametersPubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_LISTPARAMETERS_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_LISTPARAMETERS_PUBSUBTYPES_H_ + +#include +#include + +#include "ListParameters.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated ListParameters is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + +namespace rcl_interfaces +{ + namespace srv + { + namespace ListParameters_Request_Constants + { + } + /*! + * @brief This class represents the TopicDataType of the type ListParameters_Request defined by the user in the IDL file. + * @ingroup LISTPARAMETERS + */ + class ListParameters_RequestPubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef ListParameters_Request type; + + eProsima_user_DllExport ListParameters_RequestPubSubType(); + + eProsima_user_DllExport virtual ~ListParameters_RequestPubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + /*! + * @brief This class represents the TopicDataType of the type ListParameters_Response defined by the user in the IDL file. + * @ingroup LISTPARAMETERS + */ + class ListParameters_ResponsePubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef ListParameters_Response type; + + eProsima_user_DllExport ListParameters_ResponsePubSubType(); + + eProsima_user_DllExport virtual ~ListParameters_ResponsePubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + } +} + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_LISTPARAMETERS_PUBSUBTYPES_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/ListParametersResult.h b/third-party/realdds/include/realdds/topics/ros2/ListParametersResult.h new file mode 100644 index 0000000000..65c3cf61ab --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/ListParametersResult.h @@ -0,0 +1,233 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ListParametersResult.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_LISTPARAMETERSRESULT_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_LISTPARAMETERSRESULT_H_ + + +//#include + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(ListParametersResult_SOURCE) +#define ListParametersResult_DllAPI __declspec( dllexport ) +#else +#define ListParametersResult_DllAPI __declspec( dllimport ) +#endif // ListParametersResult_SOURCE +#else +#define ListParametersResult_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define ListParametersResult_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +namespace rcl_interfaces { + namespace msg { + /*! + * @brief This class represents the structure ListParametersResult defined by the user in the IDL file. + * @ingroup LISTPARAMETERSRESULT + */ + class ListParametersResult + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport ListParametersResult(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~ListParametersResult(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::msg::ListParametersResult that will be copied. + */ + eProsima_user_DllExport ListParametersResult( + const ListParametersResult& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::msg::ListParametersResult that will be copied. + */ + eProsima_user_DllExport ListParametersResult( + ListParametersResult&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::msg::ListParametersResult that will be copied. + */ + eProsima_user_DllExport ListParametersResult& operator =( + const ListParametersResult& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::msg::ListParametersResult that will be copied. + */ + eProsima_user_DllExport ListParametersResult& operator =( + ListParametersResult&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::ListParametersResult object to compare. + */ + eProsima_user_DllExport bool operator ==( + const ListParametersResult& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::ListParametersResult object to compare. + */ + eProsima_user_DllExport bool operator !=( + const ListParametersResult& x) const; + + /*! + * @brief This function copies the value in member names + * @param _names New value to be copied in member names + */ + eProsima_user_DllExport void names( + const std::vector& _names); + + /*! + * @brief This function moves the value in member names + * @param _names New value to be moved in member names + */ + eProsima_user_DllExport void names( + std::vector&& _names); + + /*! + * @brief This function returns a constant reference to member names + * @return Constant reference to member names + */ + eProsima_user_DllExport const std::vector& names() const; + + /*! + * @brief This function returns a reference to member names + * @return Reference to member names + */ + eProsima_user_DllExport std::vector& names(); + /*! + * @brief This function copies the value in member prefixes + * @param _prefixes New value to be copied in member prefixes + */ + eProsima_user_DllExport void prefixes( + const std::vector& _prefixes); + + /*! + * @brief This function moves the value in member prefixes + * @param _prefixes New value to be moved in member prefixes + */ + eProsima_user_DllExport void prefixes( + std::vector&& _prefixes); + + /*! + * @brief This function returns a constant reference to member prefixes + * @return Constant reference to member prefixes + */ + eProsima_user_DllExport const std::vector& prefixes() const; + + /*! + * @brief This function returns a reference to member prefixes + * @return Reference to member prefixes + */ + eProsima_user_DllExport std::vector& prefixes(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::msg::ListParametersResult& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + std::vector m_names; + std::vector m_prefixes; + }; + } // namespace msg +} // namespace rcl_interfaces + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_LISTPARAMETERSRESULT_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/ListParametersResultPubSubTypes.h b/third-party/realdds/include/realdds/topics/ros2/ListParametersResultPubSubTypes.h new file mode 100644 index 0000000000..ab0c944ad4 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/ListParametersResultPubSubTypes.h @@ -0,0 +1,96 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ListParametersResultPubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_LISTPARAMETERSRESULT_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_LISTPARAMETERSRESULT_PUBSUBTYPES_H_ + +#include +#include + +#include "ListParametersResult.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated ListParametersResult is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + +namespace rcl_interfaces +{ + namespace msg + { + /*! + * @brief This class represents the TopicDataType of the type ListParametersResult defined by the user in the IDL file. + * @ingroup LISTPARAMETERSRESULT + */ + class ListParametersResultPubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef ListParametersResult type; + + eProsima_user_DllExport ListParametersResultPubSubType(); + + eProsima_user_DllExport virtual ~ListParametersResultPubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + } +} + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_LISTPARAMETERSRESULT_PUBSUBTYPES_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/Parameter.h b/third-party/realdds/include/realdds/topics/ros2/Parameter.h new file mode 100644 index 0000000000..cf2693d426 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/Parameter.h @@ -0,0 +1,234 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file Parameter.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETER_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETER_H_ + +#include "ParameterValue.h" + +//#include + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(Parameter_SOURCE) +#define Parameter_DllAPI __declspec( dllexport ) +#else +#define Parameter_DllAPI __declspec( dllimport ) +#endif // Parameter_SOURCE +#else +#define Parameter_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define Parameter_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +namespace rcl_interfaces { + namespace msg { + /*! + * @brief This class represents the structure Parameter defined by the user in the IDL file. + * @ingroup PARAMETER + */ + class Parameter + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport Parameter(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~Parameter(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::msg::Parameter that will be copied. + */ + eProsima_user_DllExport Parameter( + const Parameter& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::msg::Parameter that will be copied. + */ + eProsima_user_DllExport Parameter( + Parameter&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::msg::Parameter that will be copied. + */ + eProsima_user_DllExport Parameter& operator =( + const Parameter& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::msg::Parameter that will be copied. + */ + eProsima_user_DllExport Parameter& operator =( + Parameter&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::Parameter object to compare. + */ + eProsima_user_DllExport bool operator ==( + const Parameter& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::Parameter object to compare. + */ + eProsima_user_DllExport bool operator !=( + const Parameter& x) const; + + /*! + * @brief This function copies the value in member name + * @param _name New value to be copied in member name + */ + eProsima_user_DllExport void name( + const std::string& _name); + + /*! + * @brief This function moves the value in member name + * @param _name New value to be moved in member name + */ + eProsima_user_DllExport void name( + std::string&& _name); + + /*! + * @brief This function returns a constant reference to member name + * @return Constant reference to member name + */ + eProsima_user_DllExport const std::string& name() const; + + /*! + * @brief This function returns a reference to member name + * @return Reference to member name + */ + eProsima_user_DllExport std::string& name(); + /*! + * @brief This function copies the value in member value + * @param _value New value to be copied in member value + */ + eProsima_user_DllExport void value( + const rcl_interfaces::msg::ParameterValue& _value); + + /*! + * @brief This function moves the value in member value + * @param _value New value to be moved in member value + */ + eProsima_user_DllExport void value( + rcl_interfaces::msg::ParameterValue&& _value); + + /*! + * @brief This function returns a constant reference to member value + * @return Constant reference to member value + */ + eProsima_user_DllExport const rcl_interfaces::msg::ParameterValue& value() const; + + /*! + * @brief This function returns a reference to member value + * @return Reference to member value + */ + eProsima_user_DllExport rcl_interfaces::msg::ParameterValue& value(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::msg::Parameter& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + std::string m_name; + rcl_interfaces::msg::ParameterValue m_value; + }; + } // namespace msg +} // namespace rcl_interfaces + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETER_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/ParameterDescriptor.h b/third-party/realdds/include/realdds/topics/ros2/ParameterDescriptor.h new file mode 100644 index 0000000000..00a4647a08 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/ParameterDescriptor.h @@ -0,0 +1,373 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterDescriptor.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERDESCRIPTOR_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERDESCRIPTOR_H_ + +#include "FloatingPointRange.h" +#include "IntegerRange.h" + +//#include + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(ParameterDescriptor_SOURCE) +#define ParameterDescriptor_DllAPI __declspec( dllexport ) +#else +#define ParameterDescriptor_DllAPI __declspec( dllimport ) +#endif // ParameterDescriptor_SOURCE +#else +#define ParameterDescriptor_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define ParameterDescriptor_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +namespace rcl_interfaces { + namespace msg { + /*! + * @brief This class represents the structure ParameterDescriptor defined by the user in the IDL file. + * @ingroup PARAMETERDESCRIPTOR + */ + class ParameterDescriptor + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport ParameterDescriptor(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~ParameterDescriptor(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::msg::ParameterDescriptor that will be copied. + */ + eProsima_user_DllExport ParameterDescriptor( + const ParameterDescriptor& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::msg::ParameterDescriptor that will be copied. + */ + eProsima_user_DllExport ParameterDescriptor( + ParameterDescriptor&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::msg::ParameterDescriptor that will be copied. + */ + eProsima_user_DllExport ParameterDescriptor& operator =( + const ParameterDescriptor& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::msg::ParameterDescriptor that will be copied. + */ + eProsima_user_DllExport ParameterDescriptor& operator =( + ParameterDescriptor&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::ParameterDescriptor object to compare. + */ + eProsima_user_DllExport bool operator ==( + const ParameterDescriptor& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::ParameterDescriptor object to compare. + */ + eProsima_user_DllExport bool operator !=( + const ParameterDescriptor& x) const; + + /*! + * @brief This function copies the value in member name + * @param _name New value to be copied in member name + */ + eProsima_user_DllExport void name( + const std::string& _name); + + /*! + * @brief This function moves the value in member name + * @param _name New value to be moved in member name + */ + eProsima_user_DllExport void name( + std::string&& _name); + + /*! + * @brief This function returns a constant reference to member name + * @return Constant reference to member name + */ + eProsima_user_DllExport const std::string& name() const; + + /*! + * @brief This function returns a reference to member name + * @return Reference to member name + */ + eProsima_user_DllExport std::string& name(); + /*! + * @brief This function sets a value in member type + * @param _type New value for member type + */ + eProsima_user_DllExport void type( + uint8_t _type); + + /*! + * @brief This function returns the value of member type + * @return Value of member type + */ + eProsima_user_DllExport uint8_t type() const; + + /*! + * @brief This function returns a reference to member type + * @return Reference to member type + */ + eProsima_user_DllExport uint8_t& type(); + + /*! + * @brief This function copies the value in member description + * @param _description New value to be copied in member description + */ + eProsima_user_DllExport void description( + const std::string& _description); + + /*! + * @brief This function moves the value in member description + * @param _description New value to be moved in member description + */ + eProsima_user_DllExport void description( + std::string&& _description); + + /*! + * @brief This function returns a constant reference to member description + * @return Constant reference to member description + */ + eProsima_user_DllExport const std::string& description() const; + + /*! + * @brief This function returns a reference to member description + * @return Reference to member description + */ + eProsima_user_DllExport std::string& description(); + /*! + * @brief This function copies the value in member additional_constraints + * @param _additional_constraints New value to be copied in member additional_constraints + */ + eProsima_user_DllExport void additional_constraints( + const std::string& _additional_constraints); + + /*! + * @brief This function moves the value in member additional_constraints + * @param _additional_constraints New value to be moved in member additional_constraints + */ + eProsima_user_DllExport void additional_constraints( + std::string&& _additional_constraints); + + /*! + * @brief This function returns a constant reference to member additional_constraints + * @return Constant reference to member additional_constraints + */ + eProsima_user_DllExport const std::string& additional_constraints() const; + + /*! + * @brief This function returns a reference to member additional_constraints + * @return Reference to member additional_constraints + */ + eProsima_user_DllExport std::string& additional_constraints(); + /*! + * @brief This function sets a value in member read_only + * @param _read_only New value for member read_only + */ + eProsima_user_DllExport void read_only( + bool _read_only); + + /*! + * @brief This function returns the value of member read_only + * @return Value of member read_only + */ + eProsima_user_DllExport bool read_only() const; + + /*! + * @brief This function returns a reference to member read_only + * @return Reference to member read_only + */ + eProsima_user_DllExport bool& read_only(); + + /*! + * @brief This function sets a value in member dynamic_typing + * @param _dynamic_typing New value for member dynamic_typing + */ + eProsima_user_DllExport void dynamic_typing( + bool _dynamic_typing); + + /*! + * @brief This function returns the value of member dynamic_typing + * @return Value of member dynamic_typing + */ + eProsima_user_DllExport bool dynamic_typing() const; + + /*! + * @brief This function returns a reference to member dynamic_typing + * @return Reference to member dynamic_typing + */ + eProsima_user_DllExport bool& dynamic_typing(); + + /*! + * @brief This function copies the value in member floating_point_range + * @param _floating_point_range New value to be copied in member floating_point_range + */ + eProsima_user_DllExport void floating_point_range( + const std::vector& _floating_point_range); + + /*! + * @brief This function moves the value in member floating_point_range + * @param _floating_point_range New value to be moved in member floating_point_range + */ + eProsima_user_DllExport void floating_point_range( + std::vector&& _floating_point_range); + + /*! + * @brief This function returns a constant reference to member floating_point_range + * @return Constant reference to member floating_point_range + */ + eProsima_user_DllExport const std::vector& floating_point_range() const; + + /*! + * @brief This function returns a reference to member floating_point_range + * @return Reference to member floating_point_range + */ + eProsima_user_DllExport std::vector& floating_point_range(); + /*! + * @brief This function copies the value in member integer_range + * @param _integer_range New value to be copied in member integer_range + */ + eProsima_user_DllExport void integer_range( + const std::vector& _integer_range); + + /*! + * @brief This function moves the value in member integer_range + * @param _integer_range New value to be moved in member integer_range + */ + eProsima_user_DllExport void integer_range( + std::vector&& _integer_range); + + /*! + * @brief This function returns a constant reference to member integer_range + * @return Constant reference to member integer_range + */ + eProsima_user_DllExport const std::vector& integer_range() const; + + /*! + * @brief This function returns a reference to member integer_range + * @return Reference to member integer_range + */ + eProsima_user_DllExport std::vector& integer_range(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::msg::ParameterDescriptor& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + std::string m_name; + uint8_t m_type; + std::string m_description; + std::string m_additional_constraints; + bool m_read_only; + bool m_dynamic_typing; + std::vector m_floating_point_range; + std::vector m_integer_range; + }; + } // namespace msg +} // namespace rcl_interfaces + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERDESCRIPTOR_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/ParameterDescriptorPubSubTypes.h b/third-party/realdds/include/realdds/topics/ros2/ParameterDescriptorPubSubTypes.h new file mode 100644 index 0000000000..a30357916b --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/ParameterDescriptorPubSubTypes.h @@ -0,0 +1,96 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterDescriptorPubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERDESCRIPTOR_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERDESCRIPTOR_PUBSUBTYPES_H_ + +#include +#include + +#include "ParameterDescriptor.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated ParameterDescriptor is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + +namespace rcl_interfaces +{ + namespace msg + { + /*! + * @brief This class represents the TopicDataType of the type ParameterDescriptor defined by the user in the IDL file. + * @ingroup PARAMETERDESCRIPTOR + */ + class ParameterDescriptorPubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef ParameterDescriptor type; + + eProsima_user_DllExport ParameterDescriptorPubSubType(); + + eProsima_user_DllExport virtual ~ParameterDescriptorPubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + } +} + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERDESCRIPTOR_PUBSUBTYPES_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/ParameterPubSubTypes.h b/third-party/realdds/include/realdds/topics/ros2/ParameterPubSubTypes.h new file mode 100644 index 0000000000..c3c7a1974b --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/ParameterPubSubTypes.h @@ -0,0 +1,96 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterPubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETER_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETER_PUBSUBTYPES_H_ + +#include +#include + +#include "Parameter.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated Parameter is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + +namespace rcl_interfaces +{ + namespace msg + { + /*! + * @brief This class represents the TopicDataType of the type Parameter defined by the user in the IDL file. + * @ingroup PARAMETER + */ + class ParameterPubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef Parameter type; + + eProsima_user_DllExport ParameterPubSubType(); + + eProsima_user_DllExport virtual ~ParameterPubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + } +} + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETER_PUBSUBTYPES_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/ParameterType.h b/third-party/realdds/include/realdds/topics/ros2/ParameterType.h new file mode 100644 index 0000000000..58f20355ab --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/ParameterType.h @@ -0,0 +1,213 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterType.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERTYPE_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERTYPE_H_ + + +//#include + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(ParameterType_SOURCE) +#define ParameterType_DllAPI __declspec( dllexport ) +#else +#define ParameterType_DllAPI __declspec( dllimport ) +#endif // ParameterType_SOURCE +#else +#define ParameterType_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define ParameterType_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +namespace rcl_interfaces { + namespace msg { + namespace ParameterType_Constants { + const uint8_t PARAMETER_NOT_SET = 0; + const uint8_t PARAMETER_BOOL = 1; + const uint8_t PARAMETER_INTEGER = 2; + const uint8_t PARAMETER_DOUBLE = 3; + const uint8_t PARAMETER_STRING = 4; + const uint8_t PARAMETER_BYTE_ARRAY = 5; + const uint8_t PARAMETER_BOOL_ARRAY = 6; + const uint8_t PARAMETER_INTEGER_ARRAY = 7; + const uint8_t PARAMETER_DOUBLE_ARRAY = 8; + const uint8_t PARAMETER_STRING_ARRAY = 9; + } // namespace ParameterType_Constants + /*! + * @brief This class represents the structure ParameterType defined by the user in the IDL file. + * @ingroup PARAMETERTYPE + */ + class ParameterType + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport ParameterType(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~ParameterType(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::msg::ParameterType that will be copied. + */ + eProsima_user_DllExport ParameterType( + const ParameterType& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::msg::ParameterType that will be copied. + */ + eProsima_user_DllExport ParameterType( + ParameterType&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::msg::ParameterType that will be copied. + */ + eProsima_user_DllExport ParameterType& operator =( + const ParameterType& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::msg::ParameterType that will be copied. + */ + eProsima_user_DllExport ParameterType& operator =( + ParameterType&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::ParameterType object to compare. + */ + eProsima_user_DllExport bool operator ==( + const ParameterType& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::ParameterType object to compare. + */ + eProsima_user_DllExport bool operator !=( + const ParameterType& x) const; + + /*! + * @brief This function sets a value in member structure_needs_at_least_one_member + * @param _structure_needs_at_least_one_member New value for member structure_needs_at_least_one_member + */ + eProsima_user_DllExport void structure_needs_at_least_one_member( + uint8_t _structure_needs_at_least_one_member); + + /*! + * @brief This function returns the value of member structure_needs_at_least_one_member + * @return Value of member structure_needs_at_least_one_member + */ + eProsima_user_DllExport uint8_t structure_needs_at_least_one_member() const; + + /*! + * @brief This function returns a reference to member structure_needs_at_least_one_member + * @return Reference to member structure_needs_at_least_one_member + */ + eProsima_user_DllExport uint8_t& structure_needs_at_least_one_member(); + + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::msg::ParameterType& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + uint8_t m_structure_needs_at_least_one_member; + }; + } // namespace msg +} // namespace rcl_interfaces + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERTYPE_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/ParameterTypePubSubTypes.h b/third-party/realdds/include/realdds/topics/ros2/ParameterTypePubSubTypes.h new file mode 100644 index 0000000000..0fc52c4518 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/ParameterTypePubSubTypes.h @@ -0,0 +1,109 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterTypePubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERTYPE_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERTYPE_PUBSUBTYPES_H_ + +#include +#include + +#include "ParameterType.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated ParameterType is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + +namespace rcl_interfaces +{ + namespace msg + { + namespace ParameterType_Constants + { + + + + + + + + + + + } + /*! + * @brief This class represents the TopicDataType of the type ParameterType defined by the user in the IDL file. + * @ingroup PARAMETERTYPE + */ + class ParameterTypePubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef ParameterType type; + + eProsima_user_DllExport ParameterTypePubSubType(); + + eProsima_user_DllExport virtual ~ParameterTypePubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + new (memory) ParameterType(); + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + } +} + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERTYPE_PUBSUBTYPES_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/ParameterValue.h b/third-party/realdds/include/realdds/topics/ros2/ParameterValue.h new file mode 100644 index 0000000000..8cc965d84b --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/ParameterValue.h @@ -0,0 +1,417 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterValue.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERVALUE_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERVALUE_H_ + + +//#include + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(ParameterValue_SOURCE) +#define ParameterValue_DllAPI __declspec( dllexport ) +#else +#define ParameterValue_DllAPI __declspec( dllimport ) +#endif // ParameterValue_SOURCE +#else +#define ParameterValue_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define ParameterValue_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +namespace rcl_interfaces { + namespace msg { + /*! + * @brief This class represents the structure ParameterValue defined by the user in the IDL file. + * @ingroup PARAMETERVALUE + */ + class ParameterValue + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport ParameterValue(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~ParameterValue(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::msg::ParameterValue that will be copied. + */ + eProsima_user_DllExport ParameterValue( + const ParameterValue& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::msg::ParameterValue that will be copied. + */ + eProsima_user_DllExport ParameterValue( + ParameterValue&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::msg::ParameterValue that will be copied. + */ + eProsima_user_DllExport ParameterValue& operator =( + const ParameterValue& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::msg::ParameterValue that will be copied. + */ + eProsima_user_DllExport ParameterValue& operator =( + ParameterValue&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::ParameterValue object to compare. + */ + eProsima_user_DllExport bool operator ==( + const ParameterValue& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::ParameterValue object to compare. + */ + eProsima_user_DllExport bool operator !=( + const ParameterValue& x) const; + + /*! + * @brief This function sets a value in member type + * @param _type New value for member type + */ + eProsima_user_DllExport void type( + uint8_t _type); + + /*! + * @brief This function returns the value of member type + * @return Value of member type + */ + eProsima_user_DllExport uint8_t type() const; + + /*! + * @brief This function returns a reference to member type + * @return Reference to member type + */ + eProsima_user_DllExport uint8_t& type(); + + /*! + * @brief This function sets a value in member bool_value + * @param _bool_value New value for member bool_value + */ + eProsima_user_DllExport void bool_value( + bool _bool_value); + + /*! + * @brief This function returns the value of member bool_value + * @return Value of member bool_value + */ + eProsima_user_DllExport bool bool_value() const; + + /*! + * @brief This function returns a reference to member bool_value + * @return Reference to member bool_value + */ + eProsima_user_DllExport bool& bool_value(); + + /*! + * @brief This function sets a value in member integer_value + * @param _integer_value New value for member integer_value + */ + eProsima_user_DllExport void integer_value( + int64_t _integer_value); + + /*! + * @brief This function returns the value of member integer_value + * @return Value of member integer_value + */ + eProsima_user_DllExport int64_t integer_value() const; + + /*! + * @brief This function returns a reference to member integer_value + * @return Reference to member integer_value + */ + eProsima_user_DllExport int64_t& integer_value(); + + /*! + * @brief This function sets a value in member double_value + * @param _double_value New value for member double_value + */ + eProsima_user_DllExport void double_value( + double _double_value); + + /*! + * @brief This function returns the value of member double_value + * @return Value of member double_value + */ + eProsima_user_DllExport double double_value() const; + + /*! + * @brief This function returns a reference to member double_value + * @return Reference to member double_value + */ + eProsima_user_DllExport double& double_value(); + + /*! + * @brief This function copies the value in member string_value + * @param _string_value New value to be copied in member string_value + */ + eProsima_user_DllExport void string_value( + const std::string& _string_value); + + /*! + * @brief This function moves the value in member string_value + * @param _string_value New value to be moved in member string_value + */ + eProsima_user_DllExport void string_value( + std::string&& _string_value); + + /*! + * @brief This function returns a constant reference to member string_value + * @return Constant reference to member string_value + */ + eProsima_user_DllExport const std::string& string_value() const; + + /*! + * @brief This function returns a reference to member string_value + * @return Reference to member string_value + */ + eProsima_user_DllExport std::string& string_value(); + /*! + * @brief This function copies the value in member byte_array_value + * @param _byte_array_value New value to be copied in member byte_array_value + */ + eProsima_user_DllExport void byte_array_value( + const std::vector& _byte_array_value); + + /*! + * @brief This function moves the value in member byte_array_value + * @param _byte_array_value New value to be moved in member byte_array_value + */ + eProsima_user_DllExport void byte_array_value( + std::vector&& _byte_array_value); + + /*! + * @brief This function returns a constant reference to member byte_array_value + * @return Constant reference to member byte_array_value + */ + eProsima_user_DllExport const std::vector& byte_array_value() const; + + /*! + * @brief This function returns a reference to member byte_array_value + * @return Reference to member byte_array_value + */ + eProsima_user_DllExport std::vector& byte_array_value(); + /*! + * @brief This function copies the value in member bool_array_value + * @param _bool_array_value New value to be copied in member bool_array_value + */ + eProsima_user_DllExport void bool_array_value( + const std::vector& _bool_array_value); + + /*! + * @brief This function moves the value in member bool_array_value + * @param _bool_array_value New value to be moved in member bool_array_value + */ + eProsima_user_DllExport void bool_array_value( + std::vector&& _bool_array_value); + + /*! + * @brief This function returns a constant reference to member bool_array_value + * @return Constant reference to member bool_array_value + */ + eProsima_user_DllExport const std::vector& bool_array_value() const; + + /*! + * @brief This function returns a reference to member bool_array_value + * @return Reference to member bool_array_value + */ + eProsima_user_DllExport std::vector& bool_array_value(); + /*! + * @brief This function copies the value in member integer_array_value + * @param _integer_array_value New value to be copied in member integer_array_value + */ + eProsima_user_DllExport void integer_array_value( + const std::vector& _integer_array_value); + + /*! + * @brief This function moves the value in member integer_array_value + * @param _integer_array_value New value to be moved in member integer_array_value + */ + eProsima_user_DllExport void integer_array_value( + std::vector&& _integer_array_value); + + /*! + * @brief This function returns a constant reference to member integer_array_value + * @return Constant reference to member integer_array_value + */ + eProsima_user_DllExport const std::vector& integer_array_value() const; + + /*! + * @brief This function returns a reference to member integer_array_value + * @return Reference to member integer_array_value + */ + eProsima_user_DllExport std::vector& integer_array_value(); + /*! + * @brief This function copies the value in member double_array_value + * @param _double_array_value New value to be copied in member double_array_value + */ + eProsima_user_DllExport void double_array_value( + const std::vector& _double_array_value); + + /*! + * @brief This function moves the value in member double_array_value + * @param _double_array_value New value to be moved in member double_array_value + */ + eProsima_user_DllExport void double_array_value( + std::vector&& _double_array_value); + + /*! + * @brief This function returns a constant reference to member double_array_value + * @return Constant reference to member double_array_value + */ + eProsima_user_DllExport const std::vector& double_array_value() const; + + /*! + * @brief This function returns a reference to member double_array_value + * @return Reference to member double_array_value + */ + eProsima_user_DllExport std::vector& double_array_value(); + /*! + * @brief This function copies the value in member string_array_value + * @param _string_array_value New value to be copied in member string_array_value + */ + eProsima_user_DllExport void string_array_value( + const std::vector& _string_array_value); + + /*! + * @brief This function moves the value in member string_array_value + * @param _string_array_value New value to be moved in member string_array_value + */ + eProsima_user_DllExport void string_array_value( + std::vector&& _string_array_value); + + /*! + * @brief This function returns a constant reference to member string_array_value + * @return Constant reference to member string_array_value + */ + eProsima_user_DllExport const std::vector& string_array_value() const; + + /*! + * @brief This function returns a reference to member string_array_value + * @return Reference to member string_array_value + */ + eProsima_user_DllExport std::vector& string_array_value(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::msg::ParameterValue& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + uint8_t m_type; + bool m_bool_value; + int64_t m_integer_value; + double m_double_value; + std::string m_string_value; + std::vector m_byte_array_value; + std::vector m_bool_array_value; + std::vector m_integer_array_value; + std::vector m_double_array_value; + std::vector m_string_array_value; + }; + } // namespace msg +} // namespace rcl_interfaces + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERVALUE_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/ParameterValuePubSubTypes.h b/third-party/realdds/include/realdds/topics/ros2/ParameterValuePubSubTypes.h new file mode 100644 index 0000000000..fbf9d5b20b --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/ParameterValuePubSubTypes.h @@ -0,0 +1,96 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterValuePubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERVALUE_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERVALUE_PUBSUBTYPES_H_ + +#include +#include + +#include "ParameterValue.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated ParameterValue is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + +namespace rcl_interfaces +{ + namespace msg + { + /*! + * @brief This class represents the TopicDataType of the type ParameterValue defined by the user in the IDL file. + * @ingroup PARAMETERVALUE + */ + class ParameterValuePubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef ParameterValue type; + + eProsima_user_DllExport ParameterValuePubSubType(); + + eProsima_user_DllExport virtual ~ParameterValuePubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + } +} + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_PARAMETERVALUE_PUBSUBTYPES_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/SetParameters.h b/third-party/realdds/include/realdds/topics/ros2/SetParameters.h new file mode 100644 index 0000000000..bf042f140b --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/SetParameters.h @@ -0,0 +1,356 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file SetParameters.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_SETPARAMETERS_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_SETPARAMETERS_H_ + +#include "Parameter.h" +#include "SetParametersResult.h" + +//#include + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(SetParameters_SOURCE) +#define SetParameters_DllAPI __declspec( dllexport ) +#else +#define SetParameters_DllAPI __declspec( dllimport ) +#endif // SetParameters_SOURCE +#else +#define SetParameters_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define SetParameters_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +namespace rcl_interfaces { + namespace srv { + /*! + * @brief This class represents the structure SetParameters_Request defined by the user in the IDL file. + * @ingroup SETPARAMETERS + */ + class SetParameters_Request + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport SetParameters_Request(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~SetParameters_Request(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::srv::SetParameters_Request that will be copied. + */ + eProsima_user_DllExport SetParameters_Request( + const SetParameters_Request& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::srv::SetParameters_Request that will be copied. + */ + eProsima_user_DllExport SetParameters_Request( + SetParameters_Request&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::srv::SetParameters_Request that will be copied. + */ + eProsima_user_DllExport SetParameters_Request& operator =( + const SetParameters_Request& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::srv::SetParameters_Request that will be copied. + */ + eProsima_user_DllExport SetParameters_Request& operator =( + SetParameters_Request&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::SetParameters_Request object to compare. + */ + eProsima_user_DllExport bool operator ==( + const SetParameters_Request& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::SetParameters_Request object to compare. + */ + eProsima_user_DllExport bool operator !=( + const SetParameters_Request& x) const; + + /*! + * @brief This function copies the value in member parameters + * @param _parameters New value to be copied in member parameters + */ + eProsima_user_DllExport void parameters( + const std::vector& _parameters); + + /*! + * @brief This function moves the value in member parameters + * @param _parameters New value to be moved in member parameters + */ + eProsima_user_DllExport void parameters( + std::vector&& _parameters); + + /*! + * @brief This function returns a constant reference to member parameters + * @return Constant reference to member parameters + */ + eProsima_user_DllExport const std::vector& parameters() const; + + /*! + * @brief This function returns a reference to member parameters + * @return Reference to member parameters + */ + eProsima_user_DllExport std::vector& parameters(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::srv::SetParameters_Request& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + std::vector m_parameters; + }; + /*! + * @brief This class represents the structure SetParameters_Response defined by the user in the IDL file. + * @ingroup SETPARAMETERS + */ + class SetParameters_Response + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport SetParameters_Response(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~SetParameters_Response(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::srv::SetParameters_Response that will be copied. + */ + eProsima_user_DllExport SetParameters_Response( + const SetParameters_Response& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::srv::SetParameters_Response that will be copied. + */ + eProsima_user_DllExport SetParameters_Response( + SetParameters_Response&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::srv::SetParameters_Response that will be copied. + */ + eProsima_user_DllExport SetParameters_Response& operator =( + const SetParameters_Response& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::srv::SetParameters_Response that will be copied. + */ + eProsima_user_DllExport SetParameters_Response& operator =( + SetParameters_Response&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::SetParameters_Response object to compare. + */ + eProsima_user_DllExport bool operator ==( + const SetParameters_Response& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::srv::SetParameters_Response object to compare. + */ + eProsima_user_DllExport bool operator !=( + const SetParameters_Response& x) const; + + /*! + * @brief This function copies the value in member results + * @param _results New value to be copied in member results + */ + eProsima_user_DllExport void results( + const std::vector& _results); + + /*! + * @brief This function moves the value in member results + * @param _results New value to be moved in member results + */ + eProsima_user_DllExport void results( + std::vector&& _results); + + /*! + * @brief This function returns a constant reference to member results + * @return Constant reference to member results + */ + eProsima_user_DllExport const std::vector& results() const; + + /*! + * @brief This function returns a reference to member results + * @return Reference to member results + */ + eProsima_user_DllExport std::vector& results(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::srv::SetParameters_Response& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + std::vector m_results; + }; + } // namespace srv +} // namespace rcl_interfaces + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_SETPARAMETERS_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/SetParametersPubSubTypes.h b/third-party/realdds/include/realdds/topics/ros2/SetParametersPubSubTypes.h new file mode 100644 index 0000000000..2882b5cf69 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/SetParametersPubSubTypes.h @@ -0,0 +1,160 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file SetParametersPubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_SETPARAMETERS_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_SETPARAMETERS_PUBSUBTYPES_H_ + +#include +#include + +#include "SetParameters.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated SetParameters is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + +namespace rcl_interfaces +{ + namespace srv + { + /*! + * @brief This class represents the TopicDataType of the type SetParameters_Request defined by the user in the IDL file. + * @ingroup SETPARAMETERS + */ + class SetParameters_RequestPubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef SetParameters_Request type; + + eProsima_user_DllExport SetParameters_RequestPubSubType(); + + eProsima_user_DllExport virtual ~SetParameters_RequestPubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + /*! + * @brief This class represents the TopicDataType of the type SetParameters_Response defined by the user in the IDL file. + * @ingroup SETPARAMETERS + */ + class SetParameters_ResponsePubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef SetParameters_Response type; + + eProsima_user_DllExport SetParameters_ResponsePubSubType(); + + eProsima_user_DllExport virtual ~SetParameters_ResponsePubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + } +} + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_SRV_SETPARAMETERS_PUBSUBTYPES_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/SetParametersResult.h b/third-party/realdds/include/realdds/topics/ros2/SetParametersResult.h new file mode 100644 index 0000000000..b9f67694b7 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/SetParametersResult.h @@ -0,0 +1,227 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file SetParametersResult.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_SETPARAMETERSRESULT_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_SETPARAMETERSRESULT_H_ + + +//#include + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(SetParametersResult_SOURCE) +#define SetParametersResult_DllAPI __declspec( dllexport ) +#else +#define SetParametersResult_DllAPI __declspec( dllimport ) +#endif // SetParametersResult_SOURCE +#else +#define SetParametersResult_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define SetParametersResult_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +namespace rcl_interfaces { + namespace msg { + /*! + * @brief This class represents the structure SetParametersResult defined by the user in the IDL file. + * @ingroup SETPARAMETERSRESULT + */ + class SetParametersResult + { + public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport SetParametersResult(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~SetParametersResult(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object rcl_interfaces::msg::SetParametersResult that will be copied. + */ + eProsima_user_DllExport SetParametersResult( + const SetParametersResult& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object rcl_interfaces::msg::SetParametersResult that will be copied. + */ + eProsima_user_DllExport SetParametersResult( + SetParametersResult&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object rcl_interfaces::msg::SetParametersResult that will be copied. + */ + eProsima_user_DllExport SetParametersResult& operator =( + const SetParametersResult& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object rcl_interfaces::msg::SetParametersResult that will be copied. + */ + eProsima_user_DllExport SetParametersResult& operator =( + SetParametersResult&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::SetParametersResult object to compare. + */ + eProsima_user_DllExport bool operator ==( + const SetParametersResult& x) const; + + /*! + * @brief Comparison operator. + * @param x rcl_interfaces::msg::SetParametersResult object to compare. + */ + eProsima_user_DllExport bool operator !=( + const SetParametersResult& x) const; + + /*! + * @brief This function sets a value in member successful + * @param _successful New value for member successful + */ + eProsima_user_DllExport void successful( + bool _successful); + + /*! + * @brief This function returns the value of member successful + * @return Value of member successful + */ + eProsima_user_DllExport bool successful() const; + + /*! + * @brief This function returns a reference to member successful + * @return Reference to member successful + */ + eProsima_user_DllExport bool& successful(); + + /*! + * @brief This function copies the value in member reason + * @param _reason New value to be copied in member reason + */ + eProsima_user_DllExport void reason( + const std::string& _reason); + + /*! + * @brief This function moves the value in member reason + * @param _reason New value to be moved in member reason + */ + eProsima_user_DllExport void reason( + std::string&& _reason); + + /*! + * @brief This function returns a constant reference to member reason + * @return Constant reference to member reason + */ + eProsima_user_DllExport const std::string& reason() const; + + /*! + * @brief This function returns a reference to member reason + * @return Reference to member reason + */ + eProsima_user_DllExport std::string& reason(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const rcl_interfaces::msg::SetParametersResult& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey( + eprosima::fastcdr::Cdr& cdr) const; + + private: + + bool m_successful; + std::string m_reason; + }; + } // namespace msg +} // namespace rcl_interfaces + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_SETPARAMETERSRESULT_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/SetParametersResultPubSubTypes.h b/third-party/realdds/include/realdds/topics/ros2/SetParametersResultPubSubTypes.h new file mode 100644 index 0000000000..22ab266277 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/SetParametersResultPubSubTypes.h @@ -0,0 +1,96 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file SetParametersResultPubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_SETPARAMETERSRESULT_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_SETPARAMETERSRESULT_PUBSUBTYPES_H_ + +#include +#include + +#include "SetParametersResult.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated SetParametersResult is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + +namespace rcl_interfaces +{ + namespace msg + { + /*! + * @brief This class represents the TopicDataType of the type SetParametersResult defined by the user in the IDL file. + * @ingroup SETPARAMETERSRESULT + */ + class SetParametersResultPubSubType : public eprosima::fastdds::dds::TopicDataType + { + public: + + typedef SetParametersResult type; + + eProsima_user_DllExport SetParametersResultPubSubType(); + + eProsima_user_DllExport virtual ~SetParametersResultPubSubType() override; + + eProsima_user_DllExport virtual bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + + eProsima_user_DllExport virtual bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport virtual std::function getSerializedSizeProvider( + void* data) override; + + eProsima_user_DllExport virtual bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport virtual void* createData() override; + + eProsima_user_DllExport virtual void deleteData( + void* data) override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + (void)memory; + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + }; + } +} + +#endif // _FAST_DDS_GENERATED_RCL_INTERFACES_MSG_SETPARAMETERSRESULT_PUBSUBTYPES_H_ \ No newline at end of file diff --git a/third-party/realdds/include/realdds/topics/ros2/describe-parameters-msg.h b/third-party/realdds/include/realdds/topics/ros2/describe-parameters-msg.h new file mode 100644 index 0000000000..f3f9e98aea --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/describe-parameters-msg.h @@ -0,0 +1,114 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. +#pragma once + +#include + +#include +#include + +#include +#include +#include + + +namespace rcl_interfaces { +namespace srv { +class DescribeParameters_RequestPubSubType; +class DescribeParameters_ResponsePubSubType; +} // namespace srv +} // namespace rcl_interfaces + + +namespace realdds { + + +class dds_participant; +class dds_topic; +class dds_topic_reader; +class dds_topic_writer; + + +namespace topics { +namespace ros2 { + + +class describe_parameters_request_msg +{ + rcl_interfaces::srv::DescribeParameters_Request _raw; + +public: + using type = rcl_interfaces::srv::DescribeParameters_RequestPubSubType; + + void clear() { _raw.names().clear(); } + std::vector< std::string > const & names() const { return _raw.names(); } + void add( std::string const & name ) { _raw.names().push_back( name ); } + + bool is_valid() const { return ! names().empty(); } + void invalidate() { clear(); } + + + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + char const * topic_name ); + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + std::string const & topic_name ) + { + return create_topic( participant, topic_name.c_str() ); + } + + // This helper method will take the next sample from a reader. + // + // Returns true if successful. Make sure you still check is_valid() in case the sample info isn't! + // Returns false if no more data is available. + // Will throw if an unexpected error occurs. + // + //Note - copies the data. + //TODO - add an API for a function that loans the data and enables the user to free it later. + static bool take_next( dds_topic_reader &, + describe_parameters_request_msg * output, + dds_sample * optional_sample = nullptr ); +}; + + +class describe_parameters_response_msg +{ + rcl_interfaces::srv::DescribeParameters_Response _raw; + +public: + using type = rcl_interfaces::srv::DescribeParameters_ResponsePubSubType; + + using descriptor_type = rcl_interfaces::msg::ParameterDescriptor; + + std::vector< descriptor_type > const & descriptors() const { return _raw.descriptors(); } + bool is_valid() const { return ! descriptors().empty(); } + void invalidate() { _raw.descriptors().clear(); } + + + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + char const * topic_name ); + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + std::string const & topic_name ) + { + return create_topic( participant, topic_name.c_str() ); + } + + // Returns some unique (to the writer) identifier for the sample that was sent, or 0 if unsuccessful + dds_sequence_number write_to( dds_topic_writer & ); + + // This helper method will take the next sample from a reader. + // + // Returns true if successful. Make sure you still check is_valid() in case the sample info isn't! + // Returns false if no more data is available. + // Will throw if an unexpected error occurs. + // + //Note - copies the data. + //TODO - add an API for a function that loans the data and enables the user to free it later. + static bool take_next( dds_topic_reader &, + describe_parameters_response_msg * output, + dds_sample * optional_sample = nullptr ); +}; + + +} // namespace ros2 +} // namespace topics +} // namespace realdds diff --git a/third-party/realdds/include/realdds/topics/ros2/get-parameters-msg.h b/third-party/realdds/include/realdds/topics/ros2/get-parameters-msg.h new file mode 100644 index 0000000000..0114b1c424 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/get-parameters-msg.h @@ -0,0 +1,114 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. +#pragma once + +#include + +#include +#include + +#include +#include +#include + + +namespace rcl_interfaces { +namespace srv { +class GetParameters_RequestPubSubType; +class GetParameters_ResponsePubSubType; +} // namespace srv +} // namespace rcl_interfaces + + +namespace realdds { + + +class dds_participant; +class dds_topic; +class dds_topic_reader; +class dds_topic_writer; + + +namespace topics { +namespace ros2 { + + +class get_parameters_request_msg +{ + rcl_interfaces::srv::GetParameters_Request _raw; + +public: + using type = rcl_interfaces::srv::GetParameters_RequestPubSubType; + + void clear() { _raw.names().clear(); } + std::vector< std::string > const & names() const { return _raw.names(); } + void add( std::string const & name ) { _raw.names().push_back( name ); } + + bool is_valid() const { return ! names().empty(); } + void invalidate() { clear(); } + + + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + char const * topic_name ); + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + std::string const & topic_name ) + { + return create_topic( participant, topic_name.c_str() ); + } + + // This helper method will take the next sample from a reader. + // + // Returns true if successful. Make sure you still check is_valid() in case the sample info isn't! + // Returns false if no more data is available. + // Will throw if an unexpected error occurs. + // + //Note - copies the data. + //TODO - add an API for a function that loans the data and enables the user to free it later. + static bool take_next( dds_topic_reader &, + get_parameters_request_msg * output, + dds_sample * optional_sample = nullptr ); +}; + + +class get_parameters_response_msg +{ + rcl_interfaces::srv::GetParameters_Response _raw; + +public: + using type = rcl_interfaces::srv::GetParameters_ResponsePubSubType; + + using value_type = rcl_interfaces::msg::ParameterValue; + + std::vector< value_type > const & values() const { return _raw.values(); } + void add( value_type const & value ) { _raw.values().push_back( value ); } + bool is_valid() const { return ! values().empty(); } + void invalidate() { _raw.values().clear(); } + + // Returns some unique (to the writer) identifier for the sample that was sent, or 0 if unsuccessful + dds_sequence_number write_to( dds_topic_writer & ); + + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + char const * topic_name ); + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + std::string const & topic_name ) + { + return create_topic( participant, topic_name.c_str() ); + } + + // This helper method will take the next sample from a reader. + // + // Returns true if successful. Make sure you still check is_valid() in case the sample info isn't! + // Returns false if no more data is available. + // Will throw if an unexpected error occurs. + // + //Note - copies the data. + //TODO - add an API for a function that loans the data and enables the user to free it later. + static bool take_next( dds_topic_reader &, + get_parameters_response_msg * output, + dds_sample * optional_sample = nullptr ); +}; + + +} // namespace ros2 +} // namespace topics +} // namespace realdds diff --git a/third-party/realdds/include/realdds/topics/ros2/list-parameters-msg.h b/third-party/realdds/include/realdds/topics/ros2/list-parameters-msg.h new file mode 100644 index 0000000000..3f52403757 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/list-parameters-msg.h @@ -0,0 +1,122 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. +#pragma once + +#include + +#include +#include + +#include +#include +#include + + +namespace rcl_interfaces { +namespace srv { +class ListParameters_RequestPubSubType; +class ListParameters_ResponsePubSubType; +} // namespace srv +} // namespace rcl_interfaces + + +namespace realdds { + + +class dds_participant; +class dds_topic; +class dds_topic_reader; +class dds_topic_writer; + + +namespace topics { +namespace ros2 { + + +class list_parameters_request_msg +{ + rcl_interfaces::srv::ListParameters_Request _raw; + +public: + using type = rcl_interfaces::srv::ListParameters_RequestPubSubType; + + static const auto DEPTH_RECURSIVE = rcl_interfaces::srv::ListParameters_Request_Constants::DEPTH_RECURSIVE; + + // Relative depth from given prefixes + // Use DEPTH_RECURSIVE (the default) to get the recursive parameters and prefixes for each prefix; unlimited depth + uint64_t depth() const { return _raw.depth(); } + void depth( uint64_t d ) { _raw.depth( d ); } + + // If the prefixes are empty, returns all parameters + + void clear() { _raw.prefixes().clear(); } + std::vector< std::string > const & prefixes() const { return _raw.prefixes(); } + void add( std::string const & prefix ) { _raw.prefixes().push_back( prefix ); } + + bool is_valid() const { return depth() != 0xBADF00D; } + void invalidate() { depth( 0xBADF00D ); } + + + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + char const * topic_name ); + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + std::string const & topic_name ) + { + return create_topic( participant, topic_name.c_str() ); + } + + // This helper method will take the next sample from a reader. + // + // Returns true if successful. Make sure you still check is_valid() in case the sample info isn't! + // Returns false if no more data is available. + // Will throw if an unexpected error occurs. + // + //Note - copies the data. + //TODO - add an API for a function that loans the data and enables the user to free it later. + static bool take_next( dds_topic_reader &, + list_parameters_request_msg * output, + dds_sample * optional_sample = nullptr ); +}; + + +class list_parameters_response_msg +{ + rcl_interfaces::srv::ListParameters_Response _raw; + +public: + using type = rcl_interfaces::srv::ListParameters_ResponsePubSubType; + + std::vector< std::string > const & names() const { return _raw.result().names(); } + std::vector< std::string > const & prefixes() const { return _raw.result().prefixes(); } + bool is_valid() const { return true; } + void clear() { _raw.result().names().clear(); } + + + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + char const * topic_name ); + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + std::string const & topic_name ) + { + return create_topic( participant, topic_name.c_str() ); + } + + // Returns some unique (to the writer) identifier for the sample that was sent, or 0 if unsuccessful + dds_sequence_number write_to( dds_topic_writer & ); + + // This helper method will take the next sample from a reader. + // + // Returns true if successful. Make sure you still check is_valid() in case the sample info isn't! + // Returns false if no more data is available. + // Will throw if an unexpected error occurs. + // + //Note - copies the data. + //TODO - add an API for a function that loans the data and enables the user to free it later. + static bool take_next( dds_topic_reader &, + list_parameters_response_msg * output, + dds_sample * optional_sample = nullptr ); +}; + + +} // namespace ros2 +} // namespace topics +} // namespace realdds diff --git a/third-party/realdds/include/realdds/topics/ros2/set-parameters-msg.h b/third-party/realdds/include/realdds/topics/ros2/set-parameters-msg.h new file mode 100644 index 0000000000..fd4cc66fc2 --- /dev/null +++ b/third-party/realdds/include/realdds/topics/ros2/set-parameters-msg.h @@ -0,0 +1,118 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. +#pragma once + +#include + +#include +#include +#include + +#include +#include +#include + + +namespace rcl_interfaces { +namespace srv { +class SetParameters_RequestPubSubType; +class SetParameters_ResponsePubSubType; +} // namespace srv +} // namespace rcl_interfaces + + +namespace realdds { + + +class dds_participant; +class dds_topic; +class dds_topic_reader; +class dds_topic_writer; + + +namespace topics { +namespace ros2 { + + +class set_parameters_request_msg +{ + rcl_interfaces::srv::SetParameters_Request _raw; + +public: + using type = rcl_interfaces::srv::SetParameters_RequestPubSubType; + + using parameter_type = rcl_interfaces::msg::Parameter; + + void clear() { _raw.parameters().clear(); } + std::vector< parameter_type > const & parameters() const { return _raw.parameters(); } + void add( parameter_type const & parameter ) { _raw.parameters().push_back( parameter ); } + + bool is_valid() const { return ! parameters().empty(); } + void invalidate() { clear(); } + + + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + char const * topic_name ); + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + std::string const & topic_name ) + { + return create_topic( participant, topic_name.c_str() ); + } + + // This helper method will take the next sample from a reader. + // + // Returns true if successful. Make sure you still check is_valid() in case the sample info isn't! + // Returns false if no more data is available. + // Will throw if an unexpected error occurs. + // + //Note - copies the data. + //TODO - add an API for a function that loans the data and enables the user to free it later. + static bool take_next( dds_topic_reader &, + set_parameters_request_msg * output, + dds_sample * optional_sample = nullptr ); +}; + + +class set_parameters_response_msg +{ + rcl_interfaces::srv::SetParameters_Response _raw; + +public: + using type = rcl_interfaces::srv::SetParameters_ResponsePubSubType; + + using result_type = rcl_interfaces::msg::SetParametersResult; + + std::vector< result_type > const & results() const { return _raw.results(); } + void add( result_type const & result ) { _raw.results().push_back( result ); } + bool is_valid() const { return ! results().empty(); } + void invalidate() { _raw.results().clear(); } + + + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + char const * topic_name ); + static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, + std::string const & topic_name ) + { + return create_topic( participant, topic_name.c_str() ); + } + + // Returns some unique (to the writer) identifier for the sample that was sent, or 0 if unsuccessful + dds_sequence_number write_to( dds_topic_writer & ); + + // This helper method will take the next sample from a reader. + // + // Returns true if successful. Make sure you still check is_valid() in case the sample info isn't! + // Returns false if no more data is available. + // Will throw if an unexpected error occurs. + // + //Note - copies the data. + //TODO - add an API for a function that loans the data and enables the user to free it later. + static bool take_next( dds_topic_reader &, + set_parameters_response_msg * output, + dds_sample * optional_sample = nullptr ); +}; + + +} // namespace ros2 +} // namespace topics +} // namespace realdds diff --git a/third-party/realdds/src/dds-stream-sensor-bridge.cpp b/third-party/realdds/src/dds-stream-sensor-bridge.cpp index e3a835604d..69dd946875 100644 --- a/third-party/realdds/src/dds-stream-sensor-bridge.cpp +++ b/third-party/realdds/src/dds-stream-sensor-bridge.cpp @@ -445,4 +445,16 @@ bool dds_stream_sensor_bridge::is_streaming( std::shared_ptr< dds_stream_server } +std::shared_ptr< dds_stream_profile > +dds_stream_sensor_bridge::get_profile( std::shared_ptr< dds_stream_server > const & server ) const +{ + auto name2sensor = _sensors.find( server->sensor_name() ); + if( name2sensor == _sensors.end() ) + DDS_THROW( runtime_error, "invalid sensor name '" + server->sensor_name() + "'" ); + sensor_bridge const & sensor = name2sensor->second; + stream_bridge const & stream = sensor.streams.at( server->name() ); + return stream.profile; +} + + } // namespace realdds diff --git a/third-party/realdds/src/topics/ros2-describe-parameters-request-msg.cpp b/third-party/realdds/src/topics/ros2-describe-parameters-request-msg.cpp new file mode 100644 index 0000000000..cfd4cab27e --- /dev/null +++ b/third-party/realdds/src/topics/ros2-describe-parameters-request-msg.cpp @@ -0,0 +1,60 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +#include +#include +#include + +#include +#include +#include + +#include +#include + + +namespace realdds { +namespace topics { +namespace ros2 { + + +/*static*/ std::shared_ptr< dds_topic > +describe_parameters_request_msg::create_topic( std::shared_ptr< dds_participant > const & participant, char const * topic_name ) +{ + return std::make_shared< dds_topic >( participant, + eprosima::fastdds::dds::TypeSupport( new describe_parameters_request_msg::type ), + topic_name ); +} + + +/*static*/ bool +describe_parameters_request_msg::take_next( dds_topic_reader & reader, describe_parameters_request_msg * output, dds_sample * sample ) +{ + describe_parameters_request_msg output_; + if( ! output ) + output = &output_; // use the local copy if the user hasn't provided their own + dds_sample sample_; + if( ! sample ) + sample = &sample_; // use the local copy if the user hasn't provided their own + auto status = reader->take_next_sample( &output->_raw, sample ); + if( status == ReturnCode_t::RETCODE_OK ) + { + // Only samples for which valid_data is true should be accessed + // valid_data indicates that the instance is still ALIVE and the `take` return an + // updated sample + if( ! sample->valid_data ) + output->invalidate(); + + return true; + } + if ( status == ReturnCode_t::RETCODE_NO_DATA ) + { + // This is an expected return code and is not an error + return false; + } + DDS_API_CALL_THROW( "describe_parameters_request_msg::take_next", status ); +} + +} // namespace ros2 +} // namespace topics +} // namespace realdds diff --git a/third-party/realdds/src/topics/ros2-describe-parameters-response-msg.cpp b/third-party/realdds/src/topics/ros2-describe-parameters-response-msg.cpp new file mode 100644 index 0000000000..ffd3fec563 --- /dev/null +++ b/third-party/realdds/src/topics/ros2-describe-parameters-response-msg.cpp @@ -0,0 +1,78 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + + +namespace realdds { +namespace topics { +namespace ros2 { + + +/*static*/ std::shared_ptr< dds_topic > +describe_parameters_response_msg::create_topic( std::shared_ptr< dds_participant > const & participant, char const * topic_name ) +{ + return std::make_shared< dds_topic >( participant, + eprosima::fastdds::dds::TypeSupport( new describe_parameters_response_msg::type ), + topic_name ); +} + + +/*static*/ bool +describe_parameters_response_msg::take_next( dds_topic_reader & reader, describe_parameters_response_msg * output, dds_sample * sample ) +{ + describe_parameters_response_msg output_; + if( ! output ) + output = &output_; // use the local copy if the user hasn't provided their own + dds_sample sample_; + if( ! sample ) + sample = &sample_; // use the local copy if the user hasn't provided their own + auto status = reader->take_next_sample( &output->_raw, sample ); + if( status == ReturnCode_t::RETCODE_OK ) + { + // Only samples for which valid_data is true should be accessed + // valid_data indicates that the instance is still ALIVE and the `take` return an + // updated sample + if( ! sample->valid_data ) + output->invalidate(); + + return true; + } + if ( status == ReturnCode_t::RETCODE_NO_DATA ) + { + // This is an expected return code and is not an error + return false; + } + DDS_API_CALL_THROW( "describe_parameters_response_msg::take_next", status ); +} + + +dds_sequence_number describe_parameters_response_msg::write_to( dds_topic_writer & writer ) +{ + eprosima::fastrtps::rtps::WriteParams params; + bool success = DDS_API_CALL( writer.get()->write( &_raw, params ) ); + if( ! success ) + { + LOG_ERROR( "Error writing message" ); + return 0; + } + // The params will contain, after the write, the sequence number (incremented automatically) for the sample that was + // sent. The source_timestamp is always INVALID for some reason. + return params.sample_identity().sequence_number().to64long(); +} + + +} // namespace ros2 +} // namespace topics +} // namespace realdds diff --git a/third-party/realdds/src/topics/ros2-get-parameters-request-msg.cpp b/third-party/realdds/src/topics/ros2-get-parameters-request-msg.cpp new file mode 100644 index 0000000000..f5066244c9 --- /dev/null +++ b/third-party/realdds/src/topics/ros2-get-parameters-request-msg.cpp @@ -0,0 +1,60 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +#include +#include +#include + +#include +#include +#include + +#include +#include + + +namespace realdds { +namespace topics { +namespace ros2 { + + +/*static*/ std::shared_ptr< dds_topic > +get_parameters_request_msg::create_topic( std::shared_ptr< dds_participant > const & participant, char const * topic_name ) +{ + return std::make_shared< dds_topic >( participant, + eprosima::fastdds::dds::TypeSupport( new get_parameters_request_msg::type ), + topic_name ); +} + + +/*static*/ bool +get_parameters_request_msg::take_next( dds_topic_reader & reader, get_parameters_request_msg * output, dds_sample * sample ) +{ + get_parameters_request_msg output_; + if( ! output ) + output = &output_; // use the local copy if the user hasn't provided their own + dds_sample sample_; + if( ! sample ) + sample = &sample_; // use the local copy if the user hasn't provided their own + auto status = reader->take_next_sample( &output->_raw, sample ); + if( status == ReturnCode_t::RETCODE_OK ) + { + // Only samples for which valid_data is true should be accessed + // valid_data indicates that the instance is still ALIVE and the `take` return an + // updated sample + if( ! sample->valid_data ) + output->invalidate(); + + return true; + } + if ( status == ReturnCode_t::RETCODE_NO_DATA ) + { + // This is an expected return code and is not an error + return false; + } + DDS_API_CALL_THROW( "get_parameters_request_msg::take_next", status ); +} + +} // namespace ros2 +} // namespace topics +} // namespace realdds diff --git a/third-party/realdds/src/topics/ros2-get-parameters-response-msg.cpp b/third-party/realdds/src/topics/ros2-get-parameters-response-msg.cpp new file mode 100644 index 0000000000..347148bfa7 --- /dev/null +++ b/third-party/realdds/src/topics/ros2-get-parameters-response-msg.cpp @@ -0,0 +1,78 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + + +namespace realdds { +namespace topics { +namespace ros2 { + + +/*static*/ std::shared_ptr< dds_topic > +get_parameters_response_msg::create_topic( std::shared_ptr< dds_participant > const & participant, char const * topic_name ) +{ + return std::make_shared< dds_topic >( participant, + eprosima::fastdds::dds::TypeSupport( new get_parameters_response_msg::type ), + topic_name ); +} + + +/*static*/ bool +get_parameters_response_msg::take_next( dds_topic_reader & reader, get_parameters_response_msg * output, dds_sample * sample ) +{ + get_parameters_response_msg output_; + if( ! output ) + output = &output_; // use the local copy if the user hasn't provided their own + dds_sample sample_; + if( ! sample ) + sample = &sample_; // use the local copy if the user hasn't provided their own + auto status = reader->take_next_sample( &output->_raw, sample ); + if( status == ReturnCode_t::RETCODE_OK ) + { + // Only samples for which valid_data is true should be accessed + // valid_data indicates that the instance is still ALIVE and the `take` return an + // updated sample + if( ! sample->valid_data ) + output->invalidate(); + + return true; + } + if ( status == ReturnCode_t::RETCODE_NO_DATA ) + { + // This is an expected return code and is not an error + return false; + } + DDS_API_CALL_THROW( "get_parameters_response_msg::take_next", status ); +} + + +dds_sequence_number get_parameters_response_msg::write_to( dds_topic_writer & writer ) +{ + eprosima::fastrtps::rtps::WriteParams params; + bool success = DDS_API_CALL( writer.get()->write( &_raw, params ) ); + if( ! success ) + { + LOG_ERROR( "Error writing message" ); + return 0; + } + // The params will contain, after the write, the sequence number (incremented automatically) for the sample that was + // sent. The source_timestamp is always INVALID for some reason. + return params.sample_identity().sequence_number().to64long(); +} + + +} // namespace ros2 +} // namespace topics +} // namespace realdds diff --git a/third-party/realdds/src/topics/ros2-list-parameters-request-msg.cpp b/third-party/realdds/src/topics/ros2-list-parameters-request-msg.cpp new file mode 100644 index 0000000000..ca7de2aa5a --- /dev/null +++ b/third-party/realdds/src/topics/ros2-list-parameters-request-msg.cpp @@ -0,0 +1,60 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +#include +#include +#include + +#include +#include +#include + +#include +#include + + +namespace realdds { +namespace topics { +namespace ros2 { + + +/*static*/ std::shared_ptr< dds_topic > +list_parameters_request_msg::create_topic( std::shared_ptr< dds_participant > const & participant, char const * topic_name ) +{ + return std::make_shared< dds_topic >( participant, + eprosima::fastdds::dds::TypeSupport( new list_parameters_request_msg::type ), + topic_name ); +} + + +/*static*/ bool +list_parameters_request_msg::take_next( dds_topic_reader & reader, list_parameters_request_msg * output, dds_sample * sample ) +{ + list_parameters_request_msg output_; + if( ! output ) + output = &output_; // use the local copy if the user hasn't provided their own + dds_sample sample_; + if( ! sample ) + sample = &sample_; // use the local copy if the user hasn't provided their own + auto status = reader->take_next_sample( &output->_raw, sample ); + if( status == ReturnCode_t::RETCODE_OK ) + { + // Only samples for which valid_data is true should be accessed + // valid_data indicates that the instance is still ALIVE and the `take` return an + // updated sample + if( ! sample->valid_data ) + output->invalidate(); + + return true; + } + if ( status == ReturnCode_t::RETCODE_NO_DATA ) + { + // This is an expected return code and is not an error + return false; + } + DDS_API_CALL_THROW( "list_parameters_request_msg::take_next", status ); +} + +} // namespace ros2 +} // namespace topics +} // namespace realdds diff --git a/third-party/realdds/src/topics/ros2-list-parameters-response-msg.cpp b/third-party/realdds/src/topics/ros2-list-parameters-response-msg.cpp new file mode 100644 index 0000000000..5bde58ed69 --- /dev/null +++ b/third-party/realdds/src/topics/ros2-list-parameters-response-msg.cpp @@ -0,0 +1,78 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + + +namespace realdds { +namespace topics { +namespace ros2 { + + +/*static*/ std::shared_ptr< dds_topic > +list_parameters_response_msg::create_topic( std::shared_ptr< dds_participant > const & participant, char const * topic_name ) +{ + return std::make_shared< dds_topic >( participant, + eprosima::fastdds::dds::TypeSupport( new list_parameters_response_msg::type ), + topic_name ); +} + + +/*static*/ bool +list_parameters_response_msg::take_next( dds_topic_reader & reader, list_parameters_response_msg * output, dds_sample * sample ) +{ + list_parameters_response_msg output_; + if( ! output ) + output = &output_; // use the local copy if the user hasn't provided their own + dds_sample sample_; + if( ! sample ) + sample = &sample_; // use the local copy if the user hasn't provided their own + auto status = reader->take_next_sample( &output->_raw, sample ); + if( status == ReturnCode_t::RETCODE_OK ) + { + // Only samples for which valid_data is true should be accessed + // valid_data indicates that the instance is still ALIVE and the `take` return an + // updated sample + if( ! sample->valid_data ) + output->clear(); + + return true; + } + if ( status == ReturnCode_t::RETCODE_NO_DATA ) + { + // This is an expected return code and is not an error + return false; + } + DDS_API_CALL_THROW( "list_parameters_response_msg::take_next", status ); +} + + +dds_sequence_number list_parameters_response_msg::write_to( dds_topic_writer & writer ) +{ + eprosima::fastrtps::rtps::WriteParams params; + bool success = DDS_API_CALL( writer.get()->write( &_raw, params ) ); + if( !success ) + { + LOG_ERROR( "Error writing message" ); + return 0; + } + // The params will contain, after the write, the sequence number (incremented automatically) for the sample that was + // sent. The source_timestamp is always INVALID for some reason. + return params.sample_identity().sequence_number().to64long(); +} + + +} // namespace ros2 +} // namespace topics +} // namespace realdds diff --git a/third-party/realdds/src/topics/ros2-set-parameters-request-msg.cpp b/third-party/realdds/src/topics/ros2-set-parameters-request-msg.cpp new file mode 100644 index 0000000000..78da78717c --- /dev/null +++ b/third-party/realdds/src/topics/ros2-set-parameters-request-msg.cpp @@ -0,0 +1,60 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +#include +#include +#include + +#include +#include +#include + +#include +#include + + +namespace realdds { +namespace topics { +namespace ros2 { + + +/*static*/ std::shared_ptr< dds_topic > +set_parameters_request_msg::create_topic( std::shared_ptr< dds_participant > const & participant, char const * topic_name ) +{ + return std::make_shared< dds_topic >( participant, + eprosima::fastdds::dds::TypeSupport( new set_parameters_request_msg::type ), + topic_name ); +} + + +/*static*/ bool +set_parameters_request_msg::take_next( dds_topic_reader & reader, set_parameters_request_msg * output, dds_sample * sample ) +{ + set_parameters_request_msg output_; + if( ! output ) + output = &output_; // use the local copy if the user hasn't provided their own + dds_sample sample_; + if( ! sample ) + sample = &sample_; // use the local copy if the user hasn't provided their own + auto status = reader->take_next_sample( &output->_raw, sample ); + if( status == ReturnCode_t::RETCODE_OK ) + { + // Only samples for which valid_data is true should be accessed + // valid_data indicates that the instance is still ALIVE and the `take` return an + // updated sample + if( ! sample->valid_data ) + output->invalidate(); + + return true; + } + if ( status == ReturnCode_t::RETCODE_NO_DATA ) + { + // This is an expected return code and is not an error + return false; + } + DDS_API_CALL_THROW( "set_parameters_request_msg::take_next", status ); +} + +} // namespace ros2 +} // namespace topics +} // namespace realdds diff --git a/third-party/realdds/src/topics/ros2-set-parameters-response-msg.cpp b/third-party/realdds/src/topics/ros2-set-parameters-response-msg.cpp new file mode 100644 index 0000000000..a12e404ba9 --- /dev/null +++ b/third-party/realdds/src/topics/ros2-set-parameters-response-msg.cpp @@ -0,0 +1,78 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + + +namespace realdds { +namespace topics { +namespace ros2 { + + +/*static*/ std::shared_ptr< dds_topic > +set_parameters_response_msg::create_topic( std::shared_ptr< dds_participant > const & participant, char const * topic_name ) +{ + return std::make_shared< dds_topic >( participant, + eprosima::fastdds::dds::TypeSupport( new set_parameters_response_msg::type ), + topic_name ); +} + + +/*static*/ bool +set_parameters_response_msg::take_next( dds_topic_reader & reader, set_parameters_response_msg * output, dds_sample * sample ) +{ + set_parameters_response_msg output_; + if( ! output ) + output = &output_; // use the local copy if the user hasn't provided their own + dds_sample sample_; + if( ! sample ) + sample = &sample_; // use the local copy if the user hasn't provided their own + auto status = reader->take_next_sample( &output->_raw, sample ); + if( status == ReturnCode_t::RETCODE_OK ) + { + // Only samples for which valid_data is true should be accessed + // valid_data indicates that the instance is still ALIVE and the `take` return an + // updated sample + if( ! sample->valid_data ) + output->invalidate(); + + return true; + } + if ( status == ReturnCode_t::RETCODE_NO_DATA ) + { + // This is an expected return code and is not an error + return false; + } + DDS_API_CALL_THROW( "set_parameters_response_msg::take_next", status ); +} + + +dds_sequence_number set_parameters_response_msg::write_to( dds_topic_writer & writer ) +{ + eprosima::fastrtps::rtps::WriteParams params; + bool success = DDS_API_CALL( writer.get()->write( &_raw, params ) ); + if( ! success ) + { + LOG_ERROR( "Error writing message" ); + return 0; + } + // The params will contain, after the write, the sequence number (incremented automatically) for the sample that was + // sent. The source_timestamp is always INVALID for some reason. + return params.sample_identity().sequence_number().to64long(); +} + + +} // namespace ros2 +} // namespace topics +} // namespace realdds diff --git a/third-party/realdds/src/topics/ros2/DescribeParameters.cpp b/third-party/realdds/src/topics/ros2/DescribeParameters.cpp new file mode 100644 index 0000000000..cb196bbd78 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/DescribeParameters.cpp @@ -0,0 +1,349 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file DescribeParameters.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + +rcl_interfaces::srv::DescribeParameters_Request::DescribeParameters_Request() +{ + // m_names com.eprosima.idl.parser.typecode.SequenceTypeCode@2f0a87b3 + + +} + +rcl_interfaces::srv::DescribeParameters_Request::~DescribeParameters_Request() +{ +} + +rcl_interfaces::srv::DescribeParameters_Request::DescribeParameters_Request( + const DescribeParameters_Request& x) +{ + m_names = x.m_names; +} + +rcl_interfaces::srv::DescribeParameters_Request::DescribeParameters_Request( + DescribeParameters_Request&& x) noexcept +{ + m_names = std::move(x.m_names); +} + +rcl_interfaces::srv::DescribeParameters_Request& rcl_interfaces::srv::DescribeParameters_Request::operator =( + const DescribeParameters_Request& x) +{ + + m_names = x.m_names; + + return *this; +} + +rcl_interfaces::srv::DescribeParameters_Request& rcl_interfaces::srv::DescribeParameters_Request::operator =( + DescribeParameters_Request&& x) noexcept +{ + + m_names = std::move(x.m_names); + + return *this; +} + +bool rcl_interfaces::srv::DescribeParameters_Request::operator ==( + const DescribeParameters_Request& x) const +{ + + return (m_names == x.m_names); +} + +bool rcl_interfaces::srv::DescribeParameters_Request::operator !=( + const DescribeParameters_Request& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::srv::DescribeParameters_Request::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < 100; ++a) + { + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + } + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::srv::DescribeParameters_Request::getCdrSerializedSize( + const rcl_interfaces::srv::DescribeParameters_Request& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < data.names().size(); ++a) + { + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + + data.names().at(a).size() + 1; + } + return current_alignment - initial_alignment; +} + +void rcl_interfaces::srv::DescribeParameters_Request::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_names; +} + +void rcl_interfaces::srv::DescribeParameters_Request::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_names;} + +/*! + * @brief This function copies the value in member names + * @param _names New value to be copied in member names + */ +void rcl_interfaces::srv::DescribeParameters_Request::names( + const std::vector& _names) +{ + m_names = _names; +} + +/*! + * @brief This function moves the value in member names + * @param _names New value to be moved in member names + */ +void rcl_interfaces::srv::DescribeParameters_Request::names( + std::vector&& _names) +{ + m_names = std::move(_names); +} + +/*! + * @brief This function returns a constant reference to member names + * @return Constant reference to member names + */ +const std::vector& rcl_interfaces::srv::DescribeParameters_Request::names() const +{ + return m_names; +} + +/*! + * @brief This function returns a reference to member names + * @return Reference to member names + */ +std::vector& rcl_interfaces::srv::DescribeParameters_Request::names() +{ + return m_names; +} + +size_t rcl_interfaces::srv::DescribeParameters_Request::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + return current_align; +} + +bool rcl_interfaces::srv::DescribeParameters_Request::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::srv::DescribeParameters_Request::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + +rcl_interfaces::srv::DescribeParameters_Response::DescribeParameters_Response() +{ + // m_descriptors com.eprosima.idl.parser.typecode.SequenceTypeCode@4fcd19b3 + + +} + +rcl_interfaces::srv::DescribeParameters_Response::~DescribeParameters_Response() +{ +} + +rcl_interfaces::srv::DescribeParameters_Response::DescribeParameters_Response( + const DescribeParameters_Response& x) +{ + m_descriptors = x.m_descriptors; +} + +rcl_interfaces::srv::DescribeParameters_Response::DescribeParameters_Response( + DescribeParameters_Response&& x) noexcept +{ + m_descriptors = std::move(x.m_descriptors); +} + +rcl_interfaces::srv::DescribeParameters_Response& rcl_interfaces::srv::DescribeParameters_Response::operator =( + const DescribeParameters_Response& x) +{ + + m_descriptors = x.m_descriptors; + + return *this; +} + +rcl_interfaces::srv::DescribeParameters_Response& rcl_interfaces::srv::DescribeParameters_Response::operator =( + DescribeParameters_Response&& x) noexcept +{ + + m_descriptors = std::move(x.m_descriptors); + + return *this; +} + +bool rcl_interfaces::srv::DescribeParameters_Response::operator ==( + const DescribeParameters_Response& x) const +{ + + return (m_descriptors == x.m_descriptors); +} + +bool rcl_interfaces::srv::DescribeParameters_Response::operator !=( + const DescribeParameters_Response& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::srv::DescribeParameters_Response::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < 100; ++a) + { + current_alignment += rcl_interfaces::msg::ParameterDescriptor::getMaxCdrSerializedSize(current_alignment);} + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::srv::DescribeParameters_Response::getCdrSerializedSize( + const rcl_interfaces::srv::DescribeParameters_Response& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < data.descriptors().size(); ++a) + { + current_alignment += rcl_interfaces::msg::ParameterDescriptor::getCdrSerializedSize(data.descriptors().at(a), current_alignment);} + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::srv::DescribeParameters_Response::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_descriptors; +} + +void rcl_interfaces::srv::DescribeParameters_Response::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_descriptors;} + +/*! + * @brief This function copies the value in member descriptors + * @param _descriptors New value to be copied in member descriptors + */ +void rcl_interfaces::srv::DescribeParameters_Response::descriptors( + const std::vector& _descriptors) +{ + m_descriptors = _descriptors; +} + +/*! + * @brief This function moves the value in member descriptors + * @param _descriptors New value to be moved in member descriptors + */ +void rcl_interfaces::srv::DescribeParameters_Response::descriptors( + std::vector&& _descriptors) +{ + m_descriptors = std::move(_descriptors); +} + +/*! + * @brief This function returns a constant reference to member descriptors + * @return Constant reference to member descriptors + */ +const std::vector& rcl_interfaces::srv::DescribeParameters_Response::descriptors() const +{ + return m_descriptors; +} + +/*! + * @brief This function returns a reference to member descriptors + * @return Reference to member descriptors + */ +std::vector& rcl_interfaces::srv::DescribeParameters_Response::descriptors() +{ + return m_descriptors; +} + +size_t rcl_interfaces::srv::DescribeParameters_Response::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + return current_align; +} + +bool rcl_interfaces::srv::DescribeParameters_Response::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::srv::DescribeParameters_Response::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + + diff --git a/third-party/realdds/src/topics/ros2/DescribeParametersPubSubTypes.cpp b/third-party/realdds/src/topics/ros2/DescribeParametersPubSubTypes.cpp new file mode 100644 index 0000000000..87d1ed7667 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/DescribeParametersPubSubTypes.cpp @@ -0,0 +1,305 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file DescribeParametersPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +namespace rcl_interfaces { + namespace srv { + DescribeParameters_RequestPubSubType::DescribeParameters_RequestPubSubType() + { + setName("rcl_interfaces::srv::dds_::DescribeParameters_Request_"); + auto type_size = DescribeParameters_Request::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = DescribeParameters_Request::isKeyDefined(); + size_t keyLength = DescribeParameters_Request::getKeyMaxCdrSerializedSize() > 16 ? + DescribeParameters_Request::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + DescribeParameters_RequestPubSubType::~DescribeParameters_RequestPubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool DescribeParameters_RequestPubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + DescribeParameters_Request* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool DescribeParameters_RequestPubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + DescribeParameters_Request* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function DescribeParameters_RequestPubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* DescribeParameters_RequestPubSubType::createData() + { + return reinterpret_cast(new DescribeParameters_Request()); + } + + void DescribeParameters_RequestPubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool DescribeParameters_RequestPubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + DescribeParameters_Request* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + DescribeParameters_Request::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || DescribeParameters_Request::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + DescribeParameters_ResponsePubSubType::DescribeParameters_ResponsePubSubType() + { + setName("rcl_interfaces::srv::dds_::DescribeParameters_Response_"); + auto type_size = DescribeParameters_Response::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = DescribeParameters_Response::isKeyDefined(); + size_t keyLength = DescribeParameters_Response::getKeyMaxCdrSerializedSize() > 16 ? + DescribeParameters_Response::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + DescribeParameters_ResponsePubSubType::~DescribeParameters_ResponsePubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool DescribeParameters_ResponsePubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + DescribeParameters_Response* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool DescribeParameters_ResponsePubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + DescribeParameters_Response* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function DescribeParameters_ResponsePubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* DescribeParameters_ResponsePubSubType::createData() + { + return reinterpret_cast(new DescribeParameters_Response()); + } + + void DescribeParameters_ResponsePubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool DescribeParameters_ResponsePubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + DescribeParameters_Response* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + DescribeParameters_Response::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || DescribeParameters_Response::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + + } //End of namespace srv + +} //End of namespace rcl_interfaces diff --git a/third-party/realdds/src/topics/ros2/FloatingPointRange.cpp b/third-party/realdds/src/topics/ros2/FloatingPointRange.cpp new file mode 100644 index 0000000000..81c0489be9 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/FloatingPointRange.cpp @@ -0,0 +1,264 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file FloatingPointRange.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + +rcl_interfaces::msg::FloatingPointRange::FloatingPointRange() +{ + // m_from_value com.eprosima.idl.parser.typecode.PrimitiveTypeCode@365c30cc + m_from_value = 0.0; + // m_to_value com.eprosima.idl.parser.typecode.PrimitiveTypeCode@701fc37a + m_to_value = 0.0; + // m_step com.eprosima.idl.parser.typecode.PrimitiveTypeCode@4148db48 + m_step = 0.0; + +} + +rcl_interfaces::msg::FloatingPointRange::~FloatingPointRange() +{ + + + +} + +rcl_interfaces::msg::FloatingPointRange::FloatingPointRange( + const FloatingPointRange& x) +{ + m_from_value = x.m_from_value; + m_to_value = x.m_to_value; + m_step = x.m_step; +} + +rcl_interfaces::msg::FloatingPointRange::FloatingPointRange( + FloatingPointRange&& x) noexcept +{ + m_from_value = x.m_from_value; + m_to_value = x.m_to_value; + m_step = x.m_step; +} + +rcl_interfaces::msg::FloatingPointRange& rcl_interfaces::msg::FloatingPointRange::operator =( + const FloatingPointRange& x) +{ + + m_from_value = x.m_from_value; + m_to_value = x.m_to_value; + m_step = x.m_step; + + return *this; +} + +rcl_interfaces::msg::FloatingPointRange& rcl_interfaces::msg::FloatingPointRange::operator =( + FloatingPointRange&& x) noexcept +{ + + m_from_value = x.m_from_value; + m_to_value = x.m_to_value; + m_step = x.m_step; + + return *this; +} + +bool rcl_interfaces::msg::FloatingPointRange::operator ==( + const FloatingPointRange& x) const +{ + + return (m_from_value == x.m_from_value && m_to_value == x.m_to_value && m_step == x.m_step); +} + +bool rcl_interfaces::msg::FloatingPointRange::operator !=( + const FloatingPointRange& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::msg::FloatingPointRange::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::msg::FloatingPointRange::getCdrSerializedSize( + const rcl_interfaces::msg::FloatingPointRange& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::msg::FloatingPointRange::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_from_value; + scdr << m_to_value; + scdr << m_step; + +} + +void rcl_interfaces::msg::FloatingPointRange::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_from_value; + dcdr >> m_to_value; + dcdr >> m_step; +} + +/*! + * @brief This function sets a value in member from_value + * @param _from_value New value for member from_value + */ +void rcl_interfaces::msg::FloatingPointRange::from_value( + double _from_value) +{ + m_from_value = _from_value; +} + +/*! + * @brief This function returns the value of member from_value + * @return Value of member from_value + */ +double rcl_interfaces::msg::FloatingPointRange::from_value() const +{ + return m_from_value; +} + +/*! + * @brief This function returns a reference to member from_value + * @return Reference to member from_value + */ +double& rcl_interfaces::msg::FloatingPointRange::from_value() +{ + return m_from_value; +} + +/*! + * @brief This function sets a value in member to_value + * @param _to_value New value for member to_value + */ +void rcl_interfaces::msg::FloatingPointRange::to_value( + double _to_value) +{ + m_to_value = _to_value; +} + +/*! + * @brief This function returns the value of member to_value + * @return Value of member to_value + */ +double rcl_interfaces::msg::FloatingPointRange::to_value() const +{ + return m_to_value; +} + +/*! + * @brief This function returns a reference to member to_value + * @return Reference to member to_value + */ +double& rcl_interfaces::msg::FloatingPointRange::to_value() +{ + return m_to_value; +} + +/*! + * @brief This function sets a value in member step + * @param _step New value for member step + */ +void rcl_interfaces::msg::FloatingPointRange::step( + double _step) +{ + m_step = _step; +} + +/*! + * @brief This function returns the value of member step + * @return Value of member step + */ +double rcl_interfaces::msg::FloatingPointRange::step() const +{ + return m_step; +} + +/*! + * @brief This function returns a reference to member step + * @return Reference to member step + */ +double& rcl_interfaces::msg::FloatingPointRange::step() +{ + return m_step; +} + + +size_t rcl_interfaces::msg::FloatingPointRange::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + + + + return current_align; +} + +bool rcl_interfaces::msg::FloatingPointRange::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::msg::FloatingPointRange::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + + diff --git a/third-party/realdds/src/topics/ros2/FloatingPointRangePubSubTypes.cpp b/third-party/realdds/src/topics/ros2/FloatingPointRangePubSubTypes.cpp new file mode 100644 index 0000000000..158e23c382 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/FloatingPointRangePubSubTypes.cpp @@ -0,0 +1,165 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file FloatingPointRangePubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +namespace rcl_interfaces { + namespace msg { + FloatingPointRangePubSubType::FloatingPointRangePubSubType() + { + setName("rcl_interfaces::msg::dds_::FloatingPointRange_"); + auto type_size = FloatingPointRange::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = FloatingPointRange::isKeyDefined(); + size_t keyLength = FloatingPointRange::getKeyMaxCdrSerializedSize() > 16 ? + FloatingPointRange::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + FloatingPointRangePubSubType::~FloatingPointRangePubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool FloatingPointRangePubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + FloatingPointRange* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool FloatingPointRangePubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + FloatingPointRange* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function FloatingPointRangePubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* FloatingPointRangePubSubType::createData() + { + return reinterpret_cast(new FloatingPointRange()); + } + + void FloatingPointRangePubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool FloatingPointRangePubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + FloatingPointRange* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + FloatingPointRange::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || FloatingPointRange::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + + } //End of namespace msg + +} //End of namespace rcl_interfaces diff --git a/third-party/realdds/src/topics/ros2/GetParameters.cpp b/third-party/realdds/src/topics/ros2/GetParameters.cpp new file mode 100644 index 0000000000..96fcfb221f --- /dev/null +++ b/third-party/realdds/src/topics/ros2/GetParameters.cpp @@ -0,0 +1,349 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file GetParameters.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + +rcl_interfaces::srv::GetParameters_Request::GetParameters_Request() +{ + // m_names com.eprosima.idl.parser.typecode.SequenceTypeCode@32eebfca + + +} + +rcl_interfaces::srv::GetParameters_Request::~GetParameters_Request() +{ +} + +rcl_interfaces::srv::GetParameters_Request::GetParameters_Request( + const GetParameters_Request& x) +{ + m_names = x.m_names; +} + +rcl_interfaces::srv::GetParameters_Request::GetParameters_Request( + GetParameters_Request&& x) noexcept +{ + m_names = std::move(x.m_names); +} + +rcl_interfaces::srv::GetParameters_Request& rcl_interfaces::srv::GetParameters_Request::operator =( + const GetParameters_Request& x) +{ + + m_names = x.m_names; + + return *this; +} + +rcl_interfaces::srv::GetParameters_Request& rcl_interfaces::srv::GetParameters_Request::operator =( + GetParameters_Request&& x) noexcept +{ + + m_names = std::move(x.m_names); + + return *this; +} + +bool rcl_interfaces::srv::GetParameters_Request::operator ==( + const GetParameters_Request& x) const +{ + + return (m_names == x.m_names); +} + +bool rcl_interfaces::srv::GetParameters_Request::operator !=( + const GetParameters_Request& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::srv::GetParameters_Request::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < 100; ++a) + { + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + } + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::srv::GetParameters_Request::getCdrSerializedSize( + const rcl_interfaces::srv::GetParameters_Request& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < data.names().size(); ++a) + { + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + + data.names().at(a).size() + 1; + } + return current_alignment - initial_alignment; +} + +void rcl_interfaces::srv::GetParameters_Request::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_names; +} + +void rcl_interfaces::srv::GetParameters_Request::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_names;} + +/*! + * @brief This function copies the value in member names + * @param _names New value to be copied in member names + */ +void rcl_interfaces::srv::GetParameters_Request::names( + const std::vector& _names) +{ + m_names = _names; +} + +/*! + * @brief This function moves the value in member names + * @param _names New value to be moved in member names + */ +void rcl_interfaces::srv::GetParameters_Request::names( + std::vector&& _names) +{ + m_names = std::move(_names); +} + +/*! + * @brief This function returns a constant reference to member names + * @return Constant reference to member names + */ +const std::vector& rcl_interfaces::srv::GetParameters_Request::names() const +{ + return m_names; +} + +/*! + * @brief This function returns a reference to member names + * @return Reference to member names + */ +std::vector& rcl_interfaces::srv::GetParameters_Request::names() +{ + return m_names; +} + +size_t rcl_interfaces::srv::GetParameters_Request::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + return current_align; +} + +bool rcl_interfaces::srv::GetParameters_Request::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::srv::GetParameters_Request::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + +rcl_interfaces::srv::GetParameters_Response::GetParameters_Response() +{ + // m_values com.eprosima.idl.parser.typecode.SequenceTypeCode@4fcd19b3 + + +} + +rcl_interfaces::srv::GetParameters_Response::~GetParameters_Response() +{ +} + +rcl_interfaces::srv::GetParameters_Response::GetParameters_Response( + const GetParameters_Response& x) +{ + m_values = x.m_values; +} + +rcl_interfaces::srv::GetParameters_Response::GetParameters_Response( + GetParameters_Response&& x) noexcept +{ + m_values = std::move(x.m_values); +} + +rcl_interfaces::srv::GetParameters_Response& rcl_interfaces::srv::GetParameters_Response::operator =( + const GetParameters_Response& x) +{ + + m_values = x.m_values; + + return *this; +} + +rcl_interfaces::srv::GetParameters_Response& rcl_interfaces::srv::GetParameters_Response::operator =( + GetParameters_Response&& x) noexcept +{ + + m_values = std::move(x.m_values); + + return *this; +} + +bool rcl_interfaces::srv::GetParameters_Response::operator ==( + const GetParameters_Response& x) const +{ + + return (m_values == x.m_values); +} + +bool rcl_interfaces::srv::GetParameters_Response::operator !=( + const GetParameters_Response& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::srv::GetParameters_Response::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < 100; ++a) + { + current_alignment += rcl_interfaces::msg::ParameterValue::getMaxCdrSerializedSize(current_alignment);} + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::srv::GetParameters_Response::getCdrSerializedSize( + const rcl_interfaces::srv::GetParameters_Response& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < data.values().size(); ++a) + { + current_alignment += rcl_interfaces::msg::ParameterValue::getCdrSerializedSize(data.values().at(a), current_alignment);} + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::srv::GetParameters_Response::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_values; +} + +void rcl_interfaces::srv::GetParameters_Response::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_values;} + +/*! + * @brief This function copies the value in member values + * @param _values New value to be copied in member values + */ +void rcl_interfaces::srv::GetParameters_Response::values( + const std::vector& _values) +{ + m_values = _values; +} + +/*! + * @brief This function moves the value in member values + * @param _values New value to be moved in member values + */ +void rcl_interfaces::srv::GetParameters_Response::values( + std::vector&& _values) +{ + m_values = std::move(_values); +} + +/*! + * @brief This function returns a constant reference to member values + * @return Constant reference to member values + */ +const std::vector& rcl_interfaces::srv::GetParameters_Response::values() const +{ + return m_values; +} + +/*! + * @brief This function returns a reference to member values + * @return Reference to member values + */ +std::vector& rcl_interfaces::srv::GetParameters_Response::values() +{ + return m_values; +} + +size_t rcl_interfaces::srv::GetParameters_Response::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + return current_align; +} + +bool rcl_interfaces::srv::GetParameters_Response::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::srv::GetParameters_Response::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + + diff --git a/third-party/realdds/src/topics/ros2/GetParametersPubSubTypes.cpp b/third-party/realdds/src/topics/ros2/GetParametersPubSubTypes.cpp new file mode 100644 index 0000000000..63b69cbd91 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/GetParametersPubSubTypes.cpp @@ -0,0 +1,305 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file GetParametersPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +namespace rcl_interfaces { + namespace srv { + GetParameters_RequestPubSubType::GetParameters_RequestPubSubType() + { + setName("rcl_interfaces::srv::dds_::GetParameters_Request_"); + auto type_size = GetParameters_Request::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = GetParameters_Request::isKeyDefined(); + size_t keyLength = GetParameters_Request::getKeyMaxCdrSerializedSize() > 16 ? + GetParameters_Request::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + GetParameters_RequestPubSubType::~GetParameters_RequestPubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool GetParameters_RequestPubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + GetParameters_Request* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool GetParameters_RequestPubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + GetParameters_Request* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function GetParameters_RequestPubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* GetParameters_RequestPubSubType::createData() + { + return reinterpret_cast(new GetParameters_Request()); + } + + void GetParameters_RequestPubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool GetParameters_RequestPubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + GetParameters_Request* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + GetParameters_Request::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || GetParameters_Request::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + GetParameters_ResponsePubSubType::GetParameters_ResponsePubSubType() + { + setName("rcl_interfaces::srv::dds_::GetParameters_Response_"); + auto type_size = GetParameters_Response::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = GetParameters_Response::isKeyDefined(); + size_t keyLength = GetParameters_Response::getKeyMaxCdrSerializedSize() > 16 ? + GetParameters_Response::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + GetParameters_ResponsePubSubType::~GetParameters_ResponsePubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool GetParameters_ResponsePubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + GetParameters_Response* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool GetParameters_ResponsePubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + GetParameters_Response* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function GetParameters_ResponsePubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* GetParameters_ResponsePubSubType::createData() + { + return reinterpret_cast(new GetParameters_Response()); + } + + void GetParameters_ResponsePubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool GetParameters_ResponsePubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + GetParameters_Response* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + GetParameters_Response::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || GetParameters_Response::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + + } //End of namespace srv + +} //End of namespace rcl_interfaces diff --git a/third-party/realdds/src/topics/ros2/IntegerRange.cpp b/third-party/realdds/src/topics/ros2/IntegerRange.cpp new file mode 100644 index 0000000000..e5a479557e --- /dev/null +++ b/third-party/realdds/src/topics/ros2/IntegerRange.cpp @@ -0,0 +1,264 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file IntegerRange.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + +rcl_interfaces::msg::IntegerRange::IntegerRange() +{ + // m_from_value com.eprosima.idl.parser.typecode.PrimitiveTypeCode@2f490758 + m_from_value = 0; + // m_to_value com.eprosima.idl.parser.typecode.PrimitiveTypeCode@101df177 + m_to_value = 0; + // m_step com.eprosima.idl.parser.typecode.PrimitiveTypeCode@166fa74d + m_step = 0; + +} + +rcl_interfaces::msg::IntegerRange::~IntegerRange() +{ + + + +} + +rcl_interfaces::msg::IntegerRange::IntegerRange( + const IntegerRange& x) +{ + m_from_value = x.m_from_value; + m_to_value = x.m_to_value; + m_step = x.m_step; +} + +rcl_interfaces::msg::IntegerRange::IntegerRange( + IntegerRange&& x) noexcept +{ + m_from_value = x.m_from_value; + m_to_value = x.m_to_value; + m_step = x.m_step; +} + +rcl_interfaces::msg::IntegerRange& rcl_interfaces::msg::IntegerRange::operator =( + const IntegerRange& x) +{ + + m_from_value = x.m_from_value; + m_to_value = x.m_to_value; + m_step = x.m_step; + + return *this; +} + +rcl_interfaces::msg::IntegerRange& rcl_interfaces::msg::IntegerRange::operator =( + IntegerRange&& x) noexcept +{ + + m_from_value = x.m_from_value; + m_to_value = x.m_to_value; + m_step = x.m_step; + + return *this; +} + +bool rcl_interfaces::msg::IntegerRange::operator ==( + const IntegerRange& x) const +{ + + return (m_from_value == x.m_from_value && m_to_value == x.m_to_value && m_step == x.m_step); +} + +bool rcl_interfaces::msg::IntegerRange::operator !=( + const IntegerRange& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::msg::IntegerRange::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::msg::IntegerRange::getCdrSerializedSize( + const rcl_interfaces::msg::IntegerRange& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::msg::IntegerRange::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_from_value; + scdr << m_to_value; + scdr << m_step; + +} + +void rcl_interfaces::msg::IntegerRange::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_from_value; + dcdr >> m_to_value; + dcdr >> m_step; +} + +/*! + * @brief This function sets a value in member from_value + * @param _from_value New value for member from_value + */ +void rcl_interfaces::msg::IntegerRange::from_value( + int64_t _from_value) +{ + m_from_value = _from_value; +} + +/*! + * @brief This function returns the value of member from_value + * @return Value of member from_value + */ +int64_t rcl_interfaces::msg::IntegerRange::from_value() const +{ + return m_from_value; +} + +/*! + * @brief This function returns a reference to member from_value + * @return Reference to member from_value + */ +int64_t& rcl_interfaces::msg::IntegerRange::from_value() +{ + return m_from_value; +} + +/*! + * @brief This function sets a value in member to_value + * @param _to_value New value for member to_value + */ +void rcl_interfaces::msg::IntegerRange::to_value( + int64_t _to_value) +{ + m_to_value = _to_value; +} + +/*! + * @brief This function returns the value of member to_value + * @return Value of member to_value + */ +int64_t rcl_interfaces::msg::IntegerRange::to_value() const +{ + return m_to_value; +} + +/*! + * @brief This function returns a reference to member to_value + * @return Reference to member to_value + */ +int64_t& rcl_interfaces::msg::IntegerRange::to_value() +{ + return m_to_value; +} + +/*! + * @brief This function sets a value in member step + * @param _step New value for member step + */ +void rcl_interfaces::msg::IntegerRange::step( + uint64_t _step) +{ + m_step = _step; +} + +/*! + * @brief This function returns the value of member step + * @return Value of member step + */ +uint64_t rcl_interfaces::msg::IntegerRange::step() const +{ + return m_step; +} + +/*! + * @brief This function returns a reference to member step + * @return Reference to member step + */ +uint64_t& rcl_interfaces::msg::IntegerRange::step() +{ + return m_step; +} + + +size_t rcl_interfaces::msg::IntegerRange::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + + + + return current_align; +} + +bool rcl_interfaces::msg::IntegerRange::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::msg::IntegerRange::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + + diff --git a/third-party/realdds/src/topics/ros2/IntegerRangePubSubTypes.cpp b/third-party/realdds/src/topics/ros2/IntegerRangePubSubTypes.cpp new file mode 100644 index 0000000000..1e5373faf7 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/IntegerRangePubSubTypes.cpp @@ -0,0 +1,165 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file IntegerRangePubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +namespace rcl_interfaces { + namespace msg { + IntegerRangePubSubType::IntegerRangePubSubType() + { + setName("rcl_interfaces::msg::dds_::IntegerRange_"); + auto type_size = IntegerRange::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = IntegerRange::isKeyDefined(); + size_t keyLength = IntegerRange::getKeyMaxCdrSerializedSize() > 16 ? + IntegerRange::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + IntegerRangePubSubType::~IntegerRangePubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool IntegerRangePubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + IntegerRange* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool IntegerRangePubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + IntegerRange* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function IntegerRangePubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* IntegerRangePubSubType::createData() + { + return reinterpret_cast(new IntegerRange()); + } + + void IntegerRangePubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool IntegerRangePubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + IntegerRange* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + IntegerRange::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || IntegerRange::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + + } //End of namespace msg + +} //End of namespace rcl_interfaces diff --git a/third-party/realdds/src/topics/ros2/ListParameters.cpp b/third-party/realdds/src/topics/ros2/ListParameters.cpp new file mode 100644 index 0000000000..178ae31271 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/ListParameters.cpp @@ -0,0 +1,392 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ListParameters.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + + +rcl_interfaces::srv::ListParameters_Request::ListParameters_Request() +{ + // m_prefixes com.eprosima.idl.parser.typecode.SequenceTypeCode@7e0e6aa2 + + // m_depth com.eprosima.idl.parser.typecode.PrimitiveTypeCode@18bf3d14 + m_depth = 0; + +} + +rcl_interfaces::srv::ListParameters_Request::~ListParameters_Request() +{ + + +} + +rcl_interfaces::srv::ListParameters_Request::ListParameters_Request( + const ListParameters_Request& x) +{ + m_prefixes = x.m_prefixes; + m_depth = x.m_depth; +} + +rcl_interfaces::srv::ListParameters_Request::ListParameters_Request( + ListParameters_Request&& x) noexcept +{ + m_prefixes = std::move(x.m_prefixes); + m_depth = x.m_depth; +} + +rcl_interfaces::srv::ListParameters_Request& rcl_interfaces::srv::ListParameters_Request::operator =( + const ListParameters_Request& x) +{ + + m_prefixes = x.m_prefixes; + m_depth = x.m_depth; + + return *this; +} + +rcl_interfaces::srv::ListParameters_Request& rcl_interfaces::srv::ListParameters_Request::operator =( + ListParameters_Request&& x) noexcept +{ + + m_prefixes = std::move(x.m_prefixes); + m_depth = x.m_depth; + + return *this; +} + +bool rcl_interfaces::srv::ListParameters_Request::operator ==( + const ListParameters_Request& x) const +{ + + return (m_prefixes == x.m_prefixes && m_depth == x.m_depth); +} + +bool rcl_interfaces::srv::ListParameters_Request::operator !=( + const ListParameters_Request& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::srv::ListParameters_Request::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < 100; ++a) + { + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + } + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::srv::ListParameters_Request::getCdrSerializedSize( + const rcl_interfaces::srv::ListParameters_Request& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < data.prefixes().size(); ++a) + { + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + + data.prefixes().at(a).size() + 1; + } + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::srv::ListParameters_Request::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_prefixes; + scdr << m_depth; + +} + +void rcl_interfaces::srv::ListParameters_Request::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_prefixes; + dcdr >> m_depth; +} + +/*! + * @brief This function copies the value in member prefixes + * @param _prefixes New value to be copied in member prefixes + */ +void rcl_interfaces::srv::ListParameters_Request::prefixes( + const std::vector& _prefixes) +{ + m_prefixes = _prefixes; +} + +/*! + * @brief This function moves the value in member prefixes + * @param _prefixes New value to be moved in member prefixes + */ +void rcl_interfaces::srv::ListParameters_Request::prefixes( + std::vector&& _prefixes) +{ + m_prefixes = std::move(_prefixes); +} + +/*! + * @brief This function returns a constant reference to member prefixes + * @return Constant reference to member prefixes + */ +const std::vector& rcl_interfaces::srv::ListParameters_Request::prefixes() const +{ + return m_prefixes; +} + +/*! + * @brief This function returns a reference to member prefixes + * @return Reference to member prefixes + */ +std::vector& rcl_interfaces::srv::ListParameters_Request::prefixes() +{ + return m_prefixes; +} +/*! + * @brief This function sets a value in member depth + * @param _depth New value for member depth + */ +void rcl_interfaces::srv::ListParameters_Request::depth( + uint64_t _depth) +{ + m_depth = _depth; +} + +/*! + * @brief This function returns the value of member depth + * @return Value of member depth + */ +uint64_t rcl_interfaces::srv::ListParameters_Request::depth() const +{ + return m_depth; +} + +/*! + * @brief This function returns a reference to member depth + * @return Reference to member depth + */ +uint64_t& rcl_interfaces::srv::ListParameters_Request::depth() +{ + return m_depth; +} + + +size_t rcl_interfaces::srv::ListParameters_Request::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + + + return current_align; +} + +bool rcl_interfaces::srv::ListParameters_Request::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::srv::ListParameters_Request::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + +rcl_interfaces::srv::ListParameters_Response::ListParameters_Response() +{ + // m_result com.eprosima.fastdds.idl.parser.typecode.StructTypeCode@58134517 + + +} + +rcl_interfaces::srv::ListParameters_Response::~ListParameters_Response() +{ +} + +rcl_interfaces::srv::ListParameters_Response::ListParameters_Response( + const ListParameters_Response& x) +{ + m_result = x.m_result; +} + +rcl_interfaces::srv::ListParameters_Response::ListParameters_Response( + ListParameters_Response&& x) noexcept +{ + m_result = std::move(x.m_result); +} + +rcl_interfaces::srv::ListParameters_Response& rcl_interfaces::srv::ListParameters_Response::operator =( + const ListParameters_Response& x) +{ + + m_result = x.m_result; + + return *this; +} + +rcl_interfaces::srv::ListParameters_Response& rcl_interfaces::srv::ListParameters_Response::operator =( + ListParameters_Response&& x) noexcept +{ + + m_result = std::move(x.m_result); + + return *this; +} + +bool rcl_interfaces::srv::ListParameters_Response::operator ==( + const ListParameters_Response& x) const +{ + + return (m_result == x.m_result); +} + +bool rcl_interfaces::srv::ListParameters_Response::operator !=( + const ListParameters_Response& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::srv::ListParameters_Response::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += rcl_interfaces::msg::ListParametersResult::getMaxCdrSerializedSize(current_alignment); + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::srv::ListParameters_Response::getCdrSerializedSize( + const rcl_interfaces::srv::ListParameters_Response& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += rcl_interfaces::msg::ListParametersResult::getCdrSerializedSize(data.result(), current_alignment); + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::srv::ListParameters_Response::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_result; + +} + +void rcl_interfaces::srv::ListParameters_Response::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_result; +} + +/*! + * @brief This function copies the value in member result + * @param _result New value to be copied in member result + */ +void rcl_interfaces::srv::ListParameters_Response::result( + const rcl_interfaces::msg::ListParametersResult& _result) +{ + m_result = _result; +} + +/*! + * @brief This function moves the value in member result + * @param _result New value to be moved in member result + */ +void rcl_interfaces::srv::ListParameters_Response::result( + rcl_interfaces::msg::ListParametersResult&& _result) +{ + m_result = std::move(_result); +} + +/*! + * @brief This function returns a constant reference to member result + * @return Constant reference to member result + */ +const rcl_interfaces::msg::ListParametersResult& rcl_interfaces::srv::ListParameters_Response::result() const +{ + return m_result; +} + +/*! + * @brief This function returns a reference to member result + * @return Reference to member result + */ +rcl_interfaces::msg::ListParametersResult& rcl_interfaces::srv::ListParameters_Response::result() +{ + return m_result; +} + +size_t rcl_interfaces::srv::ListParameters_Response::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + return current_align; +} + +bool rcl_interfaces::srv::ListParameters_Response::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::srv::ListParameters_Response::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + + diff --git a/third-party/realdds/src/topics/ros2/ListParametersPubSubTypes.cpp b/third-party/realdds/src/topics/ros2/ListParametersPubSubTypes.cpp new file mode 100644 index 0000000000..7b316a092a --- /dev/null +++ b/third-party/realdds/src/topics/ros2/ListParametersPubSubTypes.cpp @@ -0,0 +1,307 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ListParametersPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +namespace rcl_interfaces { + namespace srv { + namespace ListParameters_Request_Constants { + } //End of namespace ListParameters_Request_Constants + ListParameters_RequestPubSubType::ListParameters_RequestPubSubType() + { + setName("rcl_interfaces::srv::dds_::ListParameters_Request_"); + auto type_size = ListParameters_Request::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = ListParameters_Request::isKeyDefined(); + size_t keyLength = ListParameters_Request::getKeyMaxCdrSerializedSize() > 16 ? + ListParameters_Request::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + ListParameters_RequestPubSubType::~ListParameters_RequestPubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool ListParameters_RequestPubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + ListParameters_Request* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool ListParameters_RequestPubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + ListParameters_Request* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function ListParameters_RequestPubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* ListParameters_RequestPubSubType::createData() + { + return reinterpret_cast(new ListParameters_Request()); + } + + void ListParameters_RequestPubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool ListParameters_RequestPubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + ListParameters_Request* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + ListParameters_Request::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || ListParameters_Request::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + ListParameters_ResponsePubSubType::ListParameters_ResponsePubSubType() + { + setName("rcl_interfaces::srv::dds_::ListParameters_Response_"); + auto type_size = ListParameters_Response::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = ListParameters_Response::isKeyDefined(); + size_t keyLength = ListParameters_Response::getKeyMaxCdrSerializedSize() > 16 ? + ListParameters_Response::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + ListParameters_ResponsePubSubType::~ListParameters_ResponsePubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool ListParameters_ResponsePubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + ListParameters_Response* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool ListParameters_ResponsePubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + ListParameters_Response* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function ListParameters_ResponsePubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* ListParameters_ResponsePubSubType::createData() + { + return reinterpret_cast(new ListParameters_Response()); + } + + void ListParameters_ResponsePubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool ListParameters_ResponsePubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + ListParameters_Response* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + ListParameters_Response::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || ListParameters_Response::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + + } //End of namespace srv + +} //End of namespace rcl_interfaces diff --git a/third-party/realdds/src/topics/ros2/ListParametersResult.cpp b/third-party/realdds/src/topics/ros2/ListParametersResult.cpp new file mode 100644 index 0000000000..aa376a2375 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/ListParametersResult.cpp @@ -0,0 +1,255 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ListParametersResult.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + +rcl_interfaces::msg::ListParametersResult::ListParametersResult() +{ + // m_names com.eprosima.idl.parser.typecode.SequenceTypeCode@7f9fcf7f + + // m_prefixes com.eprosima.idl.parser.typecode.SequenceTypeCode@2357d90a + + +} + +rcl_interfaces::msg::ListParametersResult::~ListParametersResult() +{ + + +} + +rcl_interfaces::msg::ListParametersResult::ListParametersResult( + const ListParametersResult& x) +{ + m_names = x.m_names; + m_prefixes = x.m_prefixes; +} + +rcl_interfaces::msg::ListParametersResult::ListParametersResult( + ListParametersResult&& x) noexcept +{ + m_names = std::move(x.m_names); + m_prefixes = std::move(x.m_prefixes); +} + +rcl_interfaces::msg::ListParametersResult& rcl_interfaces::msg::ListParametersResult::operator =( + const ListParametersResult& x) +{ + + m_names = x.m_names; + m_prefixes = x.m_prefixes; + + return *this; +} + +rcl_interfaces::msg::ListParametersResult& rcl_interfaces::msg::ListParametersResult::operator =( + ListParametersResult&& x) noexcept +{ + + m_names = std::move(x.m_names); + m_prefixes = std::move(x.m_prefixes); + + return *this; +} + +bool rcl_interfaces::msg::ListParametersResult::operator ==( + const ListParametersResult& x) const +{ + + return (m_names == x.m_names && m_prefixes == x.m_prefixes); +} + +bool rcl_interfaces::msg::ListParametersResult::operator !=( + const ListParametersResult& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::msg::ListParametersResult::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < 100; ++a) + { + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + } + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < 100; ++a) + { + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + } + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::msg::ListParametersResult::getCdrSerializedSize( + const rcl_interfaces::msg::ListParametersResult& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < data.names().size(); ++a) + { + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + + data.names().at(a).size() + 1; + } + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < data.prefixes().size(); ++a) + { + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + + data.prefixes().at(a).size() + 1; + } + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::msg::ListParametersResult::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_names; + scdr << m_prefixes; +} + +void rcl_interfaces::msg::ListParametersResult::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_names; + dcdr >> m_prefixes; +} + +/*! + * @brief This function copies the value in member names + * @param _names New value to be copied in member names + */ +void rcl_interfaces::msg::ListParametersResult::names( + const std::vector& _names) +{ + m_names = _names; +} + +/*! + * @brief This function moves the value in member names + * @param _names New value to be moved in member names + */ +void rcl_interfaces::msg::ListParametersResult::names( + std::vector&& _names) +{ + m_names = std::move(_names); +} + +/*! + * @brief This function returns a constant reference to member names + * @return Constant reference to member names + */ +const std::vector& rcl_interfaces::msg::ListParametersResult::names() const +{ + return m_names; +} + +/*! + * @brief This function returns a reference to member names + * @return Reference to member names + */ +std::vector& rcl_interfaces::msg::ListParametersResult::names() +{ + return m_names; +} +/*! + * @brief This function copies the value in member prefixes + * @param _prefixes New value to be copied in member prefixes + */ +void rcl_interfaces::msg::ListParametersResult::prefixes( + const std::vector& _prefixes) +{ + m_prefixes = _prefixes; +} + +/*! + * @brief This function moves the value in member prefixes + * @param _prefixes New value to be moved in member prefixes + */ +void rcl_interfaces::msg::ListParametersResult::prefixes( + std::vector&& _prefixes) +{ + m_prefixes = std::move(_prefixes); +} + +/*! + * @brief This function returns a constant reference to member prefixes + * @return Constant reference to member prefixes + */ +const std::vector& rcl_interfaces::msg::ListParametersResult::prefixes() const +{ + return m_prefixes; +} + +/*! + * @brief This function returns a reference to member prefixes + * @return Reference to member prefixes + */ +std::vector& rcl_interfaces::msg::ListParametersResult::prefixes() +{ + return m_prefixes; +} + +size_t rcl_interfaces::msg::ListParametersResult::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + + + return current_align; +} + +bool rcl_interfaces::msg::ListParametersResult::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::msg::ListParametersResult::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + + diff --git a/third-party/realdds/src/topics/ros2/ListParametersResultPubSubTypes.cpp b/third-party/realdds/src/topics/ros2/ListParametersResultPubSubTypes.cpp new file mode 100644 index 0000000000..8fc01a1493 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/ListParametersResultPubSubTypes.cpp @@ -0,0 +1,165 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ListParametersResultPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +namespace rcl_interfaces { + namespace msg { + ListParametersResultPubSubType::ListParametersResultPubSubType() + { + setName("rcl_interfaces::msg::dds_::ListParametersResult_"); + auto type_size = ListParametersResult::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = ListParametersResult::isKeyDefined(); + size_t keyLength = ListParametersResult::getKeyMaxCdrSerializedSize() > 16 ? + ListParametersResult::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + ListParametersResultPubSubType::~ListParametersResultPubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool ListParametersResultPubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + ListParametersResult* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool ListParametersResultPubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + ListParametersResult* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function ListParametersResultPubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* ListParametersResultPubSubType::createData() + { + return reinterpret_cast(new ListParametersResult()); + } + + void ListParametersResultPubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool ListParametersResultPubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + ListParametersResult* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + ListParametersResult::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || ListParametersResult::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + + } //End of namespace msg + +} //End of namespace rcl_interfaces diff --git a/third-party/realdds/src/topics/ros2/Parameter.cpp b/third-party/realdds/src/topics/ros2/Parameter.cpp new file mode 100644 index 0000000000..5517957909 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/Parameter.cpp @@ -0,0 +1,232 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file Parameter.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + +rcl_interfaces::msg::Parameter::Parameter() +{ + // m_name com.eprosima.idl.parser.typecode.StringTypeCode@19dc67c2 + m_name =""; + // m_value com.eprosima.fastdds.idl.parser.typecode.StructTypeCode@62bd765 + + +} + +rcl_interfaces::msg::Parameter::~Parameter() +{ + + +} + +rcl_interfaces::msg::Parameter::Parameter( + const Parameter& x) +{ + m_name = x.m_name; + m_value = x.m_value; +} + +rcl_interfaces::msg::Parameter::Parameter( + Parameter&& x) noexcept +{ + m_name = std::move(x.m_name); + m_value = std::move(x.m_value); +} + +rcl_interfaces::msg::Parameter& rcl_interfaces::msg::Parameter::operator =( + const Parameter& x) +{ + + m_name = x.m_name; + m_value = x.m_value; + + return *this; +} + +rcl_interfaces::msg::Parameter& rcl_interfaces::msg::Parameter::operator =( + Parameter&& x) noexcept +{ + + m_name = std::move(x.m_name); + m_value = std::move(x.m_value); + + return *this; +} + +bool rcl_interfaces::msg::Parameter::operator ==( + const Parameter& x) const +{ + + return (m_name == x.m_name && m_value == x.m_value); +} + +bool rcl_interfaces::msg::Parameter::operator !=( + const Parameter& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::msg::Parameter::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + + current_alignment += rcl_interfaces::msg::ParameterValue::getMaxCdrSerializedSize(current_alignment); + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::msg::Parameter::getCdrSerializedSize( + const rcl_interfaces::msg::Parameter& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.name().size() + 1; + + current_alignment += rcl_interfaces::msg::ParameterValue::getCdrSerializedSize(data.value(), current_alignment); + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::msg::Parameter::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_name.c_str(); + scdr << m_value; + +} + +void rcl_interfaces::msg::Parameter::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_name; + dcdr >> m_value; +} + +/*! + * @brief This function copies the value in member name + * @param _name New value to be copied in member name + */ +void rcl_interfaces::msg::Parameter::name( + const std::string& _name) +{ + m_name = _name; +} + +/*! + * @brief This function moves the value in member name + * @param _name New value to be moved in member name + */ +void rcl_interfaces::msg::Parameter::name( + std::string&& _name) +{ + m_name = std::move(_name); +} + +/*! + * @brief This function returns a constant reference to member name + * @return Constant reference to member name + */ +const std::string& rcl_interfaces::msg::Parameter::name() const +{ + return m_name; +} + +/*! + * @brief This function returns a reference to member name + * @return Reference to member name + */ +std::string& rcl_interfaces::msg::Parameter::name() +{ + return m_name; +} +/*! + * @brief This function copies the value in member value + * @param _value New value to be copied in member value + */ +void rcl_interfaces::msg::Parameter::value( + const rcl_interfaces::msg::ParameterValue& _value) +{ + m_value = _value; +} + +/*! + * @brief This function moves the value in member value + * @param _value New value to be moved in member value + */ +void rcl_interfaces::msg::Parameter::value( + rcl_interfaces::msg::ParameterValue&& _value) +{ + m_value = std::move(_value); +} + +/*! + * @brief This function returns a constant reference to member value + * @return Constant reference to member value + */ +const rcl_interfaces::msg::ParameterValue& rcl_interfaces::msg::Parameter::value() const +{ + return m_value; +} + +/*! + * @brief This function returns a reference to member value + * @return Reference to member value + */ +rcl_interfaces::msg::ParameterValue& rcl_interfaces::msg::Parameter::value() +{ + return m_value; +} + +size_t rcl_interfaces::msg::Parameter::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + + + return current_align; +} + +bool rcl_interfaces::msg::Parameter::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::msg::Parameter::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + + diff --git a/third-party/realdds/src/topics/ros2/ParameterDescriptor.cpp b/third-party/realdds/src/topics/ros2/ParameterDescriptor.cpp new file mode 100644 index 0000000000..b4b63b81f3 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/ParameterDescriptor.cpp @@ -0,0 +1,539 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterDescriptor.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + +rcl_interfaces::msg::ParameterDescriptor::ParameterDescriptor() +{ + // m_name com.eprosima.idl.parser.typecode.StringTypeCode@5fcd892a + m_name =""; + // m_type com.eprosima.idl.parser.typecode.PrimitiveTypeCode@8b87145 + m_type = 0; + // m_description com.eprosima.idl.parser.typecode.StringTypeCode@6483f5ae + m_description =""; + // m_additional_constraints com.eprosima.idl.parser.typecode.StringTypeCode@b9afc07 + m_additional_constraints =""; + // m_read_only com.eprosima.idl.parser.typecode.PrimitiveTypeCode@382db087 + m_read_only = false; + // m_dynamic_typing com.eprosima.idl.parser.typecode.PrimitiveTypeCode@73d4cc9e + m_dynamic_typing = false; + // m_floating_point_range com.eprosima.idl.parser.typecode.SequenceTypeCode@80169cf + + // m_integer_range com.eprosima.idl.parser.typecode.SequenceTypeCode@5427c60c + + +} + +rcl_interfaces::msg::ParameterDescriptor::~ParameterDescriptor() +{ + + + + + + + + +} + +rcl_interfaces::msg::ParameterDescriptor::ParameterDescriptor( + const ParameterDescriptor& x) +{ + m_name = x.m_name; + m_type = x.m_type; + m_description = x.m_description; + m_additional_constraints = x.m_additional_constraints; + m_read_only = x.m_read_only; + m_dynamic_typing = x.m_dynamic_typing; + m_floating_point_range = x.m_floating_point_range; + m_integer_range = x.m_integer_range; +} + +rcl_interfaces::msg::ParameterDescriptor::ParameterDescriptor( + ParameterDescriptor&& x) noexcept +{ + m_name = std::move(x.m_name); + m_type = x.m_type; + m_description = std::move(x.m_description); + m_additional_constraints = std::move(x.m_additional_constraints); + m_read_only = x.m_read_only; + m_dynamic_typing = x.m_dynamic_typing; + m_floating_point_range = std::move(x.m_floating_point_range); + m_integer_range = std::move(x.m_integer_range); +} + +rcl_interfaces::msg::ParameterDescriptor& rcl_interfaces::msg::ParameterDescriptor::operator =( + const ParameterDescriptor& x) +{ + + m_name = x.m_name; + m_type = x.m_type; + m_description = x.m_description; + m_additional_constraints = x.m_additional_constraints; + m_read_only = x.m_read_only; + m_dynamic_typing = x.m_dynamic_typing; + m_floating_point_range = x.m_floating_point_range; + m_integer_range = x.m_integer_range; + + return *this; +} + +rcl_interfaces::msg::ParameterDescriptor& rcl_interfaces::msg::ParameterDescriptor::operator =( + ParameterDescriptor&& x) noexcept +{ + + m_name = std::move(x.m_name); + m_type = x.m_type; + m_description = std::move(x.m_description); + m_additional_constraints = std::move(x.m_additional_constraints); + m_read_only = x.m_read_only; + m_dynamic_typing = x.m_dynamic_typing; + m_floating_point_range = std::move(x.m_floating_point_range); + m_integer_range = std::move(x.m_integer_range); + + return *this; +} + +bool rcl_interfaces::msg::ParameterDescriptor::operator ==( + const ParameterDescriptor& x) const +{ + + return (m_name == x.m_name && m_type == x.m_type && m_description == x.m_description && m_additional_constraints == x.m_additional_constraints && m_read_only == x.m_read_only && m_dynamic_typing == x.m_dynamic_typing && m_floating_point_range == x.m_floating_point_range && m_integer_range == x.m_integer_range); +} + +bool rcl_interfaces::msg::ParameterDescriptor::operator !=( + const ParameterDescriptor& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::msg::ParameterDescriptor::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < 1; ++a) + { + current_alignment += rcl_interfaces::msg::FloatingPointRange::getMaxCdrSerializedSize(current_alignment);} + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < 1; ++a) + { + current_alignment += rcl_interfaces::msg::IntegerRange::getMaxCdrSerializedSize(current_alignment);} + + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::msg::ParameterDescriptor::getCdrSerializedSize( + const rcl_interfaces::msg::ParameterDescriptor& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.name().size() + 1; + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.description().size() + 1; + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.additional_constraints().size() + 1; + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < data.floating_point_range().size(); ++a) + { + current_alignment += rcl_interfaces::msg::FloatingPointRange::getCdrSerializedSize(data.floating_point_range().at(a), current_alignment);} + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < data.integer_range().size(); ++a) + { + current_alignment += rcl_interfaces::msg::IntegerRange::getCdrSerializedSize(data.integer_range().at(a), current_alignment);} + + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::msg::ParameterDescriptor::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_name.c_str(); + scdr << m_type; + scdr << m_description.c_str(); + scdr << m_additional_constraints.c_str(); + scdr << m_read_only; + scdr << m_dynamic_typing; + scdr << m_floating_point_range; + scdr << m_integer_range; + +} + +void rcl_interfaces::msg::ParameterDescriptor::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_name; + dcdr >> m_type; + dcdr >> m_description; + dcdr >> m_additional_constraints; + dcdr >> m_read_only; + dcdr >> m_dynamic_typing; + dcdr >> m_floating_point_range; + dcdr >> m_integer_range; +} + +/*! + * @brief This function copies the value in member name + * @param _name New value to be copied in member name + */ +void rcl_interfaces::msg::ParameterDescriptor::name( + const std::string& _name) +{ + m_name = _name; +} + +/*! + * @brief This function moves the value in member name + * @param _name New value to be moved in member name + */ +void rcl_interfaces::msg::ParameterDescriptor::name( + std::string&& _name) +{ + m_name = std::move(_name); +} + +/*! + * @brief This function returns a constant reference to member name + * @return Constant reference to member name + */ +const std::string& rcl_interfaces::msg::ParameterDescriptor::name() const +{ + return m_name; +} + +/*! + * @brief This function returns a reference to member name + * @return Reference to member name + */ +std::string& rcl_interfaces::msg::ParameterDescriptor::name() +{ + return m_name; +} +/*! + * @brief This function sets a value in member type + * @param _type New value for member type + */ +void rcl_interfaces::msg::ParameterDescriptor::type( + uint8_t _type) +{ + m_type = _type; +} + +/*! + * @brief This function returns the value of member type + * @return Value of member type + */ +uint8_t rcl_interfaces::msg::ParameterDescriptor::type() const +{ + return m_type; +} + +/*! + * @brief This function returns a reference to member type + * @return Reference to member type + */ +uint8_t& rcl_interfaces::msg::ParameterDescriptor::type() +{ + return m_type; +} + +/*! + * @brief This function copies the value in member description + * @param _description New value to be copied in member description + */ +void rcl_interfaces::msg::ParameterDescriptor::description( + const std::string& _description) +{ + m_description = _description; +} + +/*! + * @brief This function moves the value in member description + * @param _description New value to be moved in member description + */ +void rcl_interfaces::msg::ParameterDescriptor::description( + std::string&& _description) +{ + m_description = std::move(_description); +} + +/*! + * @brief This function returns a constant reference to member description + * @return Constant reference to member description + */ +const std::string& rcl_interfaces::msg::ParameterDescriptor::description() const +{ + return m_description; +} + +/*! + * @brief This function returns a reference to member description + * @return Reference to member description + */ +std::string& rcl_interfaces::msg::ParameterDescriptor::description() +{ + return m_description; +} +/*! + * @brief This function copies the value in member additional_constraints + * @param _additional_constraints New value to be copied in member additional_constraints + */ +void rcl_interfaces::msg::ParameterDescriptor::additional_constraints( + const std::string& _additional_constraints) +{ + m_additional_constraints = _additional_constraints; +} + +/*! + * @brief This function moves the value in member additional_constraints + * @param _additional_constraints New value to be moved in member additional_constraints + */ +void rcl_interfaces::msg::ParameterDescriptor::additional_constraints( + std::string&& _additional_constraints) +{ + m_additional_constraints = std::move(_additional_constraints); +} + +/*! + * @brief This function returns a constant reference to member additional_constraints + * @return Constant reference to member additional_constraints + */ +const std::string& rcl_interfaces::msg::ParameterDescriptor::additional_constraints() const +{ + return m_additional_constraints; +} + +/*! + * @brief This function returns a reference to member additional_constraints + * @return Reference to member additional_constraints + */ +std::string& rcl_interfaces::msg::ParameterDescriptor::additional_constraints() +{ + return m_additional_constraints; +} +/*! + * @brief This function sets a value in member read_only + * @param _read_only New value for member read_only + */ +void rcl_interfaces::msg::ParameterDescriptor::read_only( + bool _read_only) +{ + m_read_only = _read_only; +} + +/*! + * @brief This function returns the value of member read_only + * @return Value of member read_only + */ +bool rcl_interfaces::msg::ParameterDescriptor::read_only() const +{ + return m_read_only; +} + +/*! + * @brief This function returns a reference to member read_only + * @return Reference to member read_only + */ +bool& rcl_interfaces::msg::ParameterDescriptor::read_only() +{ + return m_read_only; +} + +/*! + * @brief This function sets a value in member dynamic_typing + * @param _dynamic_typing New value for member dynamic_typing + */ +void rcl_interfaces::msg::ParameterDescriptor::dynamic_typing( + bool _dynamic_typing) +{ + m_dynamic_typing = _dynamic_typing; +} + +/*! + * @brief This function returns the value of member dynamic_typing + * @return Value of member dynamic_typing + */ +bool rcl_interfaces::msg::ParameterDescriptor::dynamic_typing() const +{ + return m_dynamic_typing; +} + +/*! + * @brief This function returns a reference to member dynamic_typing + * @return Reference to member dynamic_typing + */ +bool& rcl_interfaces::msg::ParameterDescriptor::dynamic_typing() +{ + return m_dynamic_typing; +} + +/*! + * @brief This function copies the value in member floating_point_range + * @param _floating_point_range New value to be copied in member floating_point_range + */ +void rcl_interfaces::msg::ParameterDescriptor::floating_point_range( + const std::vector& _floating_point_range) +{ + m_floating_point_range = _floating_point_range; +} + +/*! + * @brief This function moves the value in member floating_point_range + * @param _floating_point_range New value to be moved in member floating_point_range + */ +void rcl_interfaces::msg::ParameterDescriptor::floating_point_range( + std::vector&& _floating_point_range) +{ + m_floating_point_range = std::move(_floating_point_range); +} + +/*! + * @brief This function returns a constant reference to member floating_point_range + * @return Constant reference to member floating_point_range + */ +const std::vector& rcl_interfaces::msg::ParameterDescriptor::floating_point_range() const +{ + return m_floating_point_range; +} + +/*! + * @brief This function returns a reference to member floating_point_range + * @return Reference to member floating_point_range + */ +std::vector& rcl_interfaces::msg::ParameterDescriptor::floating_point_range() +{ + return m_floating_point_range; +} +/*! + * @brief This function copies the value in member integer_range + * @param _integer_range New value to be copied in member integer_range + */ +void rcl_interfaces::msg::ParameterDescriptor::integer_range( + const std::vector& _integer_range) +{ + m_integer_range = _integer_range; +} + +/*! + * @brief This function moves the value in member integer_range + * @param _integer_range New value to be moved in member integer_range + */ +void rcl_interfaces::msg::ParameterDescriptor::integer_range( + std::vector&& _integer_range) +{ + m_integer_range = std::move(_integer_range); +} + +/*! + * @brief This function returns a constant reference to member integer_range + * @return Constant reference to member integer_range + */ +const std::vector& rcl_interfaces::msg::ParameterDescriptor::integer_range() const +{ + return m_integer_range; +} + +/*! + * @brief This function returns a reference to member integer_range + * @return Reference to member integer_range + */ +std::vector& rcl_interfaces::msg::ParameterDescriptor::integer_range() +{ + return m_integer_range; +} + +size_t rcl_interfaces::msg::ParameterDescriptor::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + + + + + + + + + return current_align; +} + +bool rcl_interfaces::msg::ParameterDescriptor::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::msg::ParameterDescriptor::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + + diff --git a/third-party/realdds/src/topics/ros2/ParameterDescriptorPubSubTypes.cpp b/third-party/realdds/src/topics/ros2/ParameterDescriptorPubSubTypes.cpp new file mode 100644 index 0000000000..ef81d7ef64 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/ParameterDescriptorPubSubTypes.cpp @@ -0,0 +1,165 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterDescriptorPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +namespace rcl_interfaces { + namespace msg { + ParameterDescriptorPubSubType::ParameterDescriptorPubSubType() + { + setName("rcl_interfaces::msg::dds_::ParameterDescriptor_"); + auto type_size = ParameterDescriptor::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = ParameterDescriptor::isKeyDefined(); + size_t keyLength = ParameterDescriptor::getKeyMaxCdrSerializedSize() > 16 ? + ParameterDescriptor::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + ParameterDescriptorPubSubType::~ParameterDescriptorPubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool ParameterDescriptorPubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + ParameterDescriptor* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool ParameterDescriptorPubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + ParameterDescriptor* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function ParameterDescriptorPubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* ParameterDescriptorPubSubType::createData() + { + return reinterpret_cast(new ParameterDescriptor()); + } + + void ParameterDescriptorPubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool ParameterDescriptorPubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + ParameterDescriptor* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + ParameterDescriptor::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || ParameterDescriptor::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + + } //End of namespace msg + +} //End of namespace rcl_interfaces diff --git a/third-party/realdds/src/topics/ros2/ParameterPubSubTypes.cpp b/third-party/realdds/src/topics/ros2/ParameterPubSubTypes.cpp new file mode 100644 index 0000000000..69ec882deb --- /dev/null +++ b/third-party/realdds/src/topics/ros2/ParameterPubSubTypes.cpp @@ -0,0 +1,165 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +namespace rcl_interfaces { + namespace msg { + ParameterPubSubType::ParameterPubSubType() + { + setName("rcl_interfaces::msg::dds_::Parameter_"); + auto type_size = Parameter::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = Parameter::isKeyDefined(); + size_t keyLength = Parameter::getKeyMaxCdrSerializedSize() > 16 ? + Parameter::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + ParameterPubSubType::~ParameterPubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool ParameterPubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + Parameter* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool ParameterPubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + Parameter* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function ParameterPubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* ParameterPubSubType::createData() + { + return reinterpret_cast(new Parameter()); + } + + void ParameterPubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool ParameterPubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + Parameter* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + Parameter::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || Parameter::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + + } //End of namespace msg + +} //End of namespace rcl_interfaces diff --git a/third-party/realdds/src/topics/ros2/ParameterType.cpp b/third-party/realdds/src/topics/ros2/ParameterType.cpp new file mode 100644 index 0000000000..bacab60015 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/ParameterType.cpp @@ -0,0 +1,183 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterType.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + + + + + + + + + + + + +rcl_interfaces::msg::ParameterType::ParameterType() +{ + // m_structure_needs_at_least_one_member com.eprosima.idl.parser.typecode.PrimitiveTypeCode@4d3167f4 + m_structure_needs_at_least_one_member = 0; + +} + +rcl_interfaces::msg::ParameterType::~ParameterType() +{ +} + +rcl_interfaces::msg::ParameterType::ParameterType( + const ParameterType& x) +{ + m_structure_needs_at_least_one_member = x.m_structure_needs_at_least_one_member; +} + +rcl_interfaces::msg::ParameterType::ParameterType( + ParameterType&& x) noexcept +{ + m_structure_needs_at_least_one_member = x.m_structure_needs_at_least_one_member; +} + +rcl_interfaces::msg::ParameterType& rcl_interfaces::msg::ParameterType::operator =( + const ParameterType& x) +{ + + m_structure_needs_at_least_one_member = x.m_structure_needs_at_least_one_member; + + return *this; +} + +rcl_interfaces::msg::ParameterType& rcl_interfaces::msg::ParameterType::operator =( + ParameterType&& x) noexcept +{ + + m_structure_needs_at_least_one_member = x.m_structure_needs_at_least_one_member; + + return *this; +} + +bool rcl_interfaces::msg::ParameterType::operator ==( + const ParameterType& x) const +{ + + return (m_structure_needs_at_least_one_member == x.m_structure_needs_at_least_one_member); +} + +bool rcl_interfaces::msg::ParameterType::operator !=( + const ParameterType& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::msg::ParameterType::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::msg::ParameterType::getCdrSerializedSize( + const rcl_interfaces::msg::ParameterType& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::msg::ParameterType::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_structure_needs_at_least_one_member; + +} + +void rcl_interfaces::msg::ParameterType::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_structure_needs_at_least_one_member; +} + +/*! + * @brief This function sets a value in member structure_needs_at_least_one_member + * @param _structure_needs_at_least_one_member New value for member structure_needs_at_least_one_member + */ +void rcl_interfaces::msg::ParameterType::structure_needs_at_least_one_member( + uint8_t _structure_needs_at_least_one_member) +{ + m_structure_needs_at_least_one_member = _structure_needs_at_least_one_member; +} + +/*! + * @brief This function returns the value of member structure_needs_at_least_one_member + * @return Value of member structure_needs_at_least_one_member + */ +uint8_t rcl_interfaces::msg::ParameterType::structure_needs_at_least_one_member() const +{ + return m_structure_needs_at_least_one_member; +} + +/*! + * @brief This function returns a reference to member structure_needs_at_least_one_member + * @return Reference to member structure_needs_at_least_one_member + */ +uint8_t& rcl_interfaces::msg::ParameterType::structure_needs_at_least_one_member() +{ + return m_structure_needs_at_least_one_member; +} + + +size_t rcl_interfaces::msg::ParameterType::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + return current_align; +} + +bool rcl_interfaces::msg::ParameterType::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::msg::ParameterType::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + + diff --git a/third-party/realdds/src/topics/ros2/ParameterTypePubSubTypes.cpp b/third-party/realdds/src/topics/ros2/ParameterTypePubSubTypes.cpp new file mode 100644 index 0000000000..4687aeda4f --- /dev/null +++ b/third-party/realdds/src/topics/ros2/ParameterTypePubSubTypes.cpp @@ -0,0 +1,178 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterTypePubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +namespace rcl_interfaces { + namespace msg { + namespace ParameterType_Constants { + + + + + + + + + + + + } //End of namespace ParameterType_Constants + ParameterTypePubSubType::ParameterTypePubSubType() + { + setName("rcl_interfaces::msg::dds_::ParameterType_"); + auto type_size = ParameterType::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = ParameterType::isKeyDefined(); + size_t keyLength = ParameterType::getKeyMaxCdrSerializedSize() > 16 ? + ParameterType::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + ParameterTypePubSubType::~ParameterTypePubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool ParameterTypePubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + ParameterType* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool ParameterTypePubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + ParameterType* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function ParameterTypePubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* ParameterTypePubSubType::createData() + { + return reinterpret_cast(new ParameterType()); + } + + void ParameterTypePubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool ParameterTypePubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + ParameterType* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + ParameterType::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || ParameterType::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + + } //End of namespace msg + +} //End of namespace rcl_interfaces diff --git a/third-party/realdds/src/topics/ros2/ParameterValue.cpp b/third-party/realdds/src/topics/ros2/ParameterValue.cpp new file mode 100644 index 0000000000..1a91f7c9ed --- /dev/null +++ b/third-party/realdds/src/topics/ros2/ParameterValue.cpp @@ -0,0 +1,669 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterValue.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + +rcl_interfaces::msg::ParameterValue::ParameterValue() +{ + // m_type com.eprosima.idl.parser.typecode.PrimitiveTypeCode@2b4a2ec7 + m_type = 0; + // m_bool_value com.eprosima.idl.parser.typecode.PrimitiveTypeCode@564718df + m_bool_value = false; + // m_integer_value com.eprosima.idl.parser.typecode.PrimitiveTypeCode@51b7e5df + m_integer_value = 0; + // m_double_value com.eprosima.idl.parser.typecode.PrimitiveTypeCode@18a70f16 + m_double_value = 0.0; + // m_string_value com.eprosima.idl.parser.typecode.StringTypeCode@62e136d3 + m_string_value =""; + // m_byte_array_value com.eprosima.idl.parser.typecode.SequenceTypeCode@c8e4bb0 + + // m_bool_array_value com.eprosima.idl.parser.typecode.SequenceTypeCode@6279cee3 + + // m_integer_array_value com.eprosima.idl.parser.typecode.SequenceTypeCode@4206a205 + + // m_double_array_value com.eprosima.idl.parser.typecode.SequenceTypeCode@29ba4338 + + // m_string_array_value com.eprosima.idl.parser.typecode.SequenceTypeCode@57175e74 + + +} + +rcl_interfaces::msg::ParameterValue::~ParameterValue() +{ + + + + + + + + + + +} + +rcl_interfaces::msg::ParameterValue::ParameterValue( + const ParameterValue& x) +{ + m_type = x.m_type; + m_bool_value = x.m_bool_value; + m_integer_value = x.m_integer_value; + m_double_value = x.m_double_value; + m_string_value = x.m_string_value; + m_byte_array_value = x.m_byte_array_value; + m_bool_array_value = x.m_bool_array_value; + m_integer_array_value = x.m_integer_array_value; + m_double_array_value = x.m_double_array_value; + m_string_array_value = x.m_string_array_value; +} + +rcl_interfaces::msg::ParameterValue::ParameterValue( + ParameterValue&& x) noexcept +{ + m_type = x.m_type; + m_bool_value = x.m_bool_value; + m_integer_value = x.m_integer_value; + m_double_value = x.m_double_value; + m_string_value = std::move(x.m_string_value); + m_byte_array_value = std::move(x.m_byte_array_value); + m_bool_array_value = std::move(x.m_bool_array_value); + m_integer_array_value = std::move(x.m_integer_array_value); + m_double_array_value = std::move(x.m_double_array_value); + m_string_array_value = std::move(x.m_string_array_value); +} + +rcl_interfaces::msg::ParameterValue& rcl_interfaces::msg::ParameterValue::operator =( + const ParameterValue& x) +{ + + m_type = x.m_type; + m_bool_value = x.m_bool_value; + m_integer_value = x.m_integer_value; + m_double_value = x.m_double_value; + m_string_value = x.m_string_value; + m_byte_array_value = x.m_byte_array_value; + m_bool_array_value = x.m_bool_array_value; + m_integer_array_value = x.m_integer_array_value; + m_double_array_value = x.m_double_array_value; + m_string_array_value = x.m_string_array_value; + + return *this; +} + +rcl_interfaces::msg::ParameterValue& rcl_interfaces::msg::ParameterValue::operator =( + ParameterValue&& x) noexcept +{ + + m_type = x.m_type; + m_bool_value = x.m_bool_value; + m_integer_value = x.m_integer_value; + m_double_value = x.m_double_value; + m_string_value = std::move(x.m_string_value); + m_byte_array_value = std::move(x.m_byte_array_value); + m_bool_array_value = std::move(x.m_bool_array_value); + m_integer_array_value = std::move(x.m_integer_array_value); + m_double_array_value = std::move(x.m_double_array_value); + m_string_array_value = std::move(x.m_string_array_value); + + return *this; +} + +bool rcl_interfaces::msg::ParameterValue::operator ==( + const ParameterValue& x) const +{ + + return (m_type == x.m_type && m_bool_value == x.m_bool_value && m_integer_value == x.m_integer_value && m_double_value == x.m_double_value && m_string_value == x.m_string_value && m_byte_array_value == x.m_byte_array_value && m_bool_array_value == x.m_bool_array_value && m_integer_array_value == x.m_integer_array_value && m_double_array_value == x.m_double_array_value && m_string_array_value == x.m_string_array_value); +} + +bool rcl_interfaces::msg::ParameterValue::operator !=( + const ParameterValue& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::msg::ParameterValue::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + current_alignment += (100 * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + current_alignment += (100 * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + current_alignment += (100 * 8) + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + current_alignment += (100 * 8) + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < 100; ++a) + { + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + } + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::msg::ParameterValue::getCdrSerializedSize( + const rcl_interfaces::msg::ParameterValue& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.string_value().size() + 1; + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + if (data.byte_array_value().size() > 0) + { + current_alignment += (data.byte_array_value().size() * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + } + + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + if (data.bool_array_value().size() > 0) + { + current_alignment += (data.bool_array_value().size() * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + } + + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + if (data.integer_array_value().size() > 0) + { + current_alignment += (data.integer_array_value().size() * 8) + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + } + + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + if (data.double_array_value().size() > 0) + { + current_alignment += (data.double_array_value().size() * 8) + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); + } + + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < data.string_array_value().size(); ++a) + { + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + + data.string_array_value().at(a).size() + 1; + } + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::msg::ParameterValue::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_type; + scdr << m_bool_value; + scdr << m_integer_value; + scdr << m_double_value; + scdr << m_string_value.c_str(); + scdr << m_byte_array_value; + scdr << m_bool_array_value; + scdr << m_integer_array_value; + scdr << m_double_array_value; + scdr << m_string_array_value; + +} + +void rcl_interfaces::msg::ParameterValue::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_type; + dcdr >> m_bool_value; + dcdr >> m_integer_value; + dcdr >> m_double_value; + dcdr >> m_string_value; + dcdr >> m_byte_array_value; + dcdr >> m_bool_array_value; + dcdr >> m_integer_array_value; + dcdr >> m_double_array_value; + dcdr >> m_string_array_value; +} + +/*! + * @brief This function sets a value in member type + * @param _type New value for member type + */ +void rcl_interfaces::msg::ParameterValue::type( + uint8_t _type) +{ + m_type = _type; +} + +/*! + * @brief This function returns the value of member type + * @return Value of member type + */ +uint8_t rcl_interfaces::msg::ParameterValue::type() const +{ + return m_type; +} + +/*! + * @brief This function returns a reference to member type + * @return Reference to member type + */ +uint8_t& rcl_interfaces::msg::ParameterValue::type() +{ + return m_type; +} + +/*! + * @brief This function sets a value in member bool_value + * @param _bool_value New value for member bool_value + */ +void rcl_interfaces::msg::ParameterValue::bool_value( + bool _bool_value) +{ + m_bool_value = _bool_value; +} + +/*! + * @brief This function returns the value of member bool_value + * @return Value of member bool_value + */ +bool rcl_interfaces::msg::ParameterValue::bool_value() const +{ + return m_bool_value; +} + +/*! + * @brief This function returns a reference to member bool_value + * @return Reference to member bool_value + */ +bool& rcl_interfaces::msg::ParameterValue::bool_value() +{ + return m_bool_value; +} + +/*! + * @brief This function sets a value in member integer_value + * @param _integer_value New value for member integer_value + */ +void rcl_interfaces::msg::ParameterValue::integer_value( + int64_t _integer_value) +{ + m_integer_value = _integer_value; +} + +/*! + * @brief This function returns the value of member integer_value + * @return Value of member integer_value + */ +int64_t rcl_interfaces::msg::ParameterValue::integer_value() const +{ + return m_integer_value; +} + +/*! + * @brief This function returns a reference to member integer_value + * @return Reference to member integer_value + */ +int64_t& rcl_interfaces::msg::ParameterValue::integer_value() +{ + return m_integer_value; +} + +/*! + * @brief This function sets a value in member double_value + * @param _double_value New value for member double_value + */ +void rcl_interfaces::msg::ParameterValue::double_value( + double _double_value) +{ + m_double_value = _double_value; +} + +/*! + * @brief This function returns the value of member double_value + * @return Value of member double_value + */ +double rcl_interfaces::msg::ParameterValue::double_value() const +{ + return m_double_value; +} + +/*! + * @brief This function returns a reference to member double_value + * @return Reference to member double_value + */ +double& rcl_interfaces::msg::ParameterValue::double_value() +{ + return m_double_value; +} + +/*! + * @brief This function copies the value in member string_value + * @param _string_value New value to be copied in member string_value + */ +void rcl_interfaces::msg::ParameterValue::string_value( + const std::string& _string_value) +{ + m_string_value = _string_value; +} + +/*! + * @brief This function moves the value in member string_value + * @param _string_value New value to be moved in member string_value + */ +void rcl_interfaces::msg::ParameterValue::string_value( + std::string&& _string_value) +{ + m_string_value = std::move(_string_value); +} + +/*! + * @brief This function returns a constant reference to member string_value + * @return Constant reference to member string_value + */ +const std::string& rcl_interfaces::msg::ParameterValue::string_value() const +{ + return m_string_value; +} + +/*! + * @brief This function returns a reference to member string_value + * @return Reference to member string_value + */ +std::string& rcl_interfaces::msg::ParameterValue::string_value() +{ + return m_string_value; +} +/*! + * @brief This function copies the value in member byte_array_value + * @param _byte_array_value New value to be copied in member byte_array_value + */ +void rcl_interfaces::msg::ParameterValue::byte_array_value( + const std::vector& _byte_array_value) +{ + m_byte_array_value = _byte_array_value; +} + +/*! + * @brief This function moves the value in member byte_array_value + * @param _byte_array_value New value to be moved in member byte_array_value + */ +void rcl_interfaces::msg::ParameterValue::byte_array_value( + std::vector&& _byte_array_value) +{ + m_byte_array_value = std::move(_byte_array_value); +} + +/*! + * @brief This function returns a constant reference to member byte_array_value + * @return Constant reference to member byte_array_value + */ +const std::vector& rcl_interfaces::msg::ParameterValue::byte_array_value() const +{ + return m_byte_array_value; +} + +/*! + * @brief This function returns a reference to member byte_array_value + * @return Reference to member byte_array_value + */ +std::vector& rcl_interfaces::msg::ParameterValue::byte_array_value() +{ + return m_byte_array_value; +} +/*! + * @brief This function copies the value in member bool_array_value + * @param _bool_array_value New value to be copied in member bool_array_value + */ +void rcl_interfaces::msg::ParameterValue::bool_array_value( + const std::vector& _bool_array_value) +{ + m_bool_array_value = _bool_array_value; +} + +/*! + * @brief This function moves the value in member bool_array_value + * @param _bool_array_value New value to be moved in member bool_array_value + */ +void rcl_interfaces::msg::ParameterValue::bool_array_value( + std::vector&& _bool_array_value) +{ + m_bool_array_value = std::move(_bool_array_value); +} + +/*! + * @brief This function returns a constant reference to member bool_array_value + * @return Constant reference to member bool_array_value + */ +const std::vector& rcl_interfaces::msg::ParameterValue::bool_array_value() const +{ + return m_bool_array_value; +} + +/*! + * @brief This function returns a reference to member bool_array_value + * @return Reference to member bool_array_value + */ +std::vector& rcl_interfaces::msg::ParameterValue::bool_array_value() +{ + return m_bool_array_value; +} +/*! + * @brief This function copies the value in member integer_array_value + * @param _integer_array_value New value to be copied in member integer_array_value + */ +void rcl_interfaces::msg::ParameterValue::integer_array_value( + const std::vector& _integer_array_value) +{ + m_integer_array_value = _integer_array_value; +} + +/*! + * @brief This function moves the value in member integer_array_value + * @param _integer_array_value New value to be moved in member integer_array_value + */ +void rcl_interfaces::msg::ParameterValue::integer_array_value( + std::vector&& _integer_array_value) +{ + m_integer_array_value = std::move(_integer_array_value); +} + +/*! + * @brief This function returns a constant reference to member integer_array_value + * @return Constant reference to member integer_array_value + */ +const std::vector& rcl_interfaces::msg::ParameterValue::integer_array_value() const +{ + return m_integer_array_value; +} + +/*! + * @brief This function returns a reference to member integer_array_value + * @return Reference to member integer_array_value + */ +std::vector& rcl_interfaces::msg::ParameterValue::integer_array_value() +{ + return m_integer_array_value; +} +/*! + * @brief This function copies the value in member double_array_value + * @param _double_array_value New value to be copied in member double_array_value + */ +void rcl_interfaces::msg::ParameterValue::double_array_value( + const std::vector& _double_array_value) +{ + m_double_array_value = _double_array_value; +} + +/*! + * @brief This function moves the value in member double_array_value + * @param _double_array_value New value to be moved in member double_array_value + */ +void rcl_interfaces::msg::ParameterValue::double_array_value( + std::vector&& _double_array_value) +{ + m_double_array_value = std::move(_double_array_value); +} + +/*! + * @brief This function returns a constant reference to member double_array_value + * @return Constant reference to member double_array_value + */ +const std::vector& rcl_interfaces::msg::ParameterValue::double_array_value() const +{ + return m_double_array_value; +} + +/*! + * @brief This function returns a reference to member double_array_value + * @return Reference to member double_array_value + */ +std::vector& rcl_interfaces::msg::ParameterValue::double_array_value() +{ + return m_double_array_value; +} +/*! + * @brief This function copies the value in member string_array_value + * @param _string_array_value New value to be copied in member string_array_value + */ +void rcl_interfaces::msg::ParameterValue::string_array_value( + const std::vector& _string_array_value) +{ + m_string_array_value = _string_array_value; +} + +/*! + * @brief This function moves the value in member string_array_value + * @param _string_array_value New value to be moved in member string_array_value + */ +void rcl_interfaces::msg::ParameterValue::string_array_value( + std::vector&& _string_array_value) +{ + m_string_array_value = std::move(_string_array_value); +} + +/*! + * @brief This function returns a constant reference to member string_array_value + * @return Constant reference to member string_array_value + */ +const std::vector& rcl_interfaces::msg::ParameterValue::string_array_value() const +{ + return m_string_array_value; +} + +/*! + * @brief This function returns a reference to member string_array_value + * @return Reference to member string_array_value + */ +std::vector& rcl_interfaces::msg::ParameterValue::string_array_value() +{ + return m_string_array_value; +} + +size_t rcl_interfaces::msg::ParameterValue::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + + + + + + + + + + + return current_align; +} + +bool rcl_interfaces::msg::ParameterValue::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::msg::ParameterValue::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + + diff --git a/third-party/realdds/src/topics/ros2/ParameterValuePubSubTypes.cpp b/third-party/realdds/src/topics/ros2/ParameterValuePubSubTypes.cpp new file mode 100644 index 0000000000..a038f3d405 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/ParameterValuePubSubTypes.cpp @@ -0,0 +1,165 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file ParameterValuePubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +namespace rcl_interfaces { + namespace msg { + ParameterValuePubSubType::ParameterValuePubSubType() + { + setName("rcl_interfaces::msg::dds_::ParameterValue_"); + auto type_size = ParameterValue::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = ParameterValue::isKeyDefined(); + size_t keyLength = ParameterValue::getKeyMaxCdrSerializedSize() > 16 ? + ParameterValue::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + ParameterValuePubSubType::~ParameterValuePubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool ParameterValuePubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + ParameterValue* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool ParameterValuePubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + ParameterValue* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function ParameterValuePubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* ParameterValuePubSubType::createData() + { + return reinterpret_cast(new ParameterValue()); + } + + void ParameterValuePubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool ParameterValuePubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + ParameterValue* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + ParameterValue::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || ParameterValue::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + + } //End of namespace msg + +} //End of namespace rcl_interfaces diff --git a/third-party/realdds/src/topics/ros2/SetParameters.cpp b/third-party/realdds/src/topics/ros2/SetParameters.cpp new file mode 100644 index 0000000000..457004ac11 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/SetParameters.cpp @@ -0,0 +1,348 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file SetParameters.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + +rcl_interfaces::srv::SetParameters_Request::SetParameters_Request() +{ + // m_parameters com.eprosima.idl.parser.typecode.SequenceTypeCode@23a5fd2 + + +} + +rcl_interfaces::srv::SetParameters_Request::~SetParameters_Request() +{ +} + +rcl_interfaces::srv::SetParameters_Request::SetParameters_Request( + const SetParameters_Request& x) +{ + m_parameters = x.m_parameters; +} + +rcl_interfaces::srv::SetParameters_Request::SetParameters_Request( + SetParameters_Request&& x) noexcept +{ + m_parameters = std::move(x.m_parameters); +} + +rcl_interfaces::srv::SetParameters_Request& rcl_interfaces::srv::SetParameters_Request::operator =( + const SetParameters_Request& x) +{ + + m_parameters = x.m_parameters; + + return *this; +} + +rcl_interfaces::srv::SetParameters_Request& rcl_interfaces::srv::SetParameters_Request::operator =( + SetParameters_Request&& x) noexcept +{ + + m_parameters = std::move(x.m_parameters); + + return *this; +} + +bool rcl_interfaces::srv::SetParameters_Request::operator ==( + const SetParameters_Request& x) const +{ + + return (m_parameters == x.m_parameters); +} + +bool rcl_interfaces::srv::SetParameters_Request::operator !=( + const SetParameters_Request& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::srv::SetParameters_Request::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < 100; ++a) + { + current_alignment += rcl_interfaces::msg::Parameter::getMaxCdrSerializedSize(current_alignment);} + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::srv::SetParameters_Request::getCdrSerializedSize( + const rcl_interfaces::srv::SetParameters_Request& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < data.parameters().size(); ++a) + { + current_alignment += rcl_interfaces::msg::Parameter::getCdrSerializedSize(data.parameters().at(a), current_alignment);} + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::srv::SetParameters_Request::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_parameters; +} + +void rcl_interfaces::srv::SetParameters_Request::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_parameters;} + +/*! + * @brief This function copies the value in member parameters + * @param _parameters New value to be copied in member parameters + */ +void rcl_interfaces::srv::SetParameters_Request::parameters( + const std::vector& _parameters) +{ + m_parameters = _parameters; +} + +/*! + * @brief This function moves the value in member parameters + * @param _parameters New value to be moved in member parameters + */ +void rcl_interfaces::srv::SetParameters_Request::parameters( + std::vector&& _parameters) +{ + m_parameters = std::move(_parameters); +} + +/*! + * @brief This function returns a constant reference to member parameters + * @return Constant reference to member parameters + */ +const std::vector& rcl_interfaces::srv::SetParameters_Request::parameters() const +{ + return m_parameters; +} + +/*! + * @brief This function returns a reference to member parameters + * @return Reference to member parameters + */ +std::vector& rcl_interfaces::srv::SetParameters_Request::parameters() +{ + return m_parameters; +} + +size_t rcl_interfaces::srv::SetParameters_Request::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + return current_align; +} + +bool rcl_interfaces::srv::SetParameters_Request::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::srv::SetParameters_Request::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + +rcl_interfaces::srv::SetParameters_Response::SetParameters_Response() +{ + // m_results com.eprosima.idl.parser.typecode.SequenceTypeCode@ba8d91c + + +} + +rcl_interfaces::srv::SetParameters_Response::~SetParameters_Response() +{ +} + +rcl_interfaces::srv::SetParameters_Response::SetParameters_Response( + const SetParameters_Response& x) +{ + m_results = x.m_results; +} + +rcl_interfaces::srv::SetParameters_Response::SetParameters_Response( + SetParameters_Response&& x) noexcept +{ + m_results = std::move(x.m_results); +} + +rcl_interfaces::srv::SetParameters_Response& rcl_interfaces::srv::SetParameters_Response::operator =( + const SetParameters_Response& x) +{ + + m_results = x.m_results; + + return *this; +} + +rcl_interfaces::srv::SetParameters_Response& rcl_interfaces::srv::SetParameters_Response::operator =( + SetParameters_Response&& x) noexcept +{ + + m_results = std::move(x.m_results); + + return *this; +} + +bool rcl_interfaces::srv::SetParameters_Response::operator ==( + const SetParameters_Response& x) const +{ + + return (m_results == x.m_results); +} + +bool rcl_interfaces::srv::SetParameters_Response::operator !=( + const SetParameters_Response& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::srv::SetParameters_Response::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < 100; ++a) + { + current_alignment += rcl_interfaces::msg::SetParametersResult::getMaxCdrSerializedSize(current_alignment);} + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::srv::SetParameters_Response::getCdrSerializedSize( + const rcl_interfaces::srv::SetParameters_Response& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + for(size_t a = 0; a < data.results().size(); ++a) + { + current_alignment += rcl_interfaces::msg::SetParametersResult::getCdrSerializedSize(data.results().at(a), current_alignment);} + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::srv::SetParameters_Response::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_results; +} + +void rcl_interfaces::srv::SetParameters_Response::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_results;} + +/*! + * @brief This function copies the value in member results + * @param _results New value to be copied in member results + */ +void rcl_interfaces::srv::SetParameters_Response::results( + const std::vector& _results) +{ + m_results = _results; +} + +/*! + * @brief This function moves the value in member results + * @param _results New value to be moved in member results + */ +void rcl_interfaces::srv::SetParameters_Response::results( + std::vector&& _results) +{ + m_results = std::move(_results); +} + +/*! + * @brief This function returns a constant reference to member results + * @return Constant reference to member results + */ +const std::vector& rcl_interfaces::srv::SetParameters_Response::results() const +{ + return m_results; +} + +/*! + * @brief This function returns a reference to member results + * @return Reference to member results + */ +std::vector& rcl_interfaces::srv::SetParameters_Response::results() +{ + return m_results; +} + +size_t rcl_interfaces::srv::SetParameters_Response::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + return current_align; +} + +bool rcl_interfaces::srv::SetParameters_Response::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::srv::SetParameters_Response::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + + diff --git a/third-party/realdds/src/topics/ros2/SetParametersPubSubTypes.cpp b/third-party/realdds/src/topics/ros2/SetParametersPubSubTypes.cpp new file mode 100644 index 0000000000..90f2162d71 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/SetParametersPubSubTypes.cpp @@ -0,0 +1,305 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file SetParametersPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +namespace rcl_interfaces { + namespace srv { + SetParameters_RequestPubSubType::SetParameters_RequestPubSubType() + { + setName("rcl_interfaces::srv::dds_::SetParameters_Request_"); + auto type_size = SetParameters_Request::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = SetParameters_Request::isKeyDefined(); + size_t keyLength = SetParameters_Request::getKeyMaxCdrSerializedSize() > 16 ? + SetParameters_Request::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + SetParameters_RequestPubSubType::~SetParameters_RequestPubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool SetParameters_RequestPubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + SetParameters_Request* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool SetParameters_RequestPubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + SetParameters_Request* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function SetParameters_RequestPubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* SetParameters_RequestPubSubType::createData() + { + return reinterpret_cast(new SetParameters_Request()); + } + + void SetParameters_RequestPubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool SetParameters_RequestPubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + SetParameters_Request* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + SetParameters_Request::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || SetParameters_Request::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + SetParameters_ResponsePubSubType::SetParameters_ResponsePubSubType() + { + setName("rcl_interfaces::srv::dds_::SetParameters_Response_"); + auto type_size = SetParameters_Response::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = SetParameters_Response::isKeyDefined(); + size_t keyLength = SetParameters_Response::getKeyMaxCdrSerializedSize() > 16 ? + SetParameters_Response::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + SetParameters_ResponsePubSubType::~SetParameters_ResponsePubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool SetParameters_ResponsePubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + SetParameters_Response* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool SetParameters_ResponsePubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + SetParameters_Response* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function SetParameters_ResponsePubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* SetParameters_ResponsePubSubType::createData() + { + return reinterpret_cast(new SetParameters_Response()); + } + + void SetParameters_ResponsePubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool SetParameters_ResponsePubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + SetParameters_Response* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + SetParameters_Response::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || SetParameters_Response::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + + } //End of namespace srv + +} //End of namespace rcl_interfaces diff --git a/third-party/realdds/src/topics/ros2/SetParametersResult.cpp b/third-party/realdds/src/topics/ros2/SetParametersResult.cpp new file mode 100644 index 0000000000..9b4b0b2ea8 --- /dev/null +++ b/third-party/realdds/src/topics/ros2/SetParametersResult.cpp @@ -0,0 +1,227 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file SetParametersResult.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + +rcl_interfaces::msg::SetParametersResult::SetParametersResult() +{ + // m_successful com.eprosima.idl.parser.typecode.PrimitiveTypeCode@564718df + m_successful = false; + // m_reason com.eprosima.idl.parser.typecode.StringTypeCode@51b7e5df + m_reason =""; + +} + +rcl_interfaces::msg::SetParametersResult::~SetParametersResult() +{ + + +} + +rcl_interfaces::msg::SetParametersResult::SetParametersResult( + const SetParametersResult& x) +{ + m_successful = x.m_successful; + m_reason = x.m_reason; +} + +rcl_interfaces::msg::SetParametersResult::SetParametersResult( + SetParametersResult&& x) noexcept +{ + m_successful = x.m_successful; + m_reason = std::move(x.m_reason); +} + +rcl_interfaces::msg::SetParametersResult& rcl_interfaces::msg::SetParametersResult::operator =( + const SetParametersResult& x) +{ + + m_successful = x.m_successful; + m_reason = x.m_reason; + + return *this; +} + +rcl_interfaces::msg::SetParametersResult& rcl_interfaces::msg::SetParametersResult::operator =( + SetParametersResult&& x) noexcept +{ + + m_successful = x.m_successful; + m_reason = std::move(x.m_reason); + + return *this; +} + +bool rcl_interfaces::msg::SetParametersResult::operator ==( + const SetParametersResult& x) const +{ + + return (m_successful == x.m_successful && m_reason == x.m_reason); +} + +bool rcl_interfaces::msg::SetParametersResult::operator !=( + const SetParametersResult& x) const +{ + return !(*this == x); +} + +size_t rcl_interfaces::msg::SetParametersResult::getMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + + + return current_alignment - initial_alignment; +} + +size_t rcl_interfaces::msg::SetParametersResult::getCdrSerializedSize( + const rcl_interfaces::msg::SetParametersResult& data, + size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.reason().size() + 1; + + + return current_alignment - initial_alignment; +} + +void rcl_interfaces::msg::SetParametersResult::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_successful; + scdr << m_reason.c_str(); + +} + +void rcl_interfaces::msg::SetParametersResult::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_successful; + dcdr >> m_reason; +} + +/*! + * @brief This function sets a value in member successful + * @param _successful New value for member successful + */ +void rcl_interfaces::msg::SetParametersResult::successful( + bool _successful) +{ + m_successful = _successful; +} + +/*! + * @brief This function returns the value of member successful + * @return Value of member successful + */ +bool rcl_interfaces::msg::SetParametersResult::successful() const +{ + return m_successful; +} + +/*! + * @brief This function returns a reference to member successful + * @return Reference to member successful + */ +bool& rcl_interfaces::msg::SetParametersResult::successful() +{ + return m_successful; +} + +/*! + * @brief This function copies the value in member reason + * @param _reason New value to be copied in member reason + */ +void rcl_interfaces::msg::SetParametersResult::reason( + const std::string& _reason) +{ + m_reason = _reason; +} + +/*! + * @brief This function moves the value in member reason + * @param _reason New value to be moved in member reason + */ +void rcl_interfaces::msg::SetParametersResult::reason( + std::string&& _reason) +{ + m_reason = std::move(_reason); +} + +/*! + * @brief This function returns a constant reference to member reason + * @return Constant reference to member reason + */ +const std::string& rcl_interfaces::msg::SetParametersResult::reason() const +{ + return m_reason; +} + +/*! + * @brief This function returns a reference to member reason + * @return Reference to member reason + */ +std::string& rcl_interfaces::msg::SetParametersResult::reason() +{ + return m_reason; +} + +size_t rcl_interfaces::msg::SetParametersResult::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + + + return current_align; +} + +bool rcl_interfaces::msg::SetParametersResult::isKeyDefined() +{ + return false; +} + +void rcl_interfaces::msg::SetParametersResult::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + +} + + diff --git a/third-party/realdds/src/topics/ros2/SetParametersResultPubSubTypes.cpp b/third-party/realdds/src/topics/ros2/SetParametersResultPubSubTypes.cpp new file mode 100644 index 0000000000..6bc1a79d6f --- /dev/null +++ b/third-party/realdds/src/topics/ros2/SetParametersResultPubSubTypes.cpp @@ -0,0 +1,165 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + +/*! + * @file SetParametersResultPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +namespace rcl_interfaces { + namespace msg { + SetParametersResultPubSubType::SetParametersResultPubSubType() + { + setName("rcl_interfaces::msg::dds_::SetParametersResult_"); + auto type_size = SetParametersResult::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = SetParametersResult::isKeyDefined(); + size_t keyLength = SetParametersResult::getKeyMaxCdrSerializedSize() > 16 ? + SetParametersResult::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); + } + + SetParametersResultPubSubType::~SetParametersResultPubSubType() + { + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } + } + + bool SetParametersResultPubSubType::serialize( + void* data, + SerializedPayload_t* payload) + { + SetParametersResult* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + // Serialize the object. + p_type->serialize(ser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + // Get the serialized length + payload->length = static_cast(ser.getSerializedDataLength()); + return true; + } + + bool SetParametersResultPubSubType::deserialize( + SerializedPayload_t* payload, + void* data) + { + try + { + //Convert DATA to pointer of your type + SetParametersResult* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; + } + + std::function SetParametersResultPubSubType::getSerializedSizeProvider( + void* data) + { + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; + } + + void* SetParametersResultPubSubType::createData() + { + return reinterpret_cast(new SetParametersResult()); + } + + void SetParametersResultPubSubType::deleteData( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool SetParametersResultPubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) + { + if (!m_isGetKeyDefined) + { + return false; + } + + SetParametersResult* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + SetParametersResult::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || SetParametersResult::getKeyMaxCdrSerializedSize() > 16) + { + m_md5.init(); + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; + } + + + } //End of namespace msg + +} //End of namespace rcl_interfaces diff --git a/tools/dds/dds-adapter/lrs-device-controller.cpp b/tools/dds/dds-adapter/lrs-device-controller.cpp index 18b59274e5..0e3c3d8d93 100644 --- a/tools/dds/dds-adapter/lrs-device-controller.cpp +++ b/tools/dds/dds-adapter/lrs-device-controller.cpp @@ -15,10 +15,17 @@ #include #include #include +#include #include #include #include +#include +#include +#include +#include +#include + #include #include #include @@ -634,6 +641,7 @@ lrs_device_controller::frame_to_streaming_server( rs2::frame const & f, rs2::str lrs_device_controller::lrs_device_controller( rs2::device dev, std::shared_ptr< realdds::dds_device_server > dds_device_server ) : _rs_dev( dev ) , _dds_device_server( dds_device_server ) + , _control_dispatcher( QUEUE_MAX_SIZE ) { if( ! _dds_device_server ) throw std::runtime_error( "Empty dds_device_server" ); @@ -864,6 +872,96 @@ lrs_device_controller::lrs_device_controller( rs2::device dev, std::shared_ptr< } } ); } + + // Create ROS2 request & response channels + auto & topic_root = _dds_device_server->topic_root(); + auto participant = _dds_device_server->participant(); + auto subscriber = _dds_device_server->subscriber(); + auto publisher = _dds_device_server->publisher(); + if( auto topic = topics::ros2::get_parameters_request_msg::create_topic( + participant, + topics::ROS2_SERVICE_REQUEST_ROOT + topic_root + topics::GET_PARAMETERS_NAME + topics::REQUEST_SUFFIX ) ) + { + _get_params_reader = std::make_shared< dds_topic_reader >( topic, subscriber ); + _get_params_reader->on_data_available( [&]() { on_get_params_request(); } ); + dds_topic_reader::qos rqos( eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS ); + rqos.override_from_json( participant->settings().nested( "device", "get-parameters-request" ) ); + _get_params_reader->run( rqos ); + } + if( auto topic = topics::ros2::get_parameters_response_msg::create_topic( + participant, + topics::ROS2_SERVICE_RESPONSE_ROOT + topic_root + topics::GET_PARAMETERS_NAME + topics::RESPONSE_SUFFIX ) ) + { + _get_params_writer = std::make_shared< dds_topic_writer >( topic, publisher ); + dds_topic_writer::qos wqos( eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS ); + wqos.history().depth = 10; // default is 1 + _get_params_writer->override_qos_from_json( wqos, + participant->settings().nested( "device", "get-parameters-response" ) ); + _get_params_writer->run( wqos ); + } + if( auto topic = topics::ros2::set_parameters_request_msg::create_topic( + participant, + topics::ROS2_SERVICE_REQUEST_ROOT + topic_root + topics::SET_PARAMETERS_NAME + topics::REQUEST_SUFFIX ) ) + { + _set_params_reader = std::make_shared< dds_topic_reader >( topic, subscriber ); + _set_params_reader->on_data_available( [&]() { on_set_params_request(); } ); + dds_topic_reader::qos rqos( eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS ); + rqos.override_from_json( participant->settings().nested( "device", "set-parameters-request" ) ); + _set_params_reader->run( rqos ); + } + if( auto topic = topics::ros2::set_parameters_response_msg::create_topic( + participant, + topics::ROS2_SERVICE_RESPONSE_ROOT + topic_root + topics::SET_PARAMETERS_NAME + topics::RESPONSE_SUFFIX ) ) + { + _set_params_writer = std::make_shared< dds_topic_writer >( topic, publisher ); + dds_topic_writer::qos wqos( eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS ); + wqos.history().depth = 10; // default is 1 + _set_params_writer->override_qos_from_json( wqos, + participant->settings().nested( "device", "set-parameters-response" ) ); + _set_params_writer->run( wqos ); + } + if( auto topic = topics::ros2::list_parameters_request_msg::create_topic( + participant, + topics::ROS2_SERVICE_REQUEST_ROOT + topic_root + topics::LIST_PARAMETERS_NAME + topics::REQUEST_SUFFIX ) ) + { + _list_params_reader = std::make_shared< dds_topic_reader >( topic, subscriber ); + _list_params_reader->on_data_available( [&]() { on_list_params_request(); } ); + dds_topic_reader::qos rqos( eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS ); + rqos.override_from_json( participant->settings().nested( "device", "list-parameters-request" ) ); + _list_params_reader->run( rqos ); + } + if( auto topic = topics::ros2::list_parameters_response_msg::create_topic( + participant, + topics::ROS2_SERVICE_RESPONSE_ROOT + topic_root + topics::LIST_PARAMETERS_NAME + topics::RESPONSE_SUFFIX ) ) + { + _list_params_writer = std::make_shared< dds_topic_writer >( topic, publisher ); + dds_topic_writer::qos wqos( eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS ); + wqos.history().depth = 10; // default is 1 + _list_params_writer->override_qos_from_json( wqos, + participant->settings().nested( "device", "list-parameters-response" ) ); + _list_params_writer->run( wqos ); + } + if( auto topic = topics::ros2::describe_parameters_request_msg::create_topic( + participant, + topics::ROS2_SERVICE_REQUEST_ROOT + topic_root + topics::DESCRIBE_PARAMETERS_NAME + topics::REQUEST_SUFFIX ) ) + { + _describe_params_reader = std::make_shared< dds_topic_reader >( topic, subscriber ); + _describe_params_reader->on_data_available( [&]() { on_describe_params_request(); } ); + dds_topic_reader::qos rqos( eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS ); + rqos.override_from_json( participant->settings().nested( "device", "describe-parameters-request" ) ); + _describe_params_reader->run( rqos ); + } + if( auto topic = topics::ros2::describe_parameters_response_msg::create_topic( + participant, + topics::ROS2_SERVICE_RESPONSE_ROOT + topic_root + topics::DESCRIBE_PARAMETERS_NAME + topics::RESPONSE_SUFFIX ) ) + { + _describe_params_writer = std::make_shared< dds_topic_writer >( topic, publisher ); + dds_topic_writer::qos wqos( eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS ); + wqos.history().depth = 10; // default is 1 + _describe_params_writer->override_qos_from_json( wqos, + participant->settings().nested( "device", "describe-parameters-response" ) ); + _describe_params_writer->run( wqos ); + } } @@ -1680,3 +1778,399 @@ bool lrs_device_controller::update_stream_trinsics( json * p_changes ) } +void lrs_device_controller::on_get_params_request() +{ + topics::ros2::get_parameters_request_msg control; + dds_sample sample; + while (control.take_next(*_get_params_reader, &control, &sample)) + { + if (!control.is_valid()) + continue; + + auto sample_j = json::array({ + rsutils::string::from(realdds::print_raw_guid(sample.sample_identity.writer_guid())), + sample.sample_identity.sequence_number().to64long(), + }); + + LOG_DEBUG("[" << _dds_device_server->debug_name() << "] <----- get_parameters"); + topics::ros2::get_parameters_response_msg response; + for (auto &name : control.names()) + { + topics::ros2::get_parameters_response_msg::value_type value; // NOT_SET + try + { + auto sep = name.find('/'); + if (sep == std::string::npos) + throw std::runtime_error("invalid option name"); + auto const stream_name = name.substr(0, sep); + auto const option_name = name.substr(sep + 1); + if (option_name == "profile") + { + // return the current profile as a JSON array string + auto stream_it = _stream_name_to_server.find(stream_name); + if (stream_it == _stream_name_to_server.end()) + throw std::runtime_error("invalid stream name"); + auto profile = _bridge.get_profile(stream_it->second); + value.string_value(profile->to_json()); + value.type(rcl_interfaces::msg::ParameterType_Constants::PARAMETER_BOOL); + } + else + { + auto option = _dds_device_server->find_option(option_name, stream_name); + if (!option) + throw std::runtime_error("option not found"); + if (option->is_valid()) // Otherwise leave the value as unset + { + auto &j = option->get_value(); + switch (j.type()) + { + case json::value_t::string: + value.string_value(j); + value.type(rcl_interfaces::msg::ParameterType_Constants::PARAMETER_STRING); + break; + case json::value_t::number_float: + value.double_value(j); + value.type(rcl_interfaces::msg::ParameterType_Constants::PARAMETER_DOUBLE); + break; + case json::value_t::number_integer: + case json::value_t::number_unsigned: + value.integer_value(j); + value.type(rcl_interfaces::msg::ParameterType_Constants::PARAMETER_INTEGER); + break; + case json::value_t::boolean: + value.bool_value(j); + value.type(rcl_interfaces::msg::ParameterType_Constants::PARAMETER_BOOL); + break; + default: + // Everything else, we'll communicate but as a JSON string... + value.string_value(j); + value.type(rcl_interfaces::msg::ParameterType_Constants::PARAMETER_STRING); + break; + } + } + } + response.add(value); + } + catch (std::exception const &e) + { + LOG_ERROR("[" << _dds_device_server->debug_name() << "][" << name << "] " << e.what()); + response.add(value); + } + } + // Now send the response back + try + { + response.write_to(*_get_params_writer); + } + catch (std::exception const &e) + { + LOG_ERROR("[" << _dds_device_server->debug_name() << "] failed to send response: " << e.what()); + } + + } +} + + +void lrs_device_controller::on_set_params_request() +{ + topics::ros2::set_parameters_request_msg control; + dds_sample sample; + while (control.take_next(*_set_params_reader, &control, &sample)) + { + if (!control.is_valid()) + continue; + + auto sample_j = json::array({ + rsutils::string::from(realdds::print_raw_guid(sample.sample_identity.writer_guid())), + sample.sample_identity.sequence_number().to64long(), + }); + LOG_DEBUG("[" << _dds_device_server->debug_name() << "] <----- set_parameters"); + topics::ros2::set_parameters_response_msg response; + for (auto ¶meter : control.parameters()) + { + auto &name = parameter.name(); + auto &value = parameter.value(); + topics::ros2::set_parameters_response_msg::result_type result; // failed; no reason + try + { + auto sep = name.find('/'); + if (sep == std::string::npos) + throw std::runtime_error("invalid option name"); + auto const stream_name = name.substr(0, sep); + auto const option_name = name.substr(sep + 1); + if (option_name == "profile" && value.type() == rcl_interfaces::msg::ParameterType_Constants::PARAMETER_STRING) + { + // return the current profile as a JSON array string + auto stream_it = _stream_name_to_server.find(stream_name); + if (stream_it == _stream_name_to_server.end()) + throw std::runtime_error("invalid stream name"); + auto server = stream_it->second; + + auto requested_profile = create_dds_stream_profile(server->type_string(), + json::parse(value.string_value())); + auto profile = find_profile(server, requested_profile); + if (!profile) + throw std::runtime_error("invalid profile " + requested_profile->to_string()); + + _bridge.open(profile); + } + else + { + auto option = _dds_device_server->find_option(option_name, stream_name); + if (!option) + throw std::runtime_error("option not found"); + json jvalue; + switch (value.type()) + { + case rcl_interfaces::msg::ParameterType_Constants::PARAMETER_STRING: + try + { + jvalue = json::parse(value.string_value()); + } + catch (...) + { + jvalue = value.string_value(); + } + break; + case rcl_interfaces::msg::ParameterType_Constants::PARAMETER_BOOL: + jvalue = value.bool_value(); + break; + case rcl_interfaces::msg::ParameterType_Constants::PARAMETER_INTEGER: + jvalue = value.integer_value(); + break; + case rcl_interfaces::msg::ParameterType_Constants::PARAMETER_DOUBLE: + jvalue = value.double_value(); + break; + default: + // Everything else, we don't yet support + throw std::runtime_error("unsupported value type " + std::to_string(int(value.type()))); + } + option->set_value(jvalue); + } + result.successful(true); + response.add(result); + } + catch (std::exception const &e) + { + LOG_ERROR("[" << _dds_device_server->debug_name() << "][" << name << "] " << e.what()); + result.reason(e.what()); + response.add(result); + } + } + // Now send the response back + try + { + response.write_to(*_set_params_writer); + } + catch (std::exception const &e) + { + LOG_ERROR("[" << _dds_device_server->debug_name() << "] failed to send response: " << e.what()); + } + } +} + + +void lrs_device_controller::on_list_params_request() +{ + topics::ros2::list_parameters_request_msg control; + dds_sample sample; + while (control.take_next(*_list_params_reader, &control, &sample)) + { + if (!control.is_valid()) + continue; + + auto sample_j = json::array({ + rsutils::string::from(realdds::print_raw_guid(sample.sample_identity.writer_guid())), + sample.sample_identity.sequence_number().to64long(), + }); + LOG_DEBUG("[" << _dds_device_server->debug_name() << "] <----- list_parameters"); + topics::ros2::list_parameters_response_msg response; +#if 0 + for( auto & parameter : control.prefixes() ) + { + auto & name = parameter.name(); + auto & value = parameter.value(); + topics::ros2::set_parameters_response_msg::result_type result; // failed; no reason + try + { + auto sep = name.find( '/' ); + if( sep == std::string::npos ) + throw std::runtime_error( "invalid option name" ); + auto const stream_name = name.substr( 0, sep ); + auto const option_name = name.substr( sep + 1 ); + if( option_name == "profile" + && value.type() == rcl_interfaces::msg::ParameterType_Constants::PARAMETER_STRING ) + { + // return the current profile as a JSON array string + auto stream_it = _stream_name_to_server.find( stream_name ); + if( stream_it == _stream_name_to_server.end() ) + throw std::runtime_error( "invalid stream name" ); + auto server = stream_it->second; + + auto requested_profile + = create_dds_stream_profile( server->type_string(), json::parse( value.string_value() ) ); + auto profile = find_profile( server, requested_profile ); + if( !profile ) + throw std::runtime_error( "invalid profile " + requested_profile->to_string() ); + + _bridge.open( profile ); + } + else + { + auto option = _dds_device_server->find_option( option_name, stream_name ); + if( !option ) + throw std::runtime_error( "option not found" ); + json jvalue; + switch( value.type() ) + { + case rcl_interfaces::msg::ParameterType_Constants::PARAMETER_STRING: + try + { + jvalue = json::parse( value.string_value() ); + } + catch( ... ) + { + jvalue = value.string_value(); + } + break; + case rcl_interfaces::msg::ParameterType_Constants::PARAMETER_BOOL: + jvalue = value.bool_value(); + break; + case rcl_interfaces::msg::ParameterType_Constants::PARAMETER_INTEGER: + jvalue = value.integer_value(); + break; + case rcl_interfaces::msg::ParameterType_Constants::PARAMETER_DOUBLE: + jvalue = value.double_value(); + break; + default: + // Everything else, we don't yet support + throw std::runtime_error( "unsupported value type " + std::to_string( int( value.type() ) ) ); + } + option->set_value( jvalue ); + } + result.successful( true ); + response.add( result ); + } + catch( std::exception const & e ) + { + LOG_ERROR( "[" << _dds_device_server->debug_name() << "][" << name << "] " << e.what() ); + result.reason( e.what() ); + response.add( result ); + } + } +#endif + // Now send the response back + try + { + response.write_to(*_list_params_writer); + } + catch (std::exception const &e) + { + LOG_ERROR("[" << _dds_device_server->debug_name() << "] failed to send response: " << e.what()); + } + } +} + + +void lrs_device_controller::on_describe_params_request() +{ + topics::ros2::describe_parameters_request_msg control; + dds_sample sample; + while (control.take_next(*_describe_params_reader, &control, &sample)) + { + if (!control.is_valid()) + continue; + + auto sample_j = json::array({ + rsutils::string::from(realdds::print_raw_guid(sample.sample_identity.writer_guid())), + sample.sample_identity.sequence_number().to64long(), + }); + LOG_DEBUG("[" << _dds_device_server->debug_name() << "] <----- describe_parameters"); + topics::ros2::describe_parameters_response_msg response; +#if 0 + for( auto & parameter : control.prefixes() ) + { + auto & name = parameter.name(); + auto & value = parameter.value(); + topics::ros2::set_parameters_response_msg::result_type result; // failed; no reason + try + { + auto sep = name.find( '/' ); + if( sep == std::string::npos ) + throw std::runtime_error( "invalid option name" ); + auto const stream_name = name.substr( 0, sep ); + auto const option_name = name.substr( sep + 1 ); + if( option_name == "profile" + && value.type() == rcl_interfaces::msg::ParameterType_Constants::PARAMETER_STRING ) + { + // return the current profile as a JSON array string + auto stream_it = _stream_name_to_server.find( stream_name ); + if( stream_it == _stream_name_to_server.end() ) + throw std::runtime_error( "invalid stream name" ); + auto server = stream_it->second; + + auto requested_profile + = create_dds_stream_profile( server->type_string(), json::parse( value.string_value() ) ); + auto profile = find_profile( server, requested_profile ); + if( !profile ) + throw std::runtime_error( "invalid profile " + requested_profile->to_string() ); + + _bridge.open( profile ); + } + else + { + auto option = _dds_device_server->find_option( option_name, stream_name ); + if( !option ) + throw std::runtime_error( "option not found" ); + json jvalue; + switch( value.type() ) + { + case rcl_interfaces::msg::ParameterType_Constants::PARAMETER_STRING: + try + { + jvalue = json::parse( value.string_value() ); + } + catch( ... ) + { + jvalue = value.string_value(); + } + break; + case rcl_interfaces::msg::ParameterType_Constants::PARAMETER_BOOL: + jvalue = value.bool_value(); + break; + case rcl_interfaces::msg::ParameterType_Constants::PARAMETER_INTEGER: + jvalue = value.integer_value(); + break; + case rcl_interfaces::msg::ParameterType_Constants::PARAMETER_DOUBLE: + jvalue = value.double_value(); + break; + default: + // Everything else, we don't yet support + throw std::runtime_error( "unsupported value type " + std::to_string( int( value.type() ) ) ); + } + option->set_value( jvalue ); + } + result.successful( true ); + response.add( result ); + } + catch( std::exception const & e ) + { + LOG_ERROR( "[" << _dds_device_server->debug_name() << "][" << name << "] " << e.what() ); + result.reason( e.what() ); + response.add( result ); + } + } +#endif + // Now send the response back + try + { + response.write_to(*_describe_params_writer); + } + catch (std::exception const &e) + { + LOG_ERROR("[" << _dds_device_server->debug_name() << "] failed to send response: " << e.what()); + } + } +} + + diff --git a/tools/dds/dds-adapter/lrs-device-controller.h b/tools/dds/dds-adapter/lrs-device-controller.h index 7f98b297f9..1a194673fd 100644 --- a/tools/dds/dds-adapter/lrs-device-controller.h +++ b/tools/dds/dds-adapter/lrs-device-controller.h @@ -1,5 +1,5 @@ // License: Apache 2.0. See LICENSE file in root directory. -// Copyright(c) 2022 Intel Corporation. All Rights Reserved. +// Copyright(c) 2022-4 Intel Corporation. All Rights Reserved. #pragma once #include // Include RealSense Cross Platform API @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -19,6 +20,8 @@ namespace realdds { class dds_device_server; class dds_stream_server; class dds_option; +class dds_topic_reader; +class dds_topic_writer; } // namespace realdds @@ -50,6 +53,11 @@ class lrs_device_controller : public std::enable_shared_from_this< lrs_device_co bool on_dfu_apply( rsutils::json const &, rsutils::json & ); bool on_open_streams( rsutils::json const &, rsutils::json & ); + void on_get_params_request(); + void on_set_params_request(); + void on_list_params_request(); + void on_describe_params_request(); + void override_default_profiles( const std::map< std::string, realdds::dds_stream_profiles > & stream_name_to_profiles, std::map< std::string, size_t > & stream_name_to_default_profile ) const; size_t get_index_of_profile( const realdds::dds_stream_profiles & profiles, @@ -75,6 +83,17 @@ class lrs_device_controller : public std::enable_shared_from_this< lrs_device_co std::shared_ptr< realdds::dds_device_server > _dds_device_server; bool _md_enabled; + + dispatcher _control_dispatcher; + + std::shared_ptr< realdds::dds_topic_reader > _get_params_reader; + std::shared_ptr< realdds::dds_topic_writer > _get_params_writer; + std::shared_ptr< realdds::dds_topic_reader > _set_params_reader; + std::shared_ptr< realdds::dds_topic_writer > _set_params_writer; + std::shared_ptr< realdds::dds_topic_reader > _list_params_reader; + std::shared_ptr< realdds::dds_topic_writer > _list_params_writer; + std::shared_ptr< realdds::dds_topic_reader > _describe_params_reader; + std::shared_ptr< realdds::dds_topic_writer > _describe_params_writer; }; // class lrs_device_controller } // namespace tools