Skip to content

Commit

Permalink
Use NO_KEY GUID variant if Cyclone DDS supports it
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Boasson <eb@ilities.com>
  • Loading branch information
eboasson committed Aug 22, 2019
1 parent 8844880 commit 43f70ed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rmw_cyclonedds_cpp/include/rmw_cyclonedds_cpp/serdata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ struct sertopic_rmw : ddsi_sertopic
{
CddsTypeSupport type_support;
bool is_request_header;
#if !DDSI_SERTOPIC_HAS_TOPICKIND_NO_KEY
std::string cpp_name;
std::string cpp_type_name;
std::string cpp_name_type_name;
#endif
};

struct serdata_rmw : ddsi_serdata
Expand Down
10 changes: 9 additions & 1 deletion rmw_cyclonedds_cpp/src/serdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ static const struct ddsi_serdata_ops serdata_rmw_ops = {
static void sertopic_rmw_free(struct ddsi_sertopic * tpcmn)
{
struct sertopic_rmw * tp = static_cast<struct sertopic_rmw *>(tpcmn);
#if DDSI_SERTOPIC_HAS_TOPICKIND_NO_KEY
ddsi_sertopic_fini(tpcmn);
#endif
delete tp;
}

Expand Down Expand Up @@ -421,6 +424,11 @@ struct sertopic_rmw * create_sertopic(
void * type_support, bool is_request_header)
{
struct sertopic_rmw * st = new struct sertopic_rmw;
#if DDSI_SERTOPIC_HAS_TOPICKIND_NO_KEY
std::string type_name = get_type_name(type_support_identifier, type_support);
ddsi_sertopic_init(static_cast<struct ddsi_sertopic *>(st), topicname,
type_name.c_str(), &sertopic_rmw_ops, &serdata_rmw_ops, true);
#else
memset(st, 0, sizeof(struct ddsi_sertopic));
st->cpp_name = std::string(topicname);
st->cpp_type_name = get_type_name(type_support_identifier, type_support);
Expand All @@ -433,7 +441,7 @@ struct sertopic_rmw * create_sertopic(
st->type_name = const_cast<char *>(st->cpp_type_name.c_str());
st->iid = ddsi_iid_gen();
ddsrt_atomic_st32(&st->refc, 1);

#endif
st->type_support.typesupport_identifier_ = type_support_identifier;
st->type_support.type_support_ = type_support;
st->is_request_header = is_request_header;
Expand Down

0 comments on commit 43f70ed

Please sign in to comment.