Skip to content

Commit

Permalink
Updates on rmw_fastrtps_dynamic_cpp.
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <[email protected]>
  • Loading branch information
MiguelCompany committed Mar 22, 2021
1 parent 136a65c commit d281a69
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ MessageTypeSupport<MembersType>::MessageTypeSupport(
ss << "dds_::" << message_name << "_";
this->setName(ss.str().c_str());

// Fully bound by default
// Fully bound and plain by default
this->max_size_bound_ = true;
this->is_plain_ = true;
// Encapsulation size
this->m_typeSize = 4;
if (this->members_->member_count_ != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ RequestTypeSupport<ServiceMembersType, MessageMembersType>::RequestTypeSupport(
ss << "dds_::" << service_name << "_Request_";
this->setName(ss.str().c_str());

// Fully bound by default
// Fully bound and plain by default
this->max_size_bound_ = true;
this->is_plain_ = true;
// Encapsulation size
this->m_typeSize = 4;
if (this->members_->member_count_ != 0) {
Expand Down Expand Up @@ -78,8 +79,9 @@ ResponseTypeSupport<ServiceMembersType, MessageMembersType>::ResponseTypeSupport
ss << "dds_::" << service_name << "_Response_";
this->setName(ss.str().c_str());

// Fully bound by default
// Fully bound and plain by default
this->max_size_bound_ = true;
this->is_plain_ = true;
// Encapsulation size
this->m_typeSize = 4;
if (this->members_->member_count_ != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ TypeSupport<MembersType>::TypeSupport(const void * ros_type_support)
{
m_isGetKeyDefined = false;
max_size_bound_ = false;
is_plain_ = false;
}

// C++ specialization
Expand Down Expand Up @@ -829,9 +830,15 @@ size_t TypeSupport<MembersType>::calculateMaxSerializedSize(
size_t array_size = 1;
if (member->is_array_) {
array_size = member->array_size_;

// Whether it is unbounded.
if (0 == array_size) {
this->max_size_bound_ = false;
}

// Whether it is a sequence.
if (0 == array_size || member->is_upper_bound_) {
this->max_size_bound_ = false;
this->is_plain_ = false;
current_alignment += padding +
eprosima::fastcdr::Cdr::alignment(current_alignment, padding);
}
Expand Down Expand Up @@ -866,6 +873,7 @@ size_t TypeSupport<MembersType>::calculateMaxSerializedSize(
case ::rosidl_typesupport_introspection_cpp::ROS_TYPE_WSTRING:
{
this->max_size_bound_ = false;
this->is_plain_ = false;
size_t character_size =
(member->type_id_ == rosidl_typesupport_introspection_cpp::ROS_TYPE_WSTRING) ? 4 : 1;
for (size_t index = 0; index < array_size; ++index) {
Expand Down

0 comments on commit d281a69

Please sign in to comment.