Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ set(${PROJECT_NAME}_schema_files
)

# testing static types
file(GLOB ${PROJECT_NAME}_static_types
resources/static_types/*.*
file(GLOB ${PROJECT_NAME}_xtypes
resources/xtypes/*.*
)

#filter out the idl within the static types
set( ${PROJECT_NAME}_idl ${${PROJECT_NAME}_static_types} )
set( ${PROJECT_NAME}_idl ${${PROJECT_NAME}_xtypes} )
list(FILTER ${PROJECT_NAME}_idl INCLUDE REGEX "\\.idl$" )

set(${PROJECT_NAME}_header_files
Expand All @@ -329,11 +329,11 @@ set(${PROJECT_NAME}_source_files

# Executable
add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_source_files} ${${PROJECT_NAME}_header_files}
${${PROJECT_NAME}_python_tests} ${${PROJECT_NAME}_static_types})
${${PROJECT_NAME}_python_tests} ${${PROJECT_NAME}_xtypes})

# schema, types and auxiliary xmls
source_group(resources\\xsd FILES ${${PROJECT_NAME}_schema_files} )
source_group(resources\\static_types FILES ${${PROJECT_NAME}_static_types} )
source_group(resources\\xtypes FILES ${${PROJECT_NAME}_xtypes} )

# avoid visual studio from trying to compile .idl files with midl
set_source_files_properties(${${PROJECT_NAME}_idl} PROPERTIES HEADER_FILE_ONLY TRUE)
Expand Down
2 changes: 1 addition & 1 deletion include/LateJoiner.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "DiscoveryServerManager.h"
#include "log/DSLog.h"
#include "../resources/static_types/HelloWorldPubSubTypes.hpp"
#include "../resources/xtypes/HelloWorldPubSubTypes.hpp"

namespace eprosima {
namespace discovery_server {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@extensibility(APPENDABLE)
struct HelloWorld
{
unsigned long index;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <fastdds/rtps/common/CdrSerialization.hpp>

#include "HelloWorldCdrAux.hpp"
#include "HelloWorldTypeObjectSupport.hpp"

using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t;
using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t;
using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t;
Expand Down Expand Up @@ -206,8 +208,7 @@ bool HelloWorldPubSubType::compute_key(

void HelloWorldPubSubType::register_type_object_representation()
{
EPROSIMA_LOG_WARNING(XTYPES_TYPE_REPRESENTATION,
"TypeObject type representation support disabled in generated code");
register_HelloWorld_type_identifier(type_identifiers_);
}


Expand Down
145 changes: 145 additions & 0 deletions resources/xtypes/HelloWorldTypeObjectSupport.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// Copyright 2016 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 HelloWorldTypeObjectSupport.cxx
* Source file containing the implementation to register the TypeObject representation of the described types in the IDL file
*
* This file was generated by the tool fastddsgen.
*/

#include "HelloWorldTypeObjectSupport.hpp"

#include <mutex>
#include <string>

#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
#include <fastdds/dds/log/Log.hpp>
#include <fastdds/dds/xtypes/common.hpp>
#include <fastdds/dds/xtypes/type_representation/ITypeObjectRegistry.hpp>
#include <fastdds/dds/xtypes/type_representation/TypeObject.hpp>
#include <fastdds/dds/xtypes/type_representation/TypeObjectUtils.hpp>

#include "HelloWorld.hpp"


using namespace eprosima::fastdds::dds::xtypes;

// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method
void register_HelloWorld_type_identifier(
TypeIdentifierPair& type_ids_HelloWorld)
{

ReturnCode_t return_code_HelloWorld {eprosima::fastdds::dds::RETCODE_OK};
return_code_HelloWorld =
eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers(
"HelloWorld", type_ids_HelloWorld);
if (eprosima::fastdds::dds::RETCODE_OK != return_code_HelloWorld)
{
StructTypeFlag struct_flags_HelloWorld = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE,
false, false);
QualifiedTypeName type_name_HelloWorld = "HelloWorld";
eprosima::fastcdr::optional<AppliedBuiltinTypeAnnotations> type_ann_builtin_HelloWorld;
eprosima::fastcdr::optional<AppliedAnnotationSeq> ann_custom_HelloWorld;
AppliedAnnotationSeq tmp_ann_custom_HelloWorld;
eprosima::fastcdr::optional<AppliedVerbatimAnnotation> verbatim_HelloWorld;
if (!tmp_ann_custom_HelloWorld.empty())
{
ann_custom_HelloWorld = tmp_ann_custom_HelloWorld;
}

CompleteTypeDetail detail_HelloWorld = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_HelloWorld, ann_custom_HelloWorld, type_name_HelloWorld.to_string());
CompleteStructHeader header_HelloWorld;
header_HelloWorld = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_HelloWorld);
CompleteStructMemberSeq member_seq_HelloWorld;
{
TypeIdentifierPair type_ids_index;
ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK};
return_code_index =
eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers(
"_uint32_t", type_ids_index);

if (eprosima::fastdds::dds::RETCODE_OK != return_code_index)
{
EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION,
"index Structure member TypeIdentifier unknown to TypeObjectRegistry.");
return;
}
StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD,
false, false, false, false);
MemberId member_id_index = 0x00000000;
bool common_index_ec {false};
CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))};
if (!common_index_ec)
{
EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent.");
return;
}
MemberName name_index = "index";
eprosima::fastcdr::optional<AppliedBuiltinMemberAnnotations> member_ann_builtin_index;
ann_custom_HelloWorld.reset();
CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_HelloWorld);
CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index);
TypeObjectUtils::add_complete_struct_member(member_seq_HelloWorld, member_index);
}
{
TypeIdentifierPair type_ids_message;
ReturnCode_t return_code_message {eprosima::fastdds::dds::RETCODE_OK};
return_code_message =
eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers(
"anonymous_string_unbounded", type_ids_message);

if (eprosima::fastdds::dds::RETCODE_OK != return_code_message)
{
{
SBound bound = 0;
StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound);
if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER ==
TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn,
"anonymous_string_unbounded", type_ids_message))
{
EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION,
"anonymous_string_unbounded already registered in TypeObjectRegistry for a different type.");
}
}
}
StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD,
false, false, false, false);
MemberId member_id_message = 0x00000001;
bool common_message_ec {false};
CommonStructMember common_message {TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_message, common_message_ec))};
if (!common_message_ec)
{
EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure message member TypeIdentifier inconsistent.");
return;
}
MemberName name_message = "message";
eprosima::fastcdr::optional<AppliedBuiltinMemberAnnotations> member_ann_builtin_message;
ann_custom_HelloWorld.reset();
CompleteMemberDetail detail_message = TypeObjectUtils::build_complete_member_detail(name_message, member_ann_builtin_message, ann_custom_HelloWorld);
CompleteStructMember member_message = TypeObjectUtils::build_complete_struct_member(common_message, detail_message);
TypeObjectUtils::add_complete_struct_member(member_seq_HelloWorld, member_message);
}
CompleteStructType struct_type_HelloWorld = TypeObjectUtils::build_complete_struct_type(struct_flags_HelloWorld, header_HelloWorld, member_seq_HelloWorld);
if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER ==
TypeObjectUtils::build_and_register_struct_type_object(struct_type_HelloWorld, type_name_HelloWorld.to_string(), type_ids_HelloWorld))
{
EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION,
"HelloWorld already registered in TypeObjectRegistry for a different type.");
}
}
}

56 changes: 56 additions & 0 deletions resources/xtypes/HelloWorldTypeObjectSupport.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2016 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 HelloWorldTypeObjectSupport.hpp
* Header file containing the API required to register the TypeObject representation of the described types in the IDL file
*
* This file was generated by the tool fastddsgen.
*/

#ifndef FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP
#define FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP

#include <fastdds/dds/xtypes/type_representation/TypeObject.hpp>


#if defined(_WIN32)
#if defined(EPROSIMA_USER_DLL_EXPORT)
#define eProsima_user_DllExport __declspec( dllexport )
#else
#define eProsima_user_DllExport
#endif // EPROSIMA_USER_DLL_EXPORT
#else
#define eProsima_user_DllExport
#endif // _WIN32

#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC

/**
* @brief Register HelloWorld related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_HelloWorld_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);


#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC

#endif // FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP
16 changes: 11 additions & 5 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ list(APPEND TEST_LIST
test_21_disposals_remote_server_trivial
test_22_environment_variable_setup

test_24_backup
test_25_backup_compatibility
test_26_backup_restore
# test_24_backup
# test_25_backup_compatibility
# test_26_backup_restore

test_27_slow_arise
test_28_slow_arise_interconnection
Expand Down Expand Up @@ -106,6 +106,13 @@ list(APPEND TEST_LIST
test_97_tcpv4_env_var
test_98_tcpv6_env_var
test_99_tcp

test_101_trivial_xtypes
test_102_single_server_medium_xtypes
test_103_single_server_large_xtypes
test_106_diamond_servers_xtypes
test_108_server_endpoints_four_clients_xtypes
test_114_disposals_remote_servers_xtypes
)

# This test does not run in Fast DDS 2.0.x because signal handling for closing the tool was not
Expand Down Expand Up @@ -134,8 +141,7 @@ list(APPEND TEST_LIST
set(TEST_CASE_LIST)

# Test that are leaky and may fail
set(FAIL_TEST_CASES
test_26_backup_restore)
set(FAIL_TEST_CASES)

# For each test case, create different executables for each configuration
foreach(TEST IN LISTS TEST_LIST)
Expand Down
73 changes: 73 additions & 0 deletions test/configuration/test_cases/test_101_trivial_xtypes_clients.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<clients>
<client name="client1" profile_name="UDP_client1_server1">
<publisher topic="topic1"/>
</client>
<client name="client2" profile_name="UDP_client2_server1">
<subscriber topic="topic1"/>
</client>
</clients>

<snapshots file="./test_101_trivial_clients.snapshot~">
<snapshot time="4">test_101_trivial_clients</snapshot>
</snapshots>

<profiles>
<participant profile_name="UDP_client1_server1" >
<rtps>
<prefix>63.6c.69.65.6e.74.31.5f.73.31.5f.5f</prefix>
<builtin>
<discovery_config>
<discoveryProtocol>CLIENT</discoveryProtocol>
<discoveryServersList>
<locator>
<udpv4>
<address>127.0.0.1</address>
<port>01811</port>
</udpv4>
</locator>
</discoveryServersList>
<initialAnnouncements>
<count>0</count>
</initialAnnouncements>
<leaseAnnouncement>DURATION_INFINITY</leaseAnnouncement>
<leaseDuration>DURATION_INFINITY</leaseDuration>
</discovery_config>
</builtin>
</rtps>
</participant>

<participant profile_name="UDP_client2_server1" >
<rtps>
<prefix>63.6c.69.65.6e.74.32.5f.73.31.5f.5f</prefix>
<builtin>
<discovery_config>
<discoveryProtocol>CLIENT</discoveryProtocol>
<discoveryServersList>
<locator>
<udpv4>
<address>127.0.0.1</address>
<port>01811</port>
</udpv4>
</locator>
</discoveryServersList>
<initialAnnouncements>
<count>0</count>
</initialAnnouncements>
<leaseAnnouncement>DURATION_INFINITY</leaseAnnouncement>
<leaseDuration>DURATION_INFINITY</leaseDuration>
</discovery_config>
</builtin>
</rtps>
</participant>

<topic profile_name="topic1">
<name>topic_1</name>
<dataType>HelloWorld</dataType>
</topic>

</profiles>
</DS>

Loading