Skip to content

Commit b1a003e

Browse files
authored
Add fixed string getter (#492)
Signed-off-by: Jesus Perez <[email protected]>
1 parent 0c2745d commit b1a003e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/java/com/eprosima/fastcdr/idl/templates/TypesSwigInterface.stg

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ class RpcFuture {
154154
~RpcFuture();
155155
RpcFuture& operator=(const RpcFuture& rhs) = delete;
156156
RpcFuture& operator=(RpcFuture&&) noexcept;
157-
157+
158158
// retrieving the value
159159
R get();
160-
160+
161161
// functions to check state
162162
bool valid() const noexcept;
163163
void wait() const;
@@ -350,6 +350,11 @@ $if(member.typecode.isStringType && member.typecode.isBounded)$
350350
eprosima::fastcdr::fixed_string<$member.typecode.maxsize$> tmp(value);
351351
\$self->$member.name$(tmp);
352352
}
353+
354+
std::string $member.name$_str() const
355+
{
356+
return std::string(\$self->$member.name$(), strnlen(\$self->$member.name$(), $member.typecode.maxsize$));
357+
}
353358
}
354359
$endif$
355360

@@ -406,7 +411,7 @@ output_non_feed(type) ::= <<
406411
%shared_ptr(eprosima::fastdds::dds::rpc::RpcFuture<$type.cppTypename$>);
407412
%template($type.formatedCppTypename$_rpc_future) eprosima::fastdds::dds::rpc::RpcFuture<$type.cppTypename$>;
408413

409-
$!
414+
$!
410415
// Combine the typemap from shared_ptr
411416
// https://github.com/swig/swig/blob/b96b955ca15a01f0425fb26c234528530923202a/Lib/python/boost_shared_ptr.i#L41-L44
412417
// with the use of the 'optimal' attribute to avoid the need for a copy constructor, inspired by

0 commit comments

Comments
 (0)