Skip to content

Commit

Permalink
Refs #20129: create register_type_object_representation method in Typ…
Browse files Browse the repository at this point in the history
…eSupport

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>
  • Loading branch information
JLBuenoLopez committed Jan 9, 2024
1 parent 2711009 commit 8d18232
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
13 changes: 0 additions & 13 deletions src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ $endif$

$ctx.directIncludeDependencies : {include | #include "$include$.hpp"}; separator="\n"$

$if (ctx.generateTypeObjectSupport)$
#include "$ctx.filename$TypeObjectSupport.hpp"
$endif$

#if defined(_WIN32)
#if defined(EPROSIMA_USER_DLL_EXPORT)
#define eProsima_user_DllExport __declspec( dllexport )
Expand Down Expand Up @@ -157,10 +153,6 @@ public:
: $struct_inherit_default_init(struct.inheritance)$
$endif$
{
$if (ctx.generateTypeObjectSupport)$
// Register TypeObject in Fast DDS DomainParticipantFactory TypeObjectRegistry.
register_$ctx.filename$_type_objects();
$endif$
}

/*!
Expand Down Expand Up @@ -308,11 +300,6 @@ public:
$else$
m__d = $first(first(union.members).labels)$;
$endif$

$if (ctx.generateTypeObjectSupport)$
// Register TypeObject in Fast DDS DomainParticipantFactory TypeObjectRegistry.
register_$ctx.filename$_type_objects();
$endif$
}

/*!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ public:
eProsima_user_DllExport void deleteData(
void* data) override;

//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() const override;

#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ import "eprosima.stg"
main(ctx, definitions) ::= <<
$fileHeader(ctx=ctx, file=[ctx.filename, "PubSubTypes.cpp"], description=["This header file contains the implementation of the serialization functions."])$

#include "$ctx.filename$PubSubTypes.h"

#include <fastdds/dds/log/Log.hpp>
#include <fastdds/rtps/common/CdrSerialization.hpp>

#include "$ctx.filename$PubSubTypes.h"
#include "$ctx.filename$CdrAux.hpp"
$if (ctx.generateTypeObjectSupport)$
#include "$ctx.filename$TypeObjectSupport.hpp"
$endif$

using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t;
using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t;
Expand Down Expand Up @@ -235,6 +239,16 @@ bool $struct.name$PubSubType::getKey(
return true;
}

void $struct.name$PubSubType::register_type_object_representation() const
{
$if (ctx.generateTypeObjectSupport)$
register_$ctx.filename$_type_objects();
$else$
EPROSIMA_LOG_WARNING(XTYPES_TYPE_REPRESENTATION,
"TypeObject type representation support disabled in generated code");
$endif$
}

>>

//{ Fast DDS-Gen extensions
Expand Down

0 comments on commit 8d18232

Please sign in to comment.