rename rosidl_generator_c namespace to rosidl_runtime_c (#150)
Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
This commit is contained in:
parent
654f3d46aa
commit
5c6b187fa9
7 changed files with 48 additions and 48 deletions
|
@ -16,9 +16,9 @@
|
|||
#ifndef RMW_CYCLONEDDS_CPP__TYPESUPPORT_HPP_
|
||||
#define RMW_CYCLONEDDS_CPP__TYPESUPPORT_HPP_
|
||||
|
||||
#include <rosidl_generator_c/string.h>
|
||||
#include <rosidl_generator_c/string_functions.h>
|
||||
#include <rosidl_generator_c/u16string_functions.h>
|
||||
#include <rosidl_runtime_c/string.h>
|
||||
#include <rosidl_runtime_c/string_functions.h>
|
||||
#include <rosidl_runtime_c/u16string_functions.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
@ -53,15 +53,15 @@ struct StringHelper;
|
|||
template<>
|
||||
struct StringHelper<rosidl_typesupport_introspection_c__MessageMembers>
|
||||
{
|
||||
using type = rosidl_generator_c__String;
|
||||
using type = rosidl_runtime_c__String;
|
||||
|
||||
static std::string convert_to_std_string(void * data)
|
||||
{
|
||||
auto c_string = static_cast<rosidl_generator_c__String *>(data);
|
||||
auto c_string = static_cast<rosidl_runtime_c__String *>(data);
|
||||
if (!c_string) {
|
||||
RCUTILS_LOG_ERROR_NAMED(
|
||||
"rmw_cyclonedds_cpp",
|
||||
"Failed to cast data as rosidl_generator_c__String");
|
||||
"Failed to cast data as rosidl_runtime_c__String");
|
||||
return "";
|
||||
}
|
||||
if (!c_string->data) {
|
||||
|
@ -73,7 +73,7 @@ struct StringHelper<rosidl_typesupport_introspection_c__MessageMembers>
|
|||
return std::string(c_string->data);
|
||||
}
|
||||
|
||||
static std::string convert_to_std_string(rosidl_generator_c__String & data)
|
||||
static std::string convert_to_std_string(rosidl_runtime_c__String & data)
|
||||
{
|
||||
return std::string(data.data);
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ struct StringHelper<rosidl_typesupport_introspection_c__MessageMembers>
|
|||
{
|
||||
std::string str;
|
||||
deser >> str;
|
||||
rosidl_generator_c__String * c_str = static_cast<rosidl_generator_c__String *>(field);
|
||||
rosidl_generator_c__String__assign(c_str, str.c_str());
|
||||
rosidl_runtime_c__String * c_str = static_cast<rosidl_runtime_c__String *>(field);
|
||||
rosidl_runtime_c__String__assign(c_str, str.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
#include "rosidl_typesupport_introspection_c/message_introspection.h"
|
||||
#include "rosidl_typesupport_introspection_c/service_introspection.h"
|
||||
|
||||
#include "rosidl_generator_c/primitives_sequence_functions.h"
|
||||
#include "rosidl_generator_c/u16string_functions.h"
|
||||
#include "rosidl_runtime_c/primitives_sequence_functions.h"
|
||||
#include "rosidl_runtime_c/u16string_functions.h"
|
||||
|
||||
#include "serdes.hpp"
|
||||
#include "u16string.hpp"
|
||||
|
@ -56,19 +56,19 @@ SPECIALIZE_GENERIC_C_SEQUENCE(uint32, uint32_t)
|
|||
SPECIALIZE_GENERIC_C_SEQUENCE(int64, int64_t)
|
||||
SPECIALIZE_GENERIC_C_SEQUENCE(uint64, uint64_t)
|
||||
|
||||
typedef struct rosidl_generator_c__void__Sequence
|
||||
typedef struct rosidl_runtime_c__void__Sequence
|
||||
{
|
||||
void * data;
|
||||
/// The number of valid items in data
|
||||
size_t size;
|
||||
/// The number of allocated items in data
|
||||
size_t capacity;
|
||||
} rosidl_generator_c__void__Sequence;
|
||||
} rosidl_runtime_c__void__Sequence;
|
||||
|
||||
inline
|
||||
bool
|
||||
rosidl_generator_c__void__Sequence__init(
|
||||
rosidl_generator_c__void__Sequence * sequence, size_t size, size_t member_size)
|
||||
rosidl_runtime_c__void__Sequence__init(
|
||||
rosidl_runtime_c__void__Sequence * sequence, size_t size, size_t member_size)
|
||||
{
|
||||
if (!sequence) {
|
||||
return false;
|
||||
|
@ -88,7 +88,7 @@ rosidl_generator_c__void__Sequence__init(
|
|||
|
||||
inline
|
||||
void
|
||||
rosidl_generator_c__void__Sequence__fini(rosidl_generator_c__void__Sequence * sequence)
|
||||
rosidl_runtime_c__void__Sequence__fini(rosidl_runtime_c__void__Sequence * sequence)
|
||||
{
|
||||
if (!sequence) {
|
||||
return;
|
||||
|
@ -182,7 +182,7 @@ static size_t calculateMaxAlign(const MembersType * members)
|
|||
if (std::is_same<MembersType,
|
||||
rosidl_typesupport_introspection_c__MessageMembers>::value)
|
||||
{
|
||||
alignment = alignof(rosidl_generator_c__String);
|
||||
alignment = alignof(rosidl_runtime_c__String);
|
||||
} else {
|
||||
alignment = alignof(std::string);
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ size_t get_array_size_and_assign_field(
|
|||
void * & subros_message,
|
||||
size_t, size_t)
|
||||
{
|
||||
auto tmpsequence = static_cast<rosidl_generator_c__void__Sequence *>(field);
|
||||
auto tmpsequence = static_cast<rosidl_runtime_c__void__Sequence *>(field);
|
||||
if (member->is_upper_bound_ && tmpsequence->size > member->array_size_) {
|
||||
throw std::runtime_error("vector overcomes the maximum length");
|
||||
}
|
||||
|
@ -353,34 +353,34 @@ inline void deserialize_field<std::string>(
|
|||
CStringHelper::assign(deser, field, call_new);
|
||||
} else {
|
||||
if (member->array_size_ && !member->is_upper_bound_) {
|
||||
auto deser_field = static_cast<rosidl_generator_c__String *>(field);
|
||||
auto deser_field = static_cast<rosidl_runtime_c__String *>(field);
|
||||
// tmpstring is defined here and not below to avoid
|
||||
// memory allocation in every iteration of the for loop
|
||||
std::string tmpstring;
|
||||
for (size_t i = 0; i < member->array_size_; ++i) {
|
||||
deser.deserialize(tmpstring);
|
||||
if (!rosidl_generator_c__String__assign(&deser_field[i], tmpstring.c_str())) {
|
||||
throw std::runtime_error("unable to assign rosidl_generator_c__String");
|
||||
if (!rosidl_runtime_c__String__assign(&deser_field[i], tmpstring.c_str())) {
|
||||
throw std::runtime_error("unable to assign rosidl_runtime_c__String");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
std::vector<std::string> cpp_string_vector;
|
||||
deser >> cpp_string_vector;
|
||||
|
||||
auto & string_array_field = *reinterpret_cast<rosidl_generator_c__String__Sequence *>(field);
|
||||
auto & string_array_field = *reinterpret_cast<rosidl_runtime_c__String__Sequence *>(field);
|
||||
if (
|
||||
!rosidl_generator_c__String__Sequence__init(
|
||||
!rosidl_runtime_c__String__Sequence__init(
|
||||
&string_array_field, cpp_string_vector.size()))
|
||||
{
|
||||
throw std::runtime_error("unable to initialize rosidl_generator_c__String array");
|
||||
throw std::runtime_error("unable to initialize rosidl_runtime_c__String array");
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < cpp_string_vector.size(); ++i) {
|
||||
if (
|
||||
!rosidl_generator_c__String__assign(
|
||||
!rosidl_runtime_c__String__assign(
|
||||
&string_array_field.data[i], cpp_string_vector[i].c_str()))
|
||||
{
|
||||
throw std::runtime_error("unable to assign rosidl_generator_c__String");
|
||||
throw std::runtime_error("unable to assign rosidl_runtime_c__String");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -399,9 +399,9 @@ inline void deserialize_field<std::wstring>(
|
|||
if (!member->is_array_) {
|
||||
deser >> wstr;
|
||||
wstring_to_u16string(
|
||||
wstr, *static_cast<rosidl_generator_c__U16String *>(field));
|
||||
wstr, *static_cast<rosidl_runtime_c__U16String *>(field));
|
||||
} else if (member->array_size_ && !member->is_upper_bound_) {
|
||||
auto array = static_cast<rosidl_generator_c__U16String *>(field);
|
||||
auto array = static_cast<rosidl_runtime_c__U16String *>(field);
|
||||
for (size_t i = 0; i < member->array_size_; ++i) {
|
||||
deser >> wstr;
|
||||
wstring_to_u16string(wstr, array[i]);
|
||||
|
@ -409,9 +409,9 @@ inline void deserialize_field<std::wstring>(
|
|||
} else {
|
||||
uint32_t size;
|
||||
deser >> size;
|
||||
auto sequence = static_cast<rosidl_generator_c__U16String__Sequence *>(field);
|
||||
if (!rosidl_generator_c__U16String__Sequence__init(sequence, size)) {
|
||||
throw std::runtime_error("unable to initialize rosidl_generator_c__U16String sequence");
|
||||
auto sequence = static_cast<rosidl_runtime_c__U16String__Sequence *>(field);
|
||||
if (!rosidl_runtime_c__U16String__Sequence__init(sequence, size)) {
|
||||
throw std::runtime_error("unable to initialize rosidl_runtime_c__U16String sequence");
|
||||
}
|
||||
for (size_t i = 0; i < sequence->size; ++i) {
|
||||
deser >> wstr;
|
||||
|
@ -452,8 +452,8 @@ inline size_t get_submessage_array_deserialize(
|
|||
{
|
||||
(void)member;
|
||||
uint32_t vsize = deser.deserialize_len(1);
|
||||
auto tmparray = static_cast<rosidl_generator_c__void__Sequence *>(field);
|
||||
rosidl_generator_c__void__Sequence__init(tmparray, vsize, sub_members_size);
|
||||
auto tmparray = static_cast<rosidl_runtime_c__void__Sequence *>(field);
|
||||
rosidl_runtime_c__void__Sequence__init(tmparray, vsize, sub_members_size);
|
||||
subros_message = reinterpret_cast<void *>(tmparray->data);
|
||||
return vsize;
|
||||
}
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
template<> \
|
||||
struct GenericCSequence<C_TYPE> \
|
||||
{ \
|
||||
using type = rosidl_generator_c__ ## C_NAME ## __Sequence; \
|
||||
using type = rosidl_runtime_c__ ## C_NAME ## __Sequence; \
|
||||
\
|
||||
static void fini(type * array) { \
|
||||
rosidl_generator_c__ ## C_NAME ## __Sequence__fini(array); \
|
||||
rosidl_runtime_c__ ## C_NAME ## __Sequence__fini(array); \
|
||||
} \
|
||||
\
|
||||
static bool init(type * array, size_t size) { \
|
||||
return rosidl_generator_c__ ## C_NAME ## __Sequence__init(array, size); \
|
||||
return rosidl_runtime_c__ ## C_NAME ## __Sequence__init(array, size); \
|
||||
} \
|
||||
};
|
||||
|
||||
|
|
|
@ -16,16 +16,16 @@
|
|||
#define RMW_CYCLONEDDS_CPP__U16STRING_HPP_
|
||||
|
||||
#include <string>
|
||||
#include "rosidl_generator_c/u16string_functions.h"
|
||||
#include "rosidl_runtime_c/u16string_functions.h"
|
||||
|
||||
namespace rmw_cyclonedds_cpp
|
||||
{
|
||||
|
||||
void u16string_to_wstring(
|
||||
const rosidl_generator_c__U16String & u16str, std::wstring & wstr);
|
||||
const rosidl_runtime_c__U16String & u16str, std::wstring & wstr);
|
||||
|
||||
bool wstring_to_u16string(
|
||||
const std::wstring & wstr, rosidl_generator_c__U16String & u16str);
|
||||
const std::wstring & wstr, rosidl_runtime_c__U16String & u16str);
|
||||
|
||||
void u16string_to_wstring(const std::u16string & u16str, std::wstring & wstr);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "TypeSupport2.hpp"
|
||||
#include "rosidl_generator_c/service_type_support_struct.h"
|
||||
#include "rosidl_runtime_c/service_type_support_struct.h"
|
||||
#include "serdata.hpp"
|
||||
|
||||
namespace rmw_cyclonedds_cpp
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
#include "bytewise.hpp"
|
||||
#include "rmw_cyclonedds_cpp/exception.hpp"
|
||||
#include "rosidl_generator_c/string_functions.h"
|
||||
#include "rosidl_generator_c/u16string_functions.h"
|
||||
#include "rosidl_runtime_c/string_functions.h"
|
||||
#include "rosidl_runtime_c/u16string_functions.h"
|
||||
#include "rosidl_typesupport_introspection_c/identifier.h"
|
||||
#include "rosidl_typesupport_introspection_c/message_introspection.h"
|
||||
#include "rosidl_typesupport_introspection_c/service_introspection.h"
|
||||
|
@ -397,7 +397,7 @@ public:
|
|||
struct ROSIDLC_StringValueType : public U8StringValueType
|
||||
{
|
||||
public:
|
||||
using type = rosidl_generator_c__String;
|
||||
using type = rosidl_runtime_c__String;
|
||||
|
||||
TypedSpan<const char_traits::char_type> data(const void * ptr) const override
|
||||
{
|
||||
|
@ -419,7 +419,7 @@ public:
|
|||
class ROSIDLC_WStringValueType : public U16StringValueType
|
||||
{
|
||||
public:
|
||||
using type = rosidl_generator_c__U16String;
|
||||
using type = rosidl_runtime_c__U16String;
|
||||
|
||||
TypedSpan<const char_traits::char_type> data(const void * ptr) const override
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
#include <string>
|
||||
#include "rosidl_generator_c/u16string_functions.h"
|
||||
#include "rosidl_runtime_c/u16string_functions.h"
|
||||
|
||||
namespace rmw_cyclonedds_cpp
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ bool wstring_to_u16string(const std::wstring & wstr, std::u16string & u16str)
|
|||
return true;
|
||||
}
|
||||
|
||||
void u16string_to_wstring(const rosidl_generator_c__U16String & u16str, std::wstring & wstr)
|
||||
void u16string_to_wstring(const rosidl_runtime_c__U16String & u16str, std::wstring & wstr)
|
||||
{
|
||||
wstr.resize(u16str.size);
|
||||
for (size_t i = 0; i < u16str.size; ++i) {
|
||||
|
@ -47,9 +47,9 @@ void u16string_to_wstring(const rosidl_generator_c__U16String & u16str, std::wst
|
|||
}
|
||||
}
|
||||
|
||||
bool wstring_to_u16string(const std::wstring & wstr, rosidl_generator_c__U16String & u16str)
|
||||
bool wstring_to_u16string(const std::wstring & wstr, rosidl_runtime_c__U16String & u16str)
|
||||
{
|
||||
bool succeeded = rosidl_generator_c__U16String__resize(&u16str, wstr.size());
|
||||
bool succeeded = rosidl_runtime_c__U16String__resize(&u16str, wstr.size());
|
||||
if (!succeeded) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue