Skip to content

Commit

Permalink
DynamicType implementation (#4190)
Browse files Browse the repository at this point in the history
* Refs 17138. DynamicTypePtr as shared_ptr alias

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Solve singleton initialization issues.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Updating DynamicTypeBuilder(Factory)

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Linter

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Refactor to follow standard guidelines

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixed annotations issues on TypeObject generation

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Natural conversion from DynamicTypeXXX to TypeDescriptor.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing Ubuntu build issues

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Use type singletons for builder singletons

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Tests fixes

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. doxygen and testing works

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. ScopeLogs ancillary

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing DynamicData enum interfaces

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing DynamicData bitmask interfaces

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fix auto-id numbering

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. force explicit DynamicData creation

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing DynamicData serialization, comparisson and copy

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing map implementation

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing struct implementation

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing struct inheritance

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Trimming APIs

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing union implementation

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing xml profile testing

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. debugging recursive structures serialization

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. index management refactor and testing

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fix enum xml parsing

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing xml parsing tests

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing xml parsing tests

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. update serialization/deserialization to avoid runtime allocations

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing union default testing

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing xml parsing tests

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing bitsets ...

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. all tests fixed

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. moving dynamic tracker from runtime polymorphism to build time one

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing examples and blackbox testing

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. consistency fixes on type creation

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. ostream support for annotations

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing dll export issues. New test binary to check them.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Completing doxygen. Fixing CI issues.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing performance tests.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Minor CI fixes

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Make create_xxx_builder() return constants only for static members.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing fastdds cli to work on python venv on windows

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing doxygen.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. CI API fixes

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Several test fixes

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing DynamicType generation from TypeObjec

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Refactor of MemberId and some serialization fixes

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. API and serialization fixes

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Adapting test & examples to the new MemberId. Avoiding fastcdr dependency.

Signed-off-by: Miguel Barro <[email protected]>

REfs 17138. Test fixes. Avoiding static_cast<MemberId>. @external allows adding members without explicit type.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Finishing doxygen

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing typos

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing Mac/Windows CI issues

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fix Mac debug conditions

Refs 17138. Unifying attribute handling on config.h.in

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Moving the new API to types::v1_3 namespace. Fixing testing & examples.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing docs and gcc issues

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Reintroducing sources
            Fixing ambiguities and building fastrtps
            Fixing examples and tests.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Providing backwards compatibility with xtypes 1.1

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Adapt test and examples to xtypes 1.1 restoration

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. GCC and MSVC toolset 141 fixes

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Tests and doc tests fixes

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixes testing DDSDynamicHelloWorld

Signed-off-by: Miguel Barro <[email protected]>

REfs 17138. Fix Mac CI warnings

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Reintroduced the TypeLookUpExample

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Refactoring TypeLookupService to support both xtypes versions

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Refactoring TypeLookupService to support both xtypes versions. Debugging outcome.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing DDSSimpleCommunicationTypeDiscovery.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing Mac CI issues

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Linter pass

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing Copyright dates

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Applyig api changes

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Refactor type builder creation according to review

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. create_sequence_type update according to review

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. create_map_type updated according to review

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. create_primitive_type updated according to review

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Moving from create_xxx_type to get_xxxx_type according to review

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Renaming new headers using the .hpp convention

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Test fixes.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Add external reference counting ancillary

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Refactor interfaces to raw pointers

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Introduced ancillary classes

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. API update fixes...part 1

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. API update fixes ... part 2

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. API update fixes .. part 3

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing gcc issues

Signed-off-by: Miguel Barro <[email protected]>

REfs 17138. API update fixes .. ongoing

Signed-off-by: Miguel Barro <[email protected]>

Revert "REfs 17138. API update fixes .. ongoing"

This reverts commit b6ae13f.

Signed-off-by: Miguel Barro <[email protected]>

Revert "Refs 17138. Fixing gcc issues"

This reverts commit 5b37876.

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Spliting implementation from public APIs

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. New TypeDescriptor implementation

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. New MemberDescriptor implementation

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. New Anotation & DynamicMembers implementation

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing implementation details

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicTypeBuilderFactory interface

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicType interface

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicTypeBuilder interface

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicTypeBuilderFactory to DynamicTypeBuilderFactoryImpl mapping

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. AnnotationManager interface

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. AnnotationDescriptor interface

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. MemberDescriptor interface

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicTypeMember interface

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. TypeDescriptor fixes 🛠️

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicType interface

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Rethinking annotation interfaces 🛠️

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicType and builder missing members

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicTypeMember collections interfaces

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing smart pointers

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing TypeObjectFactory ... ongoing

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixed TypeObjectFactory

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Splitting DynamicData into STL-free-interface+implementation

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicData refactor

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicDataFactory refactor

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicData implementation done

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicData_ptr refactor

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicDataImpl builds on release mode

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicDataImpl builds on debug mode

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicPubSub refactor

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicPubSub refactor

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. DynamicPubSub refactor

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing fastrtps target build

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing fastrtps target build

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing fastrtps target linking

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing gcc errors

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixing gcc errors

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. updating examples

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixed examples

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. simplify loans

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138: fix DDSSQLFilterTests

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138: fixing ParticipantTests

Signed-off-by: Miguel Barro <[email protected]>

fixed ParticipantTests

Signed-off-by: Miguel Barro <[email protected]>

fixed BlackboxTests_DDS_PIM

Signed-off-by: Miguel Barro <[email protected]>

fixed DDSSimpleCommunicationDynamicPublisher

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. fixed DDSSimpleCommunicationDynamicSubscriber

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Creating mocks for XMLProfile testing

Signed-off-by: Miguel Barro <[email protected]>

Revert "Refs 17138. Creating mocks for XMLProfile testing"

This reverts commit 40c42c9.

Refs 17138. Fixed XMLProfileParserTests

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Propagate include dependencies with xtypes target

Signed-off-by: Miguel Barro <[email protected]>

Refs 17138. Fixing DynamicTypesTests

Signed-off-by: Miguel Barro <[email protected]>

Refs #18494. Making it compile

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. Applied new dynamic-types Types.hpp

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. New TypeDescriptor

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. Applying new TypeDescriptor

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. Update after rebase new TypeDescriptor

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. New MemberDescriptor API

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. New MemberDescriptor impl

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. Fix after rebase

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. New AnnotationDescriptor impl

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. New DynamicTypeMember API

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. New DynamicTypeMember impl

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. Fix after rebase

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. New DynamicType API

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. New DynamicType impl

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. New DynamicTypeBuilder API

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. New DynamicTypeBuilder impl

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. New DynamicTypeBuilderFactory API

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 17138. New DynamicTypeBuilderFactory impl

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. New DynamicData API

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. New DynamicData impl

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix after rebase

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fixes

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Continue impl DynamicData

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. First approach XVCRv2

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Several:

- Support enum
- Fix clearing functions

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Support string types

* Refs #17138. Support string types

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fixes after rebase

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Add primitive sequences

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Support sequences inside sequences

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Support of arrays

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Improve structure support

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Support unions.

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Support of maps.

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Support of bitmasks

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix rebase and remove use of old dynamic api

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Remove old code

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Refactor test to use DDS API

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fixes

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Bring to live xml tests

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Forgotten use of template

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Support of bitsets

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138.

Implementation:

- serialize_key
- calculate_key_serialized_size
- calculate_max_serialized_size

Add extensibility check.
Fix serialization of key.

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138.  Testing calculate_max_serialized_size.

Also fix checking string bound.

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Implement DynamicData::clone

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Implement get_complex_data

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix aliases of enumerators

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Move dynamictests to feature folder

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Implementation set_complex_value

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix warning on windows

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Improve alias management

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Remove unused file

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix warnings on Windows

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Change Bitmask behaviour

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix warnings on Windows

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Improve bitmask usage

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Removed examples

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix warnings

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix bitfield as boolean

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix warnings on windows

Signed-off-by: Ricardo González <[email protected]>

* Refs #17138. Fix bitset

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Remove unused header

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Using new CdrSizeCalculator API for arrays

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Refactor xtypes interface library

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix warnings on windows

Signed-off-by: Ricardo González <[email protected]>

* Refs #17138. Improves reviewing

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix deserialization of unions

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Applying review

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Applying changes after review

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Several fixes

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Several fixes

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138.

- Improve enumerations
- Fix reading bitset from XML
- Ordering function in some classes

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138.

- Fix sequence of strings
- Fix sequence of bitmask
- Add promotion on sequences

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Remove obsolete test code

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fixing arrays and sequences

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Remove todos

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix accessing an empty sequence

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix warning on windows

Signed-off-by: Ricardo González <[email protected]>

* Refs #17138. Fix warnings on windows

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix warnings on windows

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix warnings

Signed-off-by: Ricardo González <[email protected]>

* Refs #17138. Fixes in maps

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Apply suggestions 1

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Apply suggestions 2

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix inheritance

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Apply suggestions 3

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Apply suggestions 4

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Forgotten suggestion

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Applying suggestions 5

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Move test to other branch

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Applying suggestions 6

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Apply suggestions 7

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Apply suggestion 8

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Apply suggestions 9

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #17138. Fix uncrustify

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #20595: apply review suggestions

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

* Refs #20595: linters

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

* Refs #20595: apply review suggestion and fix Mac warnings

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

---------

Signed-off-by: Ricardo González Moreno <[email protected]>
Signed-off-by: Ricardo González <[email protected]>
Signed-off-by: Ricardo González <[email protected]>
Signed-off-by: JLBuenoLopez-eProsima <[email protected]>
Co-authored-by: Miguel Barro <[email protected]>
Co-authored-by: JLBuenoLopez-eProsima <[email protected]>
  • Loading branch information
3 people authored Mar 25, 2024
1 parent 45ea8b7 commit b2037b3
Show file tree
Hide file tree
Showing 246 changed files with 13,683 additions and 136,257 deletions.
1 change: 0 additions & 1 deletion examples/cpp/dds/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ add_subdirectory(SampleConfig_Controller)
add_subdirectory(SampleConfig_Events)
add_subdirectory(SampleConfig_Multimedia)
add_subdirectory(StaticHelloWorldExample)
add_subdirectory(TypeLookupService)
add_subdirectory(WriterLoansExample)
add_subdirectory(ZeroCopyExample)

Expand Down
90 changes: 35 additions & 55 deletions examples/cpp/dds/DynamicHelloWorldExample/HelloWorldPublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
#include <fastdds/dds/publisher/Publisher.hpp>
#include <fastdds/dds/publisher/qos/DataWriterQos.hpp>
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
#include <fastrtps/types/DynamicDataFactory.h>
#include <fastdds/dds/xtypes/dynamic_types/DynamicDataFactory.hpp>
#include <fastdds/dds/xtypes/dynamic_types/DynamicData.hpp>
#include <fastdds/dds/xtypes/dynamic_types/DynamicType.hpp>

using namespace eprosima::fastdds::dds;

Expand All @@ -47,33 +49,21 @@ bool HelloWorldPublisher::init()
return false;
}

eprosima::fastrtps::types::DynamicTypeBuilder* type;
DynamicType::_ref_type dyn_type;
if (RETCODE_OK !=
DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("HelloWorld", type))
DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("HelloWorld",
dyn_type))
{
std::cout <<
"Error getting dynamic type \"HelloWorld\"." << std::endl;
return false;
}

eprosima::fastrtps::types::DynamicType_ptr dyn_type = type->build();
TypeSupport m_type(new eprosima::fastrtps::types::DynamicPubSubType(dyn_type));
m_Hello = eprosima::fastrtps::types::DynamicDataFactory::get_instance()->create_data(dyn_type);

m_Hello->set_string_value("Hello DDS Dynamic World", 0);
m_Hello->set_uint32_value(0, 1);
eprosima::fastrtps::types::DynamicData* array = m_Hello->loan_value(2);
array->set_uint32_value(10, array->get_array_index({0, 0}));
array->set_uint32_value(20, array->get_array_index({1, 0}));
array->set_uint32_value(30, array->get_array_index({2, 0}));
array->set_uint32_value(40, array->get_array_index({3, 0}));
array->set_uint32_value(50, array->get_array_index({4, 0}));
array->set_uint32_value(60, array->get_array_index({0, 1}));
array->set_uint32_value(70, array->get_array_index({1, 1}));
array->set_uint32_value(80, array->get_array_index({2, 1}));
array->set_uint32_value(90, array->get_array_index({3, 1}));
array->set_uint32_value(100, array->get_array_index({4, 1}));
m_Hello->return_loaned_value(array);
TypeSupport m_type(new DynamicPubSubType(dyn_type));
m_Hello = DynamicDataFactory::get_instance()->create_data(dyn_type);
m_Hello->set_string_value(m_Hello->get_member_id_by_name("message"), "Hello DDS Dynamic World");
m_Hello->set_uint32_value(m_Hello->get_member_id_by_name("index"), 0);
m_Hello->set_uint32_values(m_Hello->get_member_id_by_name("array"), {10, 20, 30, 40, 50, 60, 70, 80, 90, 100});

DomainParticipantQos pqos;
pqos.name("Participant_pub");
Expand All @@ -98,7 +88,7 @@ bool HelloWorldPublisher::init()
return false;
}

topic_ = mp_participant->create_topic("DDSDynHelloWorldTopic", "HelloWorld", TOPIC_QOS_DEFAULT);
topic_ = mp_participant->create_topic("DDSDynHelloWorldTopic", m_type->getName(), TOPIC_QOS_DEFAULT);

if (topic_ == nullptr)
{
Expand Down Expand Up @@ -167,23 +157,23 @@ void HelloWorldPublisher::runThread(
if (publish(false))
{
std::string message;
m_Hello->get_string_value(message, 0);
uint32_t index;
m_Hello->get_uint32_value(index, 1);
m_Hello->get_string_value(message, m_Hello->get_member_id_by_name("message"));
uint32_t index {0};
m_Hello->get_uint32_value(index, m_Hello->get_member_id_by_name("index"));
UInt32Seq array;
m_Hello->get_uint32_values(array, m_Hello->get_member_id_by_name("array"));
std::string aux_array = "[";
eprosima::fastrtps::types::DynamicData* array = m_Hello->loan_value(2);

for (uint32_t i = 0; i < 5; ++i)
{
aux_array += "[";
for (uint32_t j = 0; j < 2; ++j)
{
uint32_t elem;
array->get_uint32_value(elem, array->get_array_index({i, j}));
aux_array += std::to_string(elem) + (j == 1 ? "]" : ", ");
aux_array += std::to_string(array.at((i * 5) + j)) + (j == 1 ? "]" : ", ");
}
aux_array += (i == 4 ? "]" : "], ");
}
m_Hello->return_loaned_value(array);

std::cout << "Message: " << message << " with index: " << index
<< " array: " << aux_array << " SENT" << std::endl;
}
Expand All @@ -201,23 +191,23 @@ void HelloWorldPublisher::runThread(
else
{
std::string message;
m_Hello->get_string_value(message, 0);
uint32_t index;
m_Hello->get_uint32_value(index, 1);
m_Hello->get_string_value(message, m_Hello->get_member_id_by_name("message"));
uint32_t index {0};
m_Hello->get_uint32_value(index, m_Hello->get_member_id_by_name("index"));
UInt32Seq array;
m_Hello->get_uint32_values(array, m_Hello->get_member_id_by_name("array"));
std::string aux_array = "[";
eprosima::fastrtps::types::DynamicData* array = m_Hello->loan_value(2);

for (uint32_t i = 0; i < 5; ++i)
{
aux_array += "[";
for (uint32_t j = 0; j < 2; ++j)
{
uint32_t elem;
array->get_uint32_value(elem, array->get_array_index({i, j}));
aux_array += std::to_string(elem) + (j == 1 ? "]" : ", ");
aux_array += std::to_string(array.at((i * 5) + j)) + (j == 1 ? "]" : ", ");
}
aux_array += (i == 4 ? "]" : "], ");
}
m_Hello->return_loaned_value(array);

std::cout << "Message: " << message << " with index: " << index
<< " array: " << aux_array << " SENT" << std::endl;
}
Expand Down Expand Up @@ -251,23 +241,13 @@ bool HelloWorldPublisher::publish(
if (m_listener.firstConnected || !waitForListener || m_listener.n_matched > 0)
{
uint32_t index;
m_Hello->get_uint32_value(index, 1);
m_Hello->set_uint32_value(index + 1, 1);

eprosima::fastrtps::types::DynamicData* array = m_Hello->loan_value(2);
array->set_uint32_value(10 + index, array->get_array_index({0, 0}));
array->set_uint32_value(20 + index, array->get_array_index({1, 0}));
array->set_uint32_value(30 + index, array->get_array_index({2, 0}));
array->set_uint32_value(40 + index, array->get_array_index({3, 0}));
array->set_uint32_value(50 + index, array->get_array_index({4, 0}));
array->set_uint32_value(60 + index, array->get_array_index({0, 1}));
array->set_uint32_value(70 + index, array->get_array_index({1, 1}));
array->set_uint32_value(80 + index, array->get_array_index({2, 1}));
array->set_uint32_value(90 + index, array->get_array_index({3, 1}));
array->set_uint32_value(100 + index, array->get_array_index({4, 1}));
m_Hello->return_loaned_value(array);

writer_->write(m_Hello.get());
m_Hello->get_uint32_value(index, m_Hello->get_member_id_by_name("index"));
m_Hello->set_uint32_value(m_Hello->get_member_id_by_name("index"), index + 1);
m_Hello->set_uint32_values(m_Hello->get_member_id_by_name(
"array"),
{10 + index, 20 + index, 30 + index, 40 + index, 50 + index, 60 + index, 70 + index, 80 + index, 90 + index,
100 + index});
writer_->write(&m_Hello);
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#ifndef HELLOWORLDPUBLISHER_H_
#define HELLOWORLDPUBLISHER_H_

#include <fastdds/dds/xtypes/dynamic_types/DynamicData.hpp>

#include <fastdds/dds/publisher/DataWriterListener.hpp>
#include <fastdds/dds/domain/DomainParticipant.hpp>

Expand All @@ -45,7 +47,7 @@ class HelloWorldPublisher

private:

eprosima::fastrtps::types::DynamicData_ptr m_Hello;
eprosima::fastdds::dds::DynamicData::_ref_type m_Hello;

eprosima::fastdds::dds::DomainParticipant* mp_participant;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include <fastdds/dds/subscriber/qos/DataReaderQos.hpp>
#include <fastdds/dds/subscriber/SampleInfo.hpp>
#include <fastdds/dds/subscriber/Subscriber.hpp>
#include <fastrtps/types/DynamicDataFactory.h>
#include <fastrtps/types/DynamicDataHelper.hpp>
#include <fastdds/dds/xtypes/dynamic_types/DynamicDataFactory.hpp>
#include <fastdds/dds/xtypes/dynamic_types/DynamicData.hpp>

using namespace eprosima::fastdds::dds;

Expand Down Expand Up @@ -114,16 +114,15 @@ void HelloWorldSubscriber::SubListener::on_data_available(

if (dit != subscriber_->datas_.end())
{
eprosima::fastrtps::types::DynamicData_ptr data = dit->second;
DynamicData::_ref_type data {dit->second};
SampleInfo info;
if (reader->take_next_sample(data.get(), &info) == RETCODE_OK)
if (reader->take_next_sample(&data, &info) == RETCODE_OK)
{
if (info.instance_state == ALIVE_INSTANCE_STATE)
{
eprosima::fastrtps::types::DynamicType_ptr type = subscriber_->readers_[reader];
const DynamicType::_ref_type type {subscriber_->readers_[reader]};
this->n_samples++;
std::cout << "Received data of type " << type->get_name() << std::endl;
eprosima::fastrtps::types::DynamicDataHelper::print(data);
}
}
}
Expand All @@ -133,7 +132,7 @@ void HelloWorldSubscriber::initialize_entities()
{
auto type = m_listener.received_type_;
std::cout << "Initializing DDS entities for type: " << type->get_name() << std::endl;
TypeSupport m_type(new eprosima::fastrtps::types::DynamicPubSubType(type));
TypeSupport m_type(new DynamicPubSubType(type));
m_type.register_type(mp_participant);

if (mp_subscriber == nullptr)
Expand Down Expand Up @@ -167,8 +166,7 @@ void HelloWorldSubscriber::initialize_entities()

topics_[reader] = topic;
readers_[reader] = type;
eprosima::fastrtps::types::DynamicData_ptr data(
eprosima::fastrtps::types::DynamicDataFactory::get_instance()->create_data(type));
DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(type)};
datas_[reader] = data;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <fastdds/dds/subscriber/DataReader.hpp>
#include <fastdds/dds/subscriber/qos/DataReaderQos.hpp>
#include <fastdds/dds/subscriber/SampleInfo.hpp>
#include <fastdds/dds/xtypes/dynamic_types/DynamicData.hpp>
#include <fastdds/dds/xtypes/dynamic_types/DynamicType.hpp>

class HelloWorldSubscriber
{
Expand Down Expand Up @@ -59,9 +61,9 @@ class HelloWorldSubscriber

std::map<eprosima::fastdds::dds::DataReader*, eprosima::fastdds::dds::Topic*> topics_;

std::map<eprosima::fastdds::dds::DataReader*, eprosima::fastrtps::types::DynamicType_ptr> readers_;
std::map<eprosima::fastdds::dds::DataReader*, eprosima::fastdds::dds::DynamicType::_ref_type> readers_;

std::map<eprosima::fastdds::dds::DataReader*, eprosima::fastrtps::types::DynamicData_ptr> datas_;
std::map<eprosima::fastdds::dds::DataReader*, eprosima::fastdds::dds::DynamicData::_ref_type> datas_;

eprosima::fastdds::dds::DataReaderQos qos_;

Expand Down Expand Up @@ -99,7 +101,7 @@ class HelloWorldSubscriber

std::condition_variable types_cv_;

eprosima::fastrtps::types::DynamicType_ptr received_type_;
eprosima::fastdds::dds::DynamicType::_ref_type received_type_;

std::atomic<bool> reception_flag_{false};

Expand Down
15 changes: 6 additions & 9 deletions examples/cpp/dds/FlowControlExample/FlowControlExample.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ class FlowControlExample
eProsima_user_DllExport FlowControlExample(
const FlowControlExample& x)
{
m_message = x.m_message;
m_message = x.m_message;

m_wasFast = x.m_wasFast;
m_wasFast = x.m_wasFast;

}

Expand All @@ -104,9 +104,9 @@ class FlowControlExample
const FlowControlExample& x)
{

m_message = x.m_message;
m_message = x.m_message;

m_wasFast = x.m_wasFast;
m_wasFast = x.m_wasFast;

return *this;
}
Expand All @@ -132,7 +132,7 @@ class FlowControlExample
const FlowControlExample& x) const
{
return (m_message == x.m_message &&
m_wasFast == x.m_wasFast);
m_wasFast == x.m_wasFast);
}

/*!
Expand Down Expand Up @@ -183,7 +183,6 @@ class FlowControlExample
return m_message;
}


/*!
* @brief This function sets a value in member wasFast
* @param _wasFast New value for member wasFast
Expand Down Expand Up @@ -212,11 +211,9 @@ class FlowControlExample
return m_wasFast;
}



private:

std::array<char, 600000> m_message{0};
std::array<char, 600000> m_message;
char m_wasFast{0};

};
Expand Down
14 changes: 7 additions & 7 deletions examples/cpp/dds/Keys/samplePubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ samplePubSubType::samplePubSubType()
setName("sample");
uint32_t type_size =
#if FASTCDR_VERSION_MAJOR == 1
static_cast<uint32_t>(sample::getMaxCdrSerializedSize());
static_cast<uint32_t>(sample::getMaxCdrSerializedSize());
#else
sample_max_cdr_typesize;
#endif
sample_max_cdr_typesize;
#endif // if FASTCDR_VERSION_MAJOR == 1
type_size += static_cast<uint32_t>(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */
m_typeSize = type_size + 4; /*encapsulation*/
m_isGetKeyDefined = true;
Expand Down Expand Up @@ -150,8 +150,8 @@ std::function<uint32_t()> samplePubSubType::getSerializedSizeProvider(
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<sample*>(data), current_alignment)) +
4u /*encapsulation*/;
*static_cast<sample*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
Expand Down Expand Up @@ -189,7 +189,8 @@ bool samplePubSubType::getKey(
sample_max_key_cdr_typesize);

// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1);
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS,
eprosima::fastcdr::CdrVersion::XCDRv1);
#if FASTCDR_VERSION_MAJOR == 1
p_type->serializeKey(ser);
#else
Expand Down Expand Up @@ -224,6 +225,5 @@ void samplePubSubType::register_type_object_representation() const
register_sample_type_objects();
}


// Include auxiliary functions like for serializing/deserializing.
#include "sampleCdrAux.ipp"
Loading

0 comments on commit b2037b3

Please sign in to comment.