Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
rename rosidl_generator_c namespace to rosidl_runtime_c (#50)
Browse files Browse the repository at this point in the history
Signed-off-by: Dirk Thomas <[email protected]>
  • Loading branch information
dirk-thomas authored Apr 11, 2020
1 parent f1320ed commit 6fe7a8a
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "ndds/ndds_version.h"

#include "rosidl_generator_c/u16string.h"
#include "rosidl_runtime_c/u16string.h"
#include "rosidl_typesupport_connext_c/visibility_control.h"

// forward declare DDS_Wchar
Expand All @@ -32,11 +32,11 @@ namespace rosidl_typesupport_connext_c

ROSIDL_TYPESUPPORT_CONNEXT_C_PUBLIC
DDS_Wchar * create_wstring_from_u16string(
const rosidl_generator_c__U16String & u16str);
const rosidl_runtime_c__U16String & u16str);

ROSIDL_TYPESUPPORT_CONNEXT_C_PUBLIC
bool wstring_to_u16string(
const DDS_Wchar * wstr, rosidl_generator_c__U16String & u16str);
const DDS_Wchar * wstr, rosidl_runtime_c__U16String & u16str);

} // namespace rosidl_typesupport_connext_c

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@# Included from rosidl_typesupport_connext_c/resource/idl__rosidl_typesupport_connext_c.h.em
@{
header_files = [
'rosidl_generator_c/message_type_support_struct.h',
'rosidl_runtime_c/message_type_support_struct.h',
'rosidl_typesupport_interface/macros.h',
package_name + '/msg/rosidl_typesupport_connext_c__visibility_control.h'
]
Expand Down
36 changes: 18 additions & 18 deletions rosidl_typesupport_connext_c/resource/msg__type_support_c.cpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ from collections import OrderedDict
includes = OrderedDict()
for member in message.structure.members:
if isinstance(member.type, AbstractSequence) and isinstance(member.type.value_type, BasicType):
includes.setdefault('rosidl_generator_c/primitives_sequence.h', []).append(member.name)
includes.setdefault('rosidl_generator_c/primitives_sequence_functions.h', []).append(member.name)
includes.setdefault('rosidl_runtime_c/primitives_sequence.h', []).append(member.name)
includes.setdefault('rosidl_runtime_c/primitives_sequence_functions.h', []).append(member.name)
continue
type_ = member.type
if isinstance(type_, AbstractNestedType):
type_ = type_.value_type
if isinstance(type_, AbstractString):
includes.setdefault('rosidl_generator_c/string.h', []).append(member.name)
includes.setdefault('rosidl_generator_c/string_functions.h', []).append(member.name)
includes.setdefault('rosidl_runtime_c/string.h', []).append(member.name)
includes.setdefault('rosidl_runtime_c/string_functions.h', []).append(member.name)
if isinstance(type_, AbstractWString):
includes.setdefault('rosidl_generator_c/u16string.h', []).append(member.name)
includes.setdefault('rosidl_generator_c/u16string_functions.h', []).append(member.name)
includes.setdefault('rosidl_runtime_c/u16string.h', []).append(member.name)
includes.setdefault('rosidl_runtime_c/u16string_functions.h', []).append(member.name)
if isinstance(type_, NamespacedType):
include_prefix = idl_structure_type_to_c_include_prefix(type_)
includes.setdefault(include_prefix + '__struct.h', []).append(member.name)
Expand Down Expand Up @@ -219,7 +219,7 @@ if isinstance(type_, AbstractNestedType):
auto & ros_i = ros_message->@(member.name).data[i];
@[ end if]@
@[ if isinstance(type_, AbstractString)]@
const rosidl_generator_c__String * str = &ros_i;
const rosidl_runtime_c__String * str = &ros_i;
if (str->capacity == 0 || str->capacity <= str->size) {
fprintf(stderr, "string capacity not greater than size\n");
return false;
Expand All @@ -230,7 +230,7 @@ if isinstance(type_, AbstractNestedType):
}
dds_message->@(member.name)_[static_cast<DDS_Long>(i)] = DDS_String_dup(str->data);
@[ elif isinstance(type_, AbstractWString)]@
const rosidl_generator_c__U16String * str = &ros_i;
const rosidl_runtime_c__U16String * str = &ros_i;
if (str->capacity == 0 || str->capacity <= str->size) {
fprintf(stderr, "string capacity not greater than size\n");
return false;
Expand Down Expand Up @@ -260,7 +260,7 @@ if isinstance(type_, AbstractNestedType):
@[ end if]@
}
@[ elif isinstance(member.type, AbstractString)]@
const rosidl_generator_c__String * str = &ros_message->@(member.name);
const rosidl_runtime_c__String * str = &ros_message->@(member.name);
if (str->capacity == 0 || str->capacity <= str->size) {
fprintf(stderr, "string capacity not greater than size\n");
return false;
Expand All @@ -271,7 +271,7 @@ if isinstance(type_, AbstractNestedType):
}
dds_message->@(member.name)_ = DDS_String_dup(str->data);
@[ elif isinstance(member.type, AbstractWString)]@
const rosidl_generator_c__U16String * str = &ros_message->@(member.name);
const rosidl_runtime_c__U16String * str = &ros_message->@(member.name);
if (str->capacity == 0 || str->capacity <= str->size) {
fprintf(stderr, "string capacity not greater than size\n");
return false;
Expand Down Expand Up @@ -354,9 +354,9 @@ if isinstance(type_, AbstractNestedType):
@[ end if]@
@[ elif isinstance(type_, AbstractString)]@
if (!ros_i.data) {
rosidl_generator_c__String__init(&ros_i);
rosidl_runtime_c__String__init(&ros_i);
}
bool succeeded = rosidl_generator_c__String__assign(
bool succeeded = rosidl_runtime_c__String__assign(
&ros_i,
dds_message->@(member.name)_[i]);
if (!succeeded) {
Expand All @@ -365,12 +365,12 @@ if isinstance(type_, AbstractNestedType):
}
@[ elif isinstance(type_, AbstractWString)]@
if (!ros_i.data) {
rosidl_generator_c__U16String__init(&ros_i);
rosidl_runtime_c__U16String__init(&ros_i);
}
bool succeeded = rosidl_typesupport_connext_c::wstring_to_u16string(dds_message->@(member.name)_[i], ros_i);
if (!succeeded) {
fprintf(stderr, "failed to create wstring from u16string\n");
rosidl_generator_c__U16String__fini(&ros_i);
rosidl_runtime_c__U16String__fini(&ros_i);
return false;
}
@[ elif isinstance(type_, NamespacedType)]@
Expand All @@ -388,9 +388,9 @@ if isinstance(type_, AbstractNestedType):
}
@[ elif isinstance(member.type, AbstractString)]@
if (!ros_message->@(member.name).data) {
rosidl_generator_c__String__init(&ros_message->@(member.name));
rosidl_runtime_c__String__init(&ros_message->@(member.name));
}
bool succeeded = rosidl_generator_c__String__assign(
bool succeeded = rosidl_runtime_c__String__assign(
&ros_message->@(member.name),
dds_message->@(member.name)_);
if (!succeeded) {
Expand All @@ -399,12 +399,12 @@ if isinstance(type_, AbstractNestedType):
}
@[ elif isinstance(member.type, AbstractWString)]@
if (!ros_message->@(member.name).data) {
rosidl_generator_c__U16String__init(&ros_message->@(member.name));
rosidl_runtime_c__U16String__init(&ros_message->@(member.name));
}
bool succeeded = rosidl_typesupport_connext_c::wstring_to_u16string(dds_message->@(member.name)_, ros_message->@(member.name));
if (!succeeded) {
fprintf(stderr, "failed to create wstring from u16string\n");
rosidl_generator_c__U16String__fini(&ros_message->@(member.name));
rosidl_runtime_c__U16String__fini(&ros_message->@(member.name));
return false;
}
@[ elif isinstance(member.type, BasicType)]@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TEMPLATE(

@{
header_files = [
'rosidl_generator_c/service_type_support_struct.h',
'rosidl_runtime_c/service_type_support_struct.h',
'rosidl_typesupport_interface/macros.h',
package_name + '/msg/rosidl_typesupport_connext_c__visibility_control.h'
]
Expand Down
8 changes: 4 additions & 4 deletions rosidl_typesupport_connext_c/src/wstring_conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
#ifndef _WIN32
# pragma GCC diagnostic pop
#endif
#include "rosidl_generator_c/u16string_functions.h"
#include "rosidl_runtime_c/u16string_functions.h"

namespace rosidl_typesupport_connext_c
{

DDS_Wchar * create_wstring_from_u16string(const rosidl_generator_c__U16String & u16str)
DDS_Wchar * create_wstring_from_u16string(const rosidl_runtime_c__U16String & u16str)
{
DDS_Wchar * wstr = DDS_Wstring_alloc(static_cast<DDS_Long>(u16str.size));
if (NULL == wstr) {
Expand All @@ -44,10 +44,10 @@ DDS_Wchar * create_wstring_from_u16string(const rosidl_generator_c__U16String &
return wstr;
}

bool wstring_to_u16string(const DDS_Wchar * wstr, rosidl_generator_c__U16String & u16str)
bool wstring_to_u16string(const DDS_Wchar * wstr, rosidl_runtime_c__U16String & u16str)
{
size_t size = static_cast<size_t>(DDS_Wstring_length(wstr));
bool succeeded = rosidl_generator_c__U16String__resize(&u16str, size);
bool succeeded = rosidl_runtime_c__U16String__resize(&u16str, size);
if (!succeeded) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "rcutils/types/uint8_array.h"

#include "rosidl_generator_c/message_type_support_struct.h"
#include "rosidl_runtime_c/message_type_support_struct.h"

// forward declare DDS_TypeCode
struct DDS_TypeCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define ROSIDL_TYPESUPPORT_CONNEXT_CPP__MESSAGE_TYPE_SUPPORT_DECL_HPP_

// Provides the definition of the rosidl_message_type_support_t struct.
#include <rosidl_generator_c/message_type_support_struct.h>
#include <rosidl_runtime_c/message_type_support_struct.h>
// Provides visibility macros like ROSIDL_TYPESUPPORT_CONNEXT_CPP_PUBLIC.
#include <rosidl_typesupport_connext_cpp/visibility_control.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <stdint.h>
#include <rmw/types.h>
#include "rosidl_generator_c/service_type_support_struct.h"
#include "rosidl_runtime_c/service_type_support_struct.h"

typedef struct service_type_support_callbacks_t
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define ROSIDL_TYPESUPPORT_CONNEXT_CPP__SERVICE_TYPE_SUPPORT_DECL_HPP_

// Provides the definition of the rosidl_service_type_support_t struct.
#include <rosidl_generator_c/service_type_support_struct.h>
#include <rosidl_runtime_c/service_type_support_struct.h>
// Provides visibility macros like ROSIDL_TYPESUPPORT_CONNEXT_CPP_PUBLIC.
#include <rosidl_typesupport_connext_cpp/visibility_control.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include_parts = [package_name] + list(interface_path.parents[0].parts)
include_base = '/'.join(include_parts)
header_filename = convert_camel_case_to_lower_case_underscore(interface_path.stem)
header_files = [
'rosidl_generator_c/message_type_support_struct.h',
'rosidl_runtime_c/message_type_support_struct.h',
'rosidl_typesupport_interface/macros.h',
package_name + '/msg/rosidl_typesupport_connext_cpp__visibility_control.h',
include_base + '/' + header_filename + '__struct.hpp'
Expand Down

0 comments on commit 6fe7a8a

Please sign in to comment.