Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[19648] TypeObjectUtils class #3974

Merged
merged 82 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
d759c0a
Refs #19648: XTypes v1.3 Annex B TypeObject IDL
JLBuenoLopez Oct 5, 2023
2ee4019
Refs #19648: generate TypeObject.idl code with Fast DDS-Gen v3.0.1
JLBuenoLopez Oct 5, 2023
4a1b4cf
Refs #19648: regenerate using bugfixes/warnings-regressions branch
JLBuenoLopez Oct 6, 2023
ee96848
Refs #19648: build new TypeObject generated code. Update headers
JLBuenoLopez Oct 6, 2023
697db5e
Refs #19648: WIP, due to external annotation max serialized size is n…
JLBuenoLopez Oct 6, 2023
f54adf9
Refs #19648: include BuiltinAnnotations.idl
JLBuenoLopez Oct 6, 2023
a8205b5
Refs #19648: builtin annotations already defined within Fast DDS-Gen:…
JLBuenoLopez Oct 6, 2023
122dc6c
Refs #19648: typo
JLBuenoLopez Oct 6, 2023
1103127
Refs #19648: update script to generate Builtin annotations TypeObject
JLBuenoLopez Oct 6, 2023
7edb191
Refs #19648: API proposal
JLBuenoLopez Oct 6, 2023
956beeb
Refs #19648: use xtypes1_3 namespace to avoid TypeInformation conflict
JLBuenoLopez Oct 9, 2023
7f8e77a
Refs #19648: apply design suggestions
JLBuenoLopez Oct 9, 2023
dafc42b
Refs #19648: add exceptions based on DDS PSM CXX specification
JLBuenoLopez Oct 10, 2023
3dadd8d
Refs #19648: API for bitmask flags, strings, sequences and arrays Typ…
JLBuenoLopez Oct 11, 2023
8435582
Refs #19648: plain maps TypeIdentifier API and unit tests
JLBuenoLopez Oct 11, 2023
277d2fa
Refs #19648: plain collections consistency methods and refactor corre…
JLBuenoLopez Oct 11, 2023
ff9a5ad
Refs #19648: register TypeObjectRegistry in DomainParticipantFactory …
JLBuenoLopez Oct 11, 2023
83502b2
Refs #19648: register indirect hash TypeIdentifiers API
JLBuenoLopez Oct 11, 2023
dca8262
Refs #19648: refactor to prevent pointer use
JLBuenoLopez Oct 11, 2023
8a0fe90
Refs #19648: add register indirect hash TypeIdentifiers tests
JLBuenoLopez Oct 11, 2023
f1aa1f8
Refs #19648: AnnotationParameterValue API
JLBuenoLopez Oct 16, 2023
f62457d
Refs #19648: add TypeObjectUtils API
JLBuenoLopez Oct 17, 2023
15a0c99
Refs #19648: more API
JLBuenoLopez Oct 18, 2023
36e1deb
Refs #19648: regenerate using external implementation. Refactor code …
JLBuenoLopez Oct 18, 2023
e7c0940
Refs #19648: fix tests
JLBuenoLopez Oct 18, 2023
54d74f2
Refs #19648: include API to TypeObjectRegistry
JLBuenoLopez Oct 19, 2023
99e93dc
Refs #19648: finish public API
JLBuenoLopez Oct 20, 2023
76353a8
Refs #19648: generate BuiltinAnnotations types to check builtin annot…
JLBuenoLopez Oct 24, 2023
fc464a8
Refs #19648: add API to access the builtin annotation complete TypeId…
JLBuenoLopez Oct 24, 2023
c443b18
Refs #19648: namespace. Include builtin annotations names and kinds a…
JLBuenoLopez Oct 24, 2023
ec1bf34
Refs #19648: add consistency API: builtin annotations, complete struc…
JLBuenoLopez Oct 24, 2023
119dc53
Refs #19648: union type consistency
JLBuenoLopez Oct 27, 2023
aa4eb10
Refs #19648: annotation cross consistency
JLBuenoLopez Oct 30, 2023
9835a8e
Refs #19648: modify API for TypeLookupService
JLBuenoLopez Oct 30, 2023
d65ead2
Refs #19648: fix calls to TypeObjectRegistry
JLBuenoLopez Oct 30, 2023
82848fd
Refs #19648: builtin annotations not included in custom annotations s…
JLBuenoLopez Oct 31, 2023
d86e44e
Refs #19648: CompleteAliasBody consistency
JLBuenoLopez Oct 31, 2023
27700e0
Refs #19648: CompleteEnumeratedLiteral consistency and fixes
JLBuenoLopez Oct 31, 2023
19e6f60
Refs #19648: enum literal sequence consistency
JLBuenoLopez Oct 31, 2023
bb4bc95
Refs #19648: CompleteBitflag consistency
JLBuenoLopez Oct 31, 2023
71c1d35
Refs #19648: bitflag sequence consistency
JLBuenoLopez Oct 31, 2023
b0b16b7
Refs #19648: CompleteBitfield consistency
JLBuenoLopez Oct 31, 2023
b556933
Refs #19648: bitfield sequence consistency
JLBuenoLopez Oct 31, 2023
7c56025
Refs #19648: fix bug
JLBuenoLopez Oct 31, 2023
87dd0ec
Refs #19648: update versions.md
JLBuenoLopez Oct 31, 2023
c6a46ba
Refs #19648: apply review suggestions
JLBuenoLopez Oct 31, 2023
645c060
Refs #19648: regenerate types using script (only IDLs introduced in t…
JLBuenoLopez Oct 31, 2023
3f4a687
Refs #19648: fix wartnings
JLBuenoLopez Oct 31, 2023
44761f8
Refs #19648: linters
JLBuenoLopez Oct 31, 2023
362eb7d
Refs #19648: remove non-applicable TODO
JLBuenoLopez Oct 31, 2023
ad4e251
Refs #19648: fix build issue
JLBuenoLopez Oct 31, 2023
53b400f
Refs #19648: fix Clang warnings
JLBuenoLopez Oct 31, 2023
1b52cf2
Refs #19648: apply review suggestion: keyed members cannot be optional
JLBuenoLopez Nov 16, 2023
3ec306a
Refs #19648: apply review suggestion: fix MemberFlags consistency checks
JLBuenoLopez Nov 16, 2023
ab64730
Refs #19648: apply review suggestion: leverage insert API
JLBuenoLopez Nov 16, 2023
ba24aa6
Refs #19648: apply review suggestions: improve error messages
JLBuenoLopez Nov 16, 2023
5cdc09a
Refs #19648: apply review suggestion: check invalid union member name
JLBuenoLopez Nov 17, 2023
2bd442a
Refs #19648: apply review suggestion: improve readability
JLBuenoLopez Nov 17, 2023
86e43fa
Refs #19648: apply review suggestions: imporvements to tests and map …
JLBuenoLopez Nov 17, 2023
63f68db
Refs #19648: apply review suggestion: ensure correct element order in…
JLBuenoLopez Nov 20, 2023
7783d0e
Refs #19648: linters
JLBuenoLopez Nov 20, 2023
774b829
Refs #19648: apply review suggestion
JLBuenoLopez Nov 20, 2023
bed1b31
Refs #19648: fix Windows warning
JLBuenoLopez Nov 20, 2023
45cdd9b
Refs #19648: apply review suggestion. Bitfield name might be empty. M…
JLBuenoLopez Nov 23, 2023
8807eaf
Refs #19648: use Fast DDS-Gen names
JLBuenoLopez Nov 23, 2023
a8d01a7
Refs #19648: use IDL from specification (https://www.omg.org/spec/DDS…
JLBuenoLopez Nov 23, 2023
714bb9d
Refs #19648: migrate to DDS ReturnCode_t
JLBuenoLopez Nov 23, 2023
cdfb13b
Refs #19648: fix IDL typo
JLBuenoLopez Nov 23, 2023
02fae41
Refs #19648: generate types
JLBuenoLopez Nov 23, 2023
3661505
Refs #19648: rename TypeIdentifierParameter to avoid conflict
JLBuenoLopez Nov 23, 2023
28b2d23
Refs #19648: rename xtypes namespace
JLBuenoLopez Nov 23, 2023
615b21a
Refs #19648: fix missing information from IDL
JLBuenoLopez Nov 23, 2023
f9fa103
Refs #19648: remove warnings
JLBuenoLopez Nov 23, 2023
1760420
Refs #19595: fix tests compilation
JLBuenoLopez Nov 24, 2023
d7d39fe
Refs #19648: regenerate BuiltinAnnotation types without empty namespaces
JLBuenoLopez Nov 24, 2023
4b06623
Refs #19648: fix uninitialized warning
JLBuenoLopez Nov 24, 2023
c90d1d5
Refs #19648: linters
JLBuenoLopez Nov 24, 2023
3a83e30
Refs #19648: fix test linkage
JLBuenoLopez Nov 27, 2023
5bdd42f
Refs #19648: fix windows warning
JLBuenoLopez Nov 27, 2023
b7c04b0
Refs #19648: WIP
JLBuenoLopez Nov 27, 2023
4e3c3db
Refs #19648: fix primitive type long double
JLBuenoLopez Nov 28, 2023
f1a59ee
Refs #19648: fix windows warning
JLBuenoLopez Nov 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions include/fastdds/dds/core/policy/QosPolicies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2510,9 +2510,9 @@ class TypeObjectV1 : public Parameter_t, public QosPolicy
namespace xtypes {

/**
* Class xtypes::TypeInformation
* Class xtypes::TypeInformationParameter
*/
class TypeInformation : public Parameter_t, public QosPolicy
class TypeInformationParameter : public Parameter_t, public QosPolicy
{
public:

Expand All @@ -2522,7 +2522,7 @@ class TypeInformation : public Parameter_t, public QosPolicy
/**
* @brief Constructor
*/
RTPS_DllAPI TypeInformation()
RTPS_DllAPI TypeInformationParameter()
: Parameter_t(PID_TYPE_INFORMATION, 0)
, QosPolicy(false)
, type_information()
Expand All @@ -2533,10 +2533,10 @@ class TypeInformation : public Parameter_t, public QosPolicy
/**
* @brief Copy constructor
*
* @param type Another instance of TypeInformation
* @param type Another instance of TypeInformationParameter
*/
RTPS_DllAPI TypeInformation(
const TypeInformation& type)
RTPS_DllAPI TypeInformationParameter(
const TypeInformationParameter& type)
: Parameter_t(type.Pid, type.length)
, QosPolicy(type.send_always_)
, type_information(type.type_information)
Expand All @@ -2549,7 +2549,7 @@ class TypeInformation : public Parameter_t, public QosPolicy
*
* @param info fastrtps::types::TypeInformation to be set
*/
RTPS_DllAPI TypeInformation(
RTPS_DllAPI TypeInformationParameter(
const fastrtps::types::TypeInformation& info)
: Parameter_t(PID_TYPE_INFORMATION, 0)
, QosPolicy(false)
Expand All @@ -2561,19 +2561,19 @@ class TypeInformation : public Parameter_t, public QosPolicy
/**
* @brief Move Constructor
*
* @param type Another instance of TypeInformation
* @param type Another instance of TypeInformationParameter
*/
RTPS_DllAPI TypeInformation(
TypeInformation&& type)
RTPS_DllAPI TypeInformationParameter(
TypeInformationParameter&& type)
: Parameter_t(type.Pid, type.length)
, QosPolicy(type.send_always_)
, type_information(std::move(type.type_information))
, assigned_(type.assigned_)
{
}

RTPS_DllAPI TypeInformation& operator =(
const TypeInformation& type)
RTPS_DllAPI TypeInformationParameter& operator =(
const TypeInformationParameter& type)
{
Pid = type.Pid;
length = type.length;
Expand All @@ -2585,8 +2585,8 @@ class TypeInformation : public Parameter_t, public QosPolicy
return *this;
}

RTPS_DllAPI TypeInformation& operator =(
TypeInformation&& type)
RTPS_DllAPI TypeInformationParameter& operator =(
TypeInformationParameter&& type)
{
Pid = type.Pid;
length = type.length;
Expand All @@ -2601,11 +2601,11 @@ class TypeInformation : public Parameter_t, public QosPolicy
/**
* @brief Destructor
*/
virtual RTPS_DllAPI ~TypeInformation() override = default;
virtual RTPS_DllAPI ~TypeInformationParameter() override = default;

inline void clear() override
{
*this = TypeInformation();
*this = TypeInformationParameter();
}

/**
Expand All @@ -2629,7 +2629,7 @@ class TypeInformation : public Parameter_t, public QosPolicy
assigned_ = value;
}

RTPS_DllAPI TypeInformation& operator =(
RTPS_DllAPI TypeInformationParameter& operator =(
const fastrtps::types::TypeInformation& type_info)
{
type_information = type_info;
Expand All @@ -2639,7 +2639,7 @@ class TypeInformation : public Parameter_t, public QosPolicy

private:

//!Boolean that states if the TypeInformation has been asigned manually or not.
//!Boolean that states if the TypeInformationParameter has been asigned manually or not.
bool assigned_;
};

Expand Down
20 changes: 14 additions & 6 deletions include/fastdds/dds/domain/DomainParticipantFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@
#ifndef _FASTDDS_DOMAINPARTICIPANT_HPP_
#define _FASTDDS_DOMAINPARTICIPANT_HPP_

#include <fastrtps/attributes/ParticipantAttributes.h>
#include <fastrtps/types/TypesBase.h>
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
#include <fastdds/dds/domain/qos/DomainParticipantFactoryQos.hpp>
#include <fastdds/dds/core/status/StatusMask.hpp>

#include <map>
#include <memory>
#include <mutex>

#include <fastdds/dds/core/status/StatusMask.hpp>
#include <fastdds/dds/domain/qos/DomainParticipantFactoryQos.hpp>
#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
#include <fastdds/dds/xtypes/type_representation/TypeObjectRegistry.hpp>

namespace eprosima {

namespace fastrtps {
Expand Down Expand Up @@ -266,6 +265,13 @@ class DomainParticipantFactory
RTPS_DllAPI ReturnCode_t set_qos(
const DomainParticipantFactoryQos& qos);

/**
* @brief Return the TypeObjectRegistry member to access the API.
*
* @return const xtypes::TypeObjectRegistry reference.
*/
RTPS_DllAPI xtypes::TypeObjectRegistry& type_object_registry();

protected:

friend class DomainParticipant;
Expand Down Expand Up @@ -313,6 +319,8 @@ class DomainParticipantFactory

std::shared_ptr<detail::LogResources> log_resources_;

xtypes::TypeObjectRegistry type_object_registry_;

/**
* This mutex guards the access to load the profiles.
* Is used to lock every thread that is trying to load the profiles, so only the first one loads it and
Expand Down
16 changes: 8 additions & 8 deletions include/fastdds/dds/topic/TopicDataType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,31 +309,31 @@ class TopicDataType
/**
* Get the type information
*
* @return TypeInformation
* @return TypeInformationParameter
*/
RTPS_DllAPI inline const std::shared_ptr<xtypes::TypeInformation> type_information() const
RTPS_DllAPI inline const std::shared_ptr<xtypes::TypeInformationParameter> type_information() const
{
return type_information_;
}

/**
* Set type information
*
* @param info new value for TypeInformation
* @param info new value for TypeInformationParameter
*/
RTPS_DllAPI inline void type_information(
const xtypes::TypeInformation& info)
const xtypes::TypeInformationParameter& info)
{
type_information_ = std::make_shared<xtypes::TypeInformation>(info);
type_information_ = std::make_shared<xtypes::TypeInformationParameter>(info);
}

/**
* Set type information
*
* @param info shared pointer to TypeInformation
* @param info shared pointer to TypeInformationParameter
*/
RTPS_DllAPI inline void type_information(
std::shared_ptr<xtypes::TypeInformation> info)
std::shared_ptr<xtypes::TypeInformationParameter> info)
{
type_information_ = std::move(info);
}
Expand Down Expand Up @@ -391,7 +391,7 @@ class TopicDataType
//!Type Object XTYPES 1.1
std::shared_ptr<TypeObjectV1> type_object_;
//!XTYPES 1.2
std::shared_ptr<xtypes::TypeInformation> type_information_;
std::shared_ptr<xtypes::TypeInformationParameter> type_information_;

private:

Expand Down
126 changes: 126 additions & 0 deletions include/fastdds/dds/xtypes/common.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

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

#ifndef _FASTDDS_DDS_XTYPES_COMMON_HPP_
#define _FASTDDS_DDS_XTYPES_COMMON_HPP_

namespace eprosima {
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
*/
enum EquivalenceKindValue
{
MINIMAL,
COMPLETE,
BOTH
};

/**
* @brief PlacementKind values (@verbatim annotation)
*/
enum PlacementKindValue
{
BEGIN_FILE,
BEFORE_DECLARATION,
BEGIN_DECLARATION,
END_DECLARATION,
AFTER_DECLARATION,
END_FILE
};

// Primitive type names
constexpr const char* boolean_type_name = "_bool";
constexpr const char* byte_type_name = "_byte";
constexpr const char* int16_type_name = "_int16_t";
constexpr const char* int32_type_name = "_int32_t";
constexpr const char* int64_type_name = "_int64_t";
constexpr const char* uint16_type_name = "_uint16_t";
constexpr const char* uint32_type_name = "_uint32_t";
constexpr const char* uint64_type_name = "_uint64_t";
constexpr const char* float32_type_name = "_float";
constexpr const char* float64_type_name = "_double";
constexpr const char* float128_type_name = "_long_double";
constexpr const char* int8_type_name = "_int8_t";
constexpr const char* uint8_type_name = "_uint8_t";
constexpr const char* char8_type_name = "_char";
constexpr const char* char16_type_name = "_wchar_t";

// Builtin annotation names
constexpr const char* id_annotation_name = "_id";
constexpr const char* autoid_annotation_name = "_autoid";
constexpr const char* optional_annotation_name = "_optional";
constexpr const char* position_annotation_name = "_position";
constexpr const char* value_annotation_name = "_value"; // Pending implementation
constexpr const char* extensibility_annotation_name = "_extensibility";
constexpr const char* final_annotation_name = "_final";
constexpr const char* appendable_annotation_name = "_appendable";
constexpr const char* mutable_annotation_name = "_mutable";
constexpr const char* key_annotation_name = "_key";
constexpr const char* must_understand_annotation_name = "_must_understand";
constexpr const char* default_literal_annotation_name = "_default_literal";
constexpr const char* default_annotation_name = "_default"; // Pending implementation
constexpr const char* range_annotation_name = "_range"; // Pending implementation
constexpr const char* min_annotation_name = "_min"; // Pending implementation
constexpr const char* max_annotation_name = "_max"; // Pending implementation
constexpr const char* unit_annotation_name = "_unit";
constexpr const char* bit_bound_annotation_name = "_bit_bound";
constexpr const char* external_annotation_name = "_external";
constexpr const char* nested_annotation_name = "_nested";
constexpr const char* verbatim_annotation_name = "_verbatim";
constexpr const char* service_annotation_name = "_service";
constexpr const char* oneway_annotation_name = "_oneway";
constexpr const char* ami_annotation_name = "_ami";
constexpr const char* hashid_annotation_name = "_hashid";
constexpr const char* default_nested_annotation_name = "_default_nested";
constexpr const char* ignore_literal_names_annotation_name = "_ignore_literal_names";
constexpr const char* try_construct_annotation_name = "_try_construct";
constexpr const char* non_serialized_annotation_name = "_non_serialized";
constexpr const char* data_representation_annotation_name = "_data_representation";
constexpr const char* topic_annotation_name = "_topic";

} // xtypes
} // dds
} // fastdds
} // eprosima

#endif // _FASTDDS_DDS_XTYPES_COMMON_HPP_
Loading