Skip to content

Commit

Permalink
TypeLookup listeners implementation (#4240)
Browse files Browse the repository at this point in the history
* Refs #20157: Implemented async_get_type replies.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20157: Changeds to instance_name.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20157: Changes to check_type_identifier_received

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20157: Added continuation point checks.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20157: Removed old function

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Implemented async_get_type request listener.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Added continuation point management

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Renames and comments improvements

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Fixed deadlock, renamed discovery methods. Applied suggestions.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Small fix in reply error check.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Created get_complementary_type_identifier method.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Added valid_matching check for TypeInformation.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Added send and receive error logs. Added missing continuation_point reply management

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Added check for requests with no TypeIdentifiers and small fixes.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Added listener classes to handle change acks

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Restored minimal_from_complete_type_identifier method from TypeObjectRegistry

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Fixes for TypeInformation serializer

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Added typelookup_service_threads to XMLParser

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160. Remove old function

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #20160. Fix

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #20160: Fixes for TypeLookupManager destruction with pending callbacks.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Changes for instance_names to use the full GUID.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Applied suggestions. Removed overloaded discovery methods.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Changes for xtypes doc.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Fix for LOG macro. Remove consistency check from register_type_object(from TypeLookupManager).

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Applied suggestions.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Removed obsolete check.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Fixed DS tests and warnings.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Fixes after rebase.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Windows warning.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Applied suggestions.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20160: Fixed tests.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #20242. Update unsupported_type_info tests.

Now we works successfully against OpenDDS 3.27

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #20242. Apply suggestion

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #20242. Fix log thread being killed in windows on unit test

Signed-off-by: Ricardo González <ricardo@richiware.dev>

---------

Signed-off-by: adriancampo <adriancampo@eprosima.com>
Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
Signed-off-by: Ricardo González <ricardo@richiware.dev>
Co-authored-by: Ricardo González Moreno <ricardo@richiware.dev>
  • Loading branch information
2 people authored and JesusPoderoso committed Apr 12, 2024
1 parent 5cd4952 commit 2c47b5e
Show file tree
Hide file tree
Showing 65 changed files with 1,982 additions and 1,002 deletions.
38 changes: 2 additions & 36 deletions include/fastdds/dds/domain/DomainParticipantListener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,9 @@ class DomainParticipantListener :
*
* @param[out] participant Pointer to the Participant which discovered the remote DataReader.
* @param[out] info Remote DataReader information. User can take ownership of the object.
*/
virtual void on_subscriber_discovery(
DomainParticipant* participant,
fastrtps::rtps::ReaderDiscoveryInfo&& info)
{
static_cast<void>(participant);
static_cast<void>(info);
}

/*!
* This method is called when a new DataReader is discovered, or a previously discovered DataReader changes
* its QOS or is removed.
*
* @warning Not Supported. This callback will never be called in the current version.
*
* @param[out] participant Pointer to the Participant which discovered the remote DataReader.
* @param[out] info Remote DataReader information. User can take ownership of the object.
* @param[out] should_be_ignored Flag to indicate the library to automatically ignore the discovered DataReader.
*/
virtual void on_subscriber_discovery(
virtual void on_data_reader_discovery(
DomainParticipant* participant,
fastrtps::rtps::ReaderDiscoveryInfo&& info,
bool& should_be_ignored)
Expand All @@ -135,26 +118,9 @@ class DomainParticipantListener :
*
* @param[out] participant Pointer to the Participant which discovered the remote DataWriter.
* @param[out] info Remote DataWriter information. User can take ownership of the object.
*/
virtual void on_publisher_discovery(
DomainParticipant* participant,
fastrtps::rtps::WriterDiscoveryInfo&& info)
{
static_cast<void>(participant);
static_cast<void>(info);
}

/*!
* This method is called when a new DataWriter is discovered, or a previously discovered DataWriter changes
* its QOS or is removed.
*
* @warning Not Supported. This callback will never be called in the current version.
*
* @param[out] participant Pointer to the Participant which discovered the remote DataWriter.
* @param[out] info Remote DataWriter information. User can take ownership of the object.
* @param[out] should_be_ignored Flag to indicate the library to automatically ignore the discovered DataWriter.
*/
virtual void on_publisher_discovery(
virtual void on_data_writer_discovery(
DomainParticipant* participant,
fastrtps::rtps::WriterDiscoveryInfo&& info,
bool& should_be_ignored)
Expand Down
35 changes: 35 additions & 0 deletions include/fastdds/dds/domain/qos/DomainParticipantQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class DomainParticipantQos
(this->builtin_controllers_sender_thread_ == b.builtin_controllers_sender_thread()) &&
(this->timed_events_thread_ == b.timed_events_thread()) &&
(this->discovery_server_thread_ == b.discovery_server_thread()) &&
(this->typelookup_service_thread_ == b.typelookup_service_thread()) &&
#if HAVE_SECURITY
(this->security_log_thread_ == b.security_log_thread()) &&
#endif // if HAVE_SECURITY
Expand Down Expand Up @@ -433,6 +434,37 @@ class DomainParticipantQos
discovery_server_thread_ = value;
}

/**
* Getter for TypeLookup service ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
rtps::ThreadSettings& typelookup_service_thread()
{
return typelookup_service_thread_;
}

/**
* Getter for TypeLookup service ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
const rtps::ThreadSettings& typelookup_service_thread() const
{
return typelookup_service_thread_;
}

/**
* Setter for the TypeLookup service ThreadSettings
*
* @param value New ThreadSettings to be set
*/
void typelookup_service_thread(
const rtps::ThreadSettings& value)
{
typelookup_service_thread_ = value;
}

#if HAVE_SECURITY
/**
* Getter for security log ThreadSettings
Expand Down Expand Up @@ -505,6 +537,9 @@ class DomainParticipantQos
//! Thread settings for the discovery server thread
rtps::ThreadSettings discovery_server_thread_;

//! Thread settings for the builtin TypeLookup service requests and replies threads
rtps::ThreadSettings typelookup_service_thread_;

#if HAVE_SECURITY
//! Thread settings for the security log thread
rtps::ThreadSettings security_log_thread_;
Expand Down
51 changes: 26 additions & 25 deletions include/fastdds/dds/log/Log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,18 @@ class LogConsumer
// Name of variables inside macros must be unique, or it could produce an error with external variables
#if !HAVE_LOG_NO_ERROR

#define EPROSIMA_LOG_ERROR_IMPL_(cat, msg) \
#define EPROSIMA_LOG_ERROR_IMPL_(cat, msg) \
do { \
using namespace eprosima::fastdds::dds; \
std::stringstream fastdds_log_ss_tmp__; \
fastdds_log_ss_tmp__ << msg; \
Log::QueueLog(fastdds_log_ss_tmp__.str(), Log::Context{__FILE__, __LINE__, __func__, #cat}, Log::Kind::Error); \
eprosima::fastdds::dds::Log::QueueLog( \
fastdds_log_ss_tmp__.str(), eprosima::fastdds::dds::Log::Context{__FILE__, __LINE__, __func__, #cat}, \
eprosima::fastdds::dds::Log::Kind::Error); \
} while (0)

#elif (__INTERNALDEBUG || _INTERNALDEBUG)

#define EPROSIMA_LOG_ERROR_IMPL_(cat, msg) \
#define EPROSIMA_LOG_ERROR_IMPL_(cat, msg) \
do { \
auto fastdds_log_lambda_tmp__ = [&]() \
{ \
Expand All @@ -312,21 +313,21 @@ class LogConsumer
***********/
#if !HAVE_LOG_NO_WARNING

#define EPROSIMA_LOG_WARNING_IMPL_(cat, msg) \
do { \
using namespace eprosima::fastdds::dds; \
if (Log::GetVerbosity() >= Log::Kind::Warning) \
{ \
std::stringstream fastdds_log_ss_tmp__; \
fastdds_log_ss_tmp__ << msg; \
Log::QueueLog( \
fastdds_log_ss_tmp__.str(), Log::Context{__FILE__, __LINE__, __func__, #cat}, Log::Kind::Warning); \
} \
#define EPROSIMA_LOG_WARNING_IMPL_(cat, msg) \
do { \
if (eprosima::fastdds::dds::Log::GetVerbosity() >= eprosima::fastdds::dds::Log::Kind::Warning) \
{ \
std::stringstream fastdds_log_ss_tmp__; \
fastdds_log_ss_tmp__ << msg; \
eprosima::fastdds::dds::Log::QueueLog( \
fastdds_log_ss_tmp__.str(), eprosima::fastdds::dds::Log::Context{__FILE__, __LINE__, __func__, #cat}, \
eprosima::fastdds::dds::Log::Kind::Warning); \
} \
} while (0)

#elif (__INTERNALDEBUG || _INTERNALDEBUG)

#define EPROSIMA_LOG_WARNING_IMPL_(cat, msg) \
#define EPROSIMA_LOG_WARNING_IMPL_(cat, msg) \
do { \
auto fastdds_log_lambda_tmp__ = [&]() \
{ \
Expand All @@ -351,16 +352,16 @@ class LogConsumer
((defined(__INTERNALDEBUG) || defined(_INTERNALDEBUG)) && (defined(_DEBUG) || defined(__DEBUG) || \
!defined(NDEBUG))))

#define EPROSIMA_LOG_INFO_IMPL_(cat, msg) \
do { \
using namespace eprosima::fastdds::dds; \
if (Log::GetVerbosity() >= Log::Kind::Info) \
{ \
std::stringstream fastdds_log_ss_tmp__; \
fastdds_log_ss_tmp__ << msg; \
Log::QueueLog(fastdds_log_ss_tmp__.str(), Log::Context{__FILE__, __LINE__, __func__, #cat}, \
Log::Kind::Info); \
} \
#define EPROSIMA_LOG_INFO_IMPL_(cat, msg) \
do { \
if (eprosima::fastdds::dds::Log::GetVerbosity() >= eprosima::fastdds::dds::Log::Kind::Info) \
{ \
std::stringstream fastdds_log_ss_tmp__; \
fastdds_log_ss_tmp__ << msg; \
eprosima::fastdds::dds::Log::QueueLog( \
fastdds_log_ss_tmp__.str(), eprosima::fastdds::dds::Log::Context{__FILE__, __LINE__, __func__, #cat}, \
eprosima::fastdds::dds::Log::Kind::Info); \
} \
} while (0)

#elif (__INTERNALDEBUG || _INTERNALDEBUG)
Expand Down
6 changes: 3 additions & 3 deletions include/fastdds/dds/xtypes/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

/*!
* @file
* @file common.hpp
* This file contains common definitions for the different XTypes modules.
*/

Expand Down Expand Up @@ -43,8 +43,8 @@ enum class TryConstructKind : uint32_t
TRIM
};

/**
* @brief PlacementKind values (@verbatim annotation)
/*!
* @brief PlacementKind values (verbatim annotation)
*/
enum class PlacementKind : uint32_t
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class FASTDDS_EXPORTED_API AnnotationDescriptor

/*!
* Modifies the underlying type reference.
* @param[in] @ref DynamicType reference.
* @param[in] type @ref DynamicType reference.
*/
virtual void type(
traits<DynamicType>::ref_type type) = 0;
Expand Down
4 changes: 2 additions & 2 deletions include/fastdds/dds/xtypes/dynamic_types/DynamicData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class DynamicData : public std::enable_shared_from_this<DynamicData>
/*!
* Retrieves an \b int32 value associated to an identifier.
* @param[inout] value \b int32 to populate
* @param[in] Id identifier of the member to query.
* @param[in] id identifier of the member to query.
* @return @ref ReturnCode_t
* @retval RETCODE_OK when the value was retrieved successfully.
* @retval RETCODE_BAD_PARAMETER when the @ref MemberId is invalid or the member type is not promotable to \b int32.
Expand Down Expand Up @@ -516,7 +516,7 @@ class DynamicData : public std::enable_shared_from_this<DynamicData>

/*!
* Sets an \b bool value associated to an identifier
* @param[in] Id identifier of the member to set.
* @param[in] id identifier of the member to set.
* @param[in] value \b bool to set.
* @return @ref ReturnCode_t
* @retval RETCODE_OK when the value was set successfully.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class DynamicDataFactory : public std::enable_shared_from_this<DynamicDataFactor

/**
* Resets the internal reference if it is cached.
* @param[in] type @ref DynamicData reference whose internal cached reference to reset.
* @param[in] data @ref DynamicData reference whose internal cached reference to reset.
* @return standard ReturnCode_t
* @retval RETCODE_BAD_PARAMETER if reference is nil.
* @retval RETCODE_OK is otherwise returned.
Expand Down
3 changes: 2 additions & 1 deletion include/fastdds/dds/xtypes/dynamic_types/DynamicType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class DynamicType : public std::enable_shared_from_this<DynamicType>
/*!
* Returns the member that corresponds to the specified name.
* @param[inout] member @ref DynamicTypeMember reference used to return the reference to the member.
* @param[in] name Member name of the member being queried.
* @return @ref ReturnCode_t
* @retval RETCODE_OK when the member was found.
* @retval RETCODE_BAD_PARAMETER when the member doesn't exist.
Expand Down Expand Up @@ -154,7 +155,7 @@ class DynamicType : public std::enable_shared_from_this<DynamicType>

/**
* State comparison according with the [standard] sections \b 7.5.2.8.4
* @param[in] other @DynamicType reference to compare to
* @param[in] other @ref DynamicType reference to compare to
* @return \b bool `true` on equality
*/
FASTDDS_EXPORTED_API virtual bool equals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class DynamicTypeBuilder : public std::enable_shared_from_this<DynamicTypeBuilde

/*!
* Returns all members sorted by name.
* @param[inout] member @ref DynamicTypeMemberByName reference used to return all members.
* @param[inout] member DynamicTypeMemberByName reference used to return all members.
* @return @ref ReturnCode_t
* @retval RETCODE_OK always.
*/
Expand All @@ -90,7 +90,7 @@ class DynamicTypeBuilder : public std::enable_shared_from_this<DynamicTypeBuilde

/*!
* Returns all members sorted by MemberId.
* @param[inout] member @ref DynamicTypeMemberById reference used to return all members.
* @param[inout] member DynamicTypeMemberById reference used to return all members.
* @return @ref ReturnCode_t
* @retval RETCODE_OK always.
*/
Expand Down Expand Up @@ -165,6 +165,7 @@ class DynamicTypeBuilder : public std::enable_shared_from_this<DynamicTypeBuilde

/*!
* Apply the given annotation to a member of this type.
* @param[in] member_id Member identifier.
* @param[in] descriptor @ref AnnotationDescriptor reference to be applied.
* @return @ref ReturnCode_t
* @retval RETCODE_OK when the annotation was applied successful.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ class DynamicTypeBuilderFactory : public std::enable_shared_from_this<DynamicTyp
traits<DynamicType>::ref_type type) = 0;

/*!
* Creates a new @ref DynamicTypeBuilder reference based on the given @ref TypeObject instance.
* @param[in] type_object @ref TypeObject instance to be used.
* Creates a new @ref DynamicTypeBuilder reference based on the given @ref xtypes::TypeObject instance.
* @param[in] type_object @ref xtypes::TypeObject instance to be used.
* @return New @ref DynamicTypeBuilder reference. Nil reference returned in error case.
*/
FASTDDS_EXPORTED_API virtual traits<DynamicTypeBuilder>::ref_type create_type_w_type_object(
Expand Down Expand Up @@ -117,7 +117,7 @@ class DynamicTypeBuilderFactory : public std::enable_shared_from_this<DynamicTyp
/*!
* Creates a new @ref DynamicTypeBuilder reference representing an array.
* @param[in] element_type @ref DynamicType reference which becomes the element type
* @param[in] bounds `uint32_t` representing the desired dimensions.
* @param[in] bound `uint32_t` sequence representing the desired dimensions.
* @return new @ref DynamicTypeBuilder reference. Nil reference returned in error case.
*/
FASTDDS_EXPORTED_API virtual traits<DynamicTypeBuilder>::ref_type create_array_type(
Expand All @@ -126,8 +126,8 @@ class DynamicTypeBuilderFactory : public std::enable_shared_from_this<DynamicTyp

/*!
* Creates a new @ref DynamicTypeBuilder reference representing a map.
* @param[in] key_type @ref DynamicType reference which becomes the map's key type
* @param[in] value_type @ref DynamicType reference which becomes the map's value type
* @param[in] key_element_type @ref DynamicType reference which becomes the map's key type
* @param[in] element_type @ref DynamicType reference which becomes the map's value type
* @param[in] bound `uint32_t` representing the maximum number of elements that may be stored.
* If the value is equal to LENGTH_UNLIMITED, the map type shall be considered to be unbounded.
* @return new @ref DynamicTypeBuilder reference. Nil reference returned in error case.
Expand All @@ -148,7 +148,7 @@ class DynamicTypeBuilderFactory : public std::enable_shared_from_this<DynamicTyp
/*!
* Creates a new @ref DynamicTypeBuilder reference by parsing the type description at the given URL.
* @remark Not implemented yet.
* @param[in] URL pointing to the XML description.
* @param[in] document_url pointing to the url containing the type description.
* @param[in] type_name Fully qualified name of the type to be loaded from the document.
* @param[in] include_paths A collection of URLs to directories to be searched for additional type description
* documents.
Expand All @@ -162,7 +162,7 @@ class DynamicTypeBuilderFactory : public std::enable_shared_from_this<DynamicTyp
/*!
* Creates a new @ref DynamicTypeBuilder reference by parsing the type description contained in the given string.
* @remark Not implemented yet.
* @param[in] String containing the type description.
* @param[in] document containing the type description.
* @param[in] type_name Fully qualified name of the type to be loaded from the string.
* @param[in] include_paths A collection of URLs to directories to be searched for additional type description
* documents.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class DynamicTypeMember : public std::enable_shared_from_this<DynamicTypeMember>

/**
* State comparison according with the [standard] sections \b 7.5.2.6.3
* @param[in] other @DynamicTypeMember reference to compare to
* @param[in] other @ref DynamicTypeMember reference to compare to
* @return \b bool `true` on equality
*/
FASTDDS_EXPORTED_API virtual bool equals(
Expand Down
Loading

0 comments on commit 2c47b5e

Please sign in to comment.