Skip to content

Commit

Permalink
TypeObjectRegistry implementation (#3996)
Browse files Browse the repository at this point in the history
* Refs #19837: add TypeObjectRegistry::register_type_identifier test

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::register_type_identifier implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: test fixes

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: add TypeObjectUtils::complete_type_object_consistency

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::register_type_object implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::register_type_object test

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::build_minimal_from_complete_type_object skeleton

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::build_minimal_from_complete_alias_type implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: use const references in ranged for loops

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::build_minimal_from_complete_annotation_type implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::build_minimal_from_complete_struct_type implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::build_minimal_from_complete_union_type implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::build_minimal_from_complete_bitset_type implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::build_minimal_from_complete_sequence_type implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::build_minimal_from_complete_array_type implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::build_minimal_from_complete_map_type implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::build_minimal_from_complete_enumerated_type implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::build_minimal_from_complete_bitmask_type implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::get_type_identifier

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: fix tests

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObject::get_type_identifiers implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: add TypeObject::get_type_identifiers test

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: add TypeObject::get_type_objects tests

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::get_type_objects implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry constructor implementation. Register primitive TypeIdentifiers

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::register_type_object implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::get_type_object implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: add precondition to public API

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::get_type_information implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::is_builtin_annotation implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::is_type_identifier_known implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectRegistry::get_type_dependencies impl

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: linters

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: apply review suggestion, protect against concurrent access to collections

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: apply review suggestion, rename to calculate_type_identifier

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: define NO_DEPENDENCIES constant

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: apply review suggestions to TypeObjectRegistry implementation

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: apply review suggestions, imporve TypeObjectRegistry tests

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: TypeObjectUtils::direct_hash_type_identifier_consistency impl

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: linters

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: remove Windows warning

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: regenerate code to avoid Clang warning

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #19837: use ExtensibilityKind and TryConstructKind defined in DynamicType IDL

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

---------

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>
  • Loading branch information
JLBuenoLopez committed Jan 9, 2024
1 parent dcbd61e commit 704a60b
Show file tree
Hide file tree
Showing 15 changed files with 1,871 additions and 217 deletions.
20 changes: 0 additions & 20 deletions include/fastdds/dds/xtypes/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,6 @@ namespace fastdds {
namespace dds {
namespace xtypes {

/**
* @brief Extensibility kinds (@extensibility annotation)
*/
enum ExtensibilityKind
{
FINAL,
APPENDABLE,
MUTABLE
};

/**
* @brief Try construct kinds (@try_construct annotation)
*/
enum TryConstructKind
{
USE_DEFAULT,
DISCARD,
TRIM
};

/**
* @brief EquivalenceKind values
*/
Expand Down
397 changes: 374 additions & 23 deletions include/fastdds/dds/xtypes/type_representation/TypeObjectRegistry.hpp

Large diffs are not rendered by default.

34 changes: 24 additions & 10 deletions include/fastdds/dds/xtypes/type_representation/TypeObjectUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/optional.hpp>

#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
#include <fastdds/dds/xtypes/common.hpp>
#include <fastdds/dds/xtypes/dynamic_types/Types.hpp>
#include <fastdds/dds/xtypes/exception/Exception.hpp>
#include <fastdds/dds/xtypes/type_representation/TypeObject.hpp>
#include <fastrtps/fastrtps_dll.h>
Expand All @@ -36,6 +36,8 @@ namespace fastdds {
namespace dds {
namespace xtypes {

class TypeObjectRegistry;

using ReturnCode_t = eprosima::fastdds::dds::ReturnCode_t;

class TypeObjectUtils
Expand Down Expand Up @@ -63,7 +65,7 @@ class TypeObjectUtils
* @return CollectionElementFlag instance.
*/
RTPS_DllAPI static CollectionElementFlag build_collection_element_flag(
TryConstructKind try_construct_kind,
eprosima::fastdds::dds::TryConstructKind try_construct_kind,
bool external);

/**
Expand All @@ -79,7 +81,7 @@ class TypeObjectUtils
* @return StructMemberFlag instance.
*/
RTPS_DllAPI static StructMemberFlag build_struct_member_flag(
TryConstructKind try_construct_kind,
eprosima::fastdds::dds::TryConstructKind try_construct_kind,
bool optional,
bool must_understand,
bool key,
Expand All @@ -94,7 +96,7 @@ class TypeObjectUtils
* @return UnionMemberFlag instance.
*/
RTPS_DllAPI static UnionMemberFlag build_union_member_flag(
TryConstructKind try_construct_kind,
eprosima::fastdds::dds::TryConstructKind try_construct_kind,
bool default_member,
bool external);

Expand All @@ -106,7 +108,7 @@ class TypeObjectUtils
* @return UnionDiscriminatorFlag instance.
*/
RTPS_DllAPI static UnionDiscriminatorFlag build_union_discriminator_flag(
TryConstructKind try_construct_kind,
eprosima::fastdds::dds::TryConstructKind try_construct_kind,
bool key);

/**
Expand Down Expand Up @@ -134,7 +136,7 @@ class TypeObjectUtils
* @return StructTypeFlag instance.
*/
RTPS_DllAPI static StructTypeFlag build_struct_type_flag(
ExtensibilityKind extensibility_kind,
eprosima::fastdds::dds::ExtensibilityKind extensibility_kind,
bool nested,
bool autoid_hash);

Expand All @@ -147,7 +149,7 @@ class TypeObjectUtils
* @return UnionTypeFlag instance.
*/
RTPS_DllAPI static UnionTypeFlag build_union_type_flag(
ExtensibilityKind extensibility_kind,
eprosima::fastdds::dds::ExtensibilityKind extensibility_kind,
bool nested,
bool autoid_hash);

Expand Down Expand Up @@ -1859,6 +1861,8 @@ class TypeObjectUtils

private:

friend class TypeObjectRegistry;

// Class with only static methods
TypeObjectUtils() = delete;
~TypeObjectUtils() = delete;
Expand All @@ -1875,7 +1879,7 @@ class TypeObjectUtils
*/
static void set_try_construct_behavior(
MemberFlag& member_flag,
TryConstructKind try_construct_kind);
eprosima::fastdds::dds::TryConstructKind try_construct_kind);

/**
* @brief Set the TypeFlag object.
Expand All @@ -1887,7 +1891,7 @@ class TypeObjectUtils
*/
static void set_type_flag(
TypeFlag& type_flag,
ExtensibilityKind extensibility_kind,
eprosima::fastdds::dds::ExtensibilityKind extensibility_kind,
bool nested,
bool autoid_hash);

Expand All @@ -1899,7 +1903,7 @@ class TypeObjectUtils
*/
static void set_extensibility_kind(
TypeFlag& type_flag,
ExtensibilityKind extensibility_kind);
eprosima::fastdds::dds::ExtensibilityKind extensibility_kind);

/**
* @brief Check if a given TypeIdentifier is fully-descriptive.
Expand Down Expand Up @@ -2913,6 +2917,16 @@ class TypeObjectUtils
static void complete_bitset_type_consistency(
const CompleteBitsetType& complete_bitset_type);

/**
* @brief Check CompleteTypeObject consistency.
*
* @param[in] complete_type_object Instance to be checked.
* @exception eprosima::fastdds::dds::xtypes::InvalidArgumentError exception if the given
* CompleteTypeObject is not consistent.
*/
static void complete_type_object_consistency(
const CompleteTypeObject& complete_type_object);

};

} // xtypes
Expand Down
1 change: 1 addition & 0 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ set(${PROJECT_NAME}_source_files
dynamic-types/DynamicDataHelper.cpp

fastdds/xtypes/exception/Exception.cpp
fastdds/xtypes/type_representation/dds_xtypes_typeobjectPubSubTypes.cxx
fastdds/xtypes/type_representation/TypeObjectUtils.cpp
fastdds/xtypes/type_representation/TypeObjectRegistry.cpp

Expand Down
Loading

0 comments on commit 704a60b

Please sign in to comment.