From bb548de29c513092437a0b61978a934b2b62bd78 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Thu, 8 Jul 2021 12:07:25 +0200 Subject: [PATCH 1/2] Move TypeDescriptor::stateTable from header to implementation. (#2015) Signed-off-by: Miguel Company (cherry picked from commit 1f2636aafcc8b674762863321e9ca20d13ccdee9) --- include/fastrtps/types/TypeDescriptor.h | 24 ---------------------- src/cpp/dynamic-types/TypeDescriptor.cpp | 26 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/include/fastrtps/types/TypeDescriptor.h b/include/fastrtps/types/TypeDescriptor.h index 459f96d9f49..49cc6b48966 100644 --- a/include/fastrtps/types/TypeDescriptor.h +++ b/include/fastrtps/types/TypeDescriptor.h @@ -25,23 +25,6 @@ namespace eprosima { namespace fastrtps { namespace types { -enum FSM_INPUTS -{ - LETTER = 1, - NUMBER, - UNDERSCORE, - COLON, - OTHER -}; - -enum FSM_STATES -{ - INVALID = 0, - SINGLECOLON, - DOUBLECOLON, - VALID -}; - class TypeDescriptor { protected: @@ -54,13 +37,6 @@ class TypeDescriptor DynamicType_ptr key_element_type_; // Key Type for maps. std::vector annotation_; // Annotations to apply - const int stateTable[4][6] = { - /* Input: letter, number, underscore, colon, other */ - {INVALID, VALID, INVALID, INVALID, INVALID, INVALID}, - {SINGLECOLON, INVALID, INVALID, INVALID, DOUBLECOLON, INVALID}, - {DOUBLECOLON, VALID, INVALID, INVALID, INVALID, INVALID}, - {VALID, VALID, VALID, VALID, SINGLECOLON, INVALID}}; - void clean(); bool is_type_name_consistent(const std::string& sName) const; diff --git a/src/cpp/dynamic-types/TypeDescriptor.cpp b/src/cpp/dynamic-types/TypeDescriptor.cpp index 4d4835fdc76..fab5cce54e0 100644 --- a/src/cpp/dynamic-types/TypeDescriptor.cpp +++ b/src/cpp/dynamic-types/TypeDescriptor.cpp @@ -25,6 +25,32 @@ namespace eprosima { namespace fastrtps { namespace types { +enum FSM_INPUTS +{ + LETTER = 1, + NUMBER, + UNDERSCORE, + COLON, + OTHER +}; + +enum FSM_STATES +{ + INVALID = 0, + SINGLECOLON, + DOUBLECOLON, + VALID +}; + +static const int stateTable[4][6] = +{ + /* Input: letter, number, underscore, colon, other */ + {INVALID, VALID, INVALID, INVALID, INVALID, INVALID}, + {SINGLECOLON, INVALID, INVALID, INVALID, DOUBLECOLON, INVALID}, + {DOUBLECOLON, VALID, INVALID, INVALID, INVALID, INVALID}, + {VALID, VALID, VALID, VALID, SINGLECOLON, INVALID} +}; + TypeDescriptor::TypeDescriptor() : kind_(0) , name_("") From 165ba9d6b61089374a951ca4665d092a1e5c1586 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Tue, 19 Oct 2021 09:04:59 +0200 Subject: [PATCH 2/2] Uncrustify Signed-off-by: Miguel Company --- include/fastrtps/types/TypeDescriptor.h | 44 +++++++++++++++++-------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/include/fastrtps/types/TypeDescriptor.h b/include/fastrtps/types/TypeDescriptor.h index 49cc6b48966..e02c1163e35 100644 --- a/include/fastrtps/types/TypeDescriptor.h +++ b/include/fastrtps/types/TypeDescriptor.h @@ -28,6 +28,7 @@ namespace types { class TypeDescriptor { protected: + TypeKind kind_; // Type Kind. std::string name_; // Type Name. DynamicType_ptr base_type_; // SuperType of an structure or base type of an alias type. @@ -39,7 +40,8 @@ class TypeDescriptor void clean(); - bool is_type_name_consistent(const std::string& sName) const; + bool is_type_name_consistent( + const std::string& sName) const; friend class DynamicTypeBuilderFactory; friend class TypeObjectFactory; @@ -48,9 +50,11 @@ class TypeDescriptor friend class DynamicDataHelper; public: + TypeDescriptor(); - TypeDescriptor(const TypeDescriptor* other); + TypeDescriptor( + const TypeDescriptor* other); TypeDescriptor( const std::string& name, @@ -58,15 +62,18 @@ class TypeDescriptor ~TypeDescriptor(); - ReturnCode_t copy_from(const TypeDescriptor* descriptor); + ReturnCode_t copy_from( + const TypeDescriptor* descriptor); - bool equals(const TypeDescriptor* descriptor) const; + bool equals( + const TypeDescriptor* descriptor) const; bool is_consistent() const; DynamicType_ptr get_base_type() const; - uint32_t get_bounds(uint32_t index = 0) const; + uint32_t get_bounds( + uint32_t index = 0) const; uint32_t get_bounds_size() const; @@ -82,18 +89,22 @@ class TypeDescriptor uint32_t get_total_bounds() const; - void set_kind(TypeKind kind); + void set_kind( + TypeKind kind); - void set_name(std::string name); + void set_name( + std::string name); - ReturnCode_t apply_annotation(AnnotationDescriptor& descriptor); + ReturnCode_t apply_annotation( + AnnotationDescriptor& descriptor); ReturnCode_t apply_annotation( const std::string& annotation_name, const std::string& key, const std::string& value); - AnnotationDescriptor* get_annotation(const std::string& name) const; + AnnotationDescriptor* get_annotation( + const std::string& name) const; // Annotations application bool annotation_is_extensibility() const; @@ -122,7 +133,8 @@ class TypeDescriptor bool annotation_get_key() const; // Annotation setters - void annotation_set_extensibility(const std::string& extensibility); + void annotation_set_extensibility( + const std::string& extensibility); void annotation_set_mutable(); @@ -130,13 +142,17 @@ class TypeDescriptor void annotation_set_appendable(); - void annotation_set_nested(bool nested); + void annotation_set_nested( + bool nested); - void annotation_set_bit_bound(uint16_t bit_bound); + void annotation_set_bit_bound( + uint16_t bit_bound); - void annotation_set_key(bool key); + void annotation_set_key( + bool key); - void annotation_set_non_serialized(bool non_serialized); + void annotation_set_non_serialized( + bool non_serialized); }; } // namespace types