Skip to content

Commit

Permalink
Refs #19787. Fix errors
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo González Moreno <[email protected]>
  • Loading branch information
richiware committed Oct 26, 2023
1 parent 46e6229 commit 3d3bfb1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ $endif$
* @brief This class represents the TopicDataType of the type $struct.name$ defined by the user in the IDL file.
* @ingroup $ctx.trimfilename$
*/
class $if(parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType : public eprosima::fastdds::dds::TopicDataType
class $struct.name$PubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:

typedef $if(parent.IsInterface)$$parent.name$_$endif$$struct.name$ type;
typedef $struct.name$ type;

eProsima_user_DllExport $if(parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType();
eProsima_user_DllExport $struct.name$PubSubType();

eProsima_user_DllExport ~$if(parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType() override;
eProsima_user_DllExport ~$struct.name$PubSubType() override;

eProsima_user_DllExport bool serialize(
void* data,
Expand Down Expand Up @@ -225,7 +225,7 @@ public:
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
$if (struct.isPlain)$new (memory) $if(parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$()$else$static_cast<void>(memory)$endif$;
$if (struct.isPlain)$new (memory) $struct.name$()$else$static_cast<void>(memory)$endif$;
return $if (struct.isPlain)$true$else$false$endif$;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ typedef_decl(ctx, parent, typedefs, typedefs_type, declarator_type) ::= <<

$declarator_type$
$typedefs_type$

>>

struct_type(ctx, parent, struct, member_list) ::= <<
$member_list$
$if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::$if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType()
$struct.name$PubSubType::$struct.name$PubSubType()
{
$if(ctx.GenerateTypesROS2)$setName("$struct.ROS2Scopedname$");$else$setName("$struct.scopedname$");$endif$
uint32_t type_size = $struct.cScopedname$_max_cdr_typesize;
Expand All @@ -104,20 +104,20 @@ $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::$if (pare
memset(m_keyBuffer, 0, keyLength);
}

$if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::~$if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType()
$struct.name$PubSubType::~$struct.name$PubSubType()
{
if (m_keyBuffer != nullptr)
{
free(m_keyBuffer);
}
}

bool $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::serialize(
bool $struct.name$PubSubType::serialize(
void* data,
SerializedPayload_t* payload,
DataRepresentationId_t data_representation)
{
$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$* p_type = static_cast<$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$*>(data);
$struct.name$* p_type = static_cast<$struct.name$*>(data);

// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->max_size);
Expand Down Expand Up @@ -148,14 +148,14 @@ bool $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::seri
return true;
}

bool $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::deserialize(
bool $struct.name$PubSubType::deserialize(
SerializedPayload_t* payload,
void* data)
{
try
{
// Convert DATA to pointer of your type
$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$* p_type = static_cast<$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$*>(data);
$struct.name$* p_type = static_cast<$struct.name$*>(data);

// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->length);
Expand All @@ -178,7 +178,7 @@ bool $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::dese
return true;
}

std::function<uint32_t()> $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::getSerializedSizeProvider(
std::function<uint32_t()> $struct.name$PubSubType::getSerializedSizeProvider(
void* data,
DataRepresentationId_t data_representation)
{
Expand All @@ -191,7 +191,7 @@ std::function<uint32_t()> $if (parent.IsInterface)$$parent.name$_$endif$$struct.
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<$if (parent.IsInterface)$$parent.name$_$endif$$struct.name$*>(data), current_alignment)) +
*static_cast<$struct.name$*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
Expand All @@ -201,18 +201,18 @@ std::function<uint32_t()> $if (parent.IsInterface)$$parent.name$_$endif$$struct.
};
}

void* $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::createData()
void* $struct.name$PubSubType::createData()
{
return reinterpret_cast<void*>(new $if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$());
return reinterpret_cast<void*>(new $struct.name$());
}

void $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::deleteData(
void $struct.name$PubSubType::deleteData(
void* data)
{
delete(reinterpret_cast<$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$*>(data));
delete(reinterpret_cast<$struct.name$*>(data));
}

bool $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::getKey(
bool $struct.name$PubSubType::getKey(
void* data,
InstanceHandle_t* handle,
bool force_md5)
Expand All @@ -222,7 +222,7 @@ bool $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::getK
return false;
}

$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$* p_type = static_cast<$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$*>(data);
$struct.name$* p_type = static_cast<$struct.name$*>(data);

// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1408,8 +1408,8 @@ const TypeObject* GetComplete$bitmask.name$Object()

type_object->complete().bitmask_type().header().common().bit_bound($bitmask.bitBound$);

$if(union.annotationList)$
$union.annotationList:{ ann |
$if(bitmask.annotationList)$
$bitmask.annotationList:{ ann |
{
AppliedAnnotation ann;
//ann.annotation_typeid(Get$ann.name$Identifier(true));
Expand Down Expand Up @@ -1648,8 +1648,8 @@ const TypeObject* GetComplete$bitset.name$Object()
//type_object->complete().bitset_type().bitset_flags().IS_NESTED(false);
//type_object->complete().bitset_type().bitset_flags().IS_AUTOID_HASH(false);

$if(union.annotationList)$
$union.annotationList:{ ann |
$if(bitset.annotationList)$
$bitset.annotationList:{ ann |
{
AppliedAnnotation ann;
//ann.annotation_typeid(Get$ann.name$Identifier(true));
Expand Down

0 comments on commit 3d3bfb1

Please sign in to comment.