Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename rosidl_generator_cpp namespace to rosidl_runtime_cpp #456

Merged
merged 2 commits into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rosidl_generator_cpp/resource/idl__builder.hpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ include_directives = set()
#define @(header_guard_variable)

#include "@(include_base)__struct.hpp"
#include <rosidl_generator_cpp/message_initialization.hpp>
#include <rosidl_runtime_cpp/message_initialization.hpp>
#include <algorithm>
#include <utility>

Expand Down
4 changes: 2 additions & 2 deletions rosidl_generator_cpp/resource/idl__struct.hpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ include_directives = set()
#ifndef @(header_guard_variable)
#define @(header_guard_variable)

#include <rosidl_generator_cpp/bounded_vector.hpp>
#include <rosidl_generator_cpp/message_initialization.hpp>
#include <rosidl_runtime_cpp/bounded_vector.hpp>
#include <rosidl_runtime_cpp/message_initialization.hpp>
#include <algorithm>
#include <array>
#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion rosidl_generator_cpp/resource/idl__traits.hpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ include_directives = set()
#define @(header_guard_variable)

#include "@(include_base)__struct.hpp"
#include <rosidl_generator_cpp/traits.hpp>
#include <rosidl_runtime_cpp/traits.hpp>
#include <stdint.h>
#include <type_traits>

Expand Down
4 changes: 2 additions & 2 deletions rosidl_generator_cpp/resource/msg__builder.hpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ explicit @
Init_@(message.structure.namespaced_type.name)_@(field_name)@
@[ if index == 0]@
()
: msg_(::rosidl_generator_cpp::MessageInitialization::SKIP)
: msg_(::rosidl_runtime_cpp::MessageInitialization::SKIP)
@[ else]@
(::@(message_typename) & msg)
: msg_(msg)
Expand Down Expand Up @@ -70,7 +70,7 @@ inline
auto build<::@(message_typename)>()
{
@[ if len(message.structure.members) == 1 and message.structure.members[0].name == EMPTY_STRUCTURE_REQUIRED_MEMBER_NAME]@
return ::@(message_typename)(rosidl_generator_cpp::MessageInitialization::ZERO);
return ::@(message_typename)(rosidl_runtime_cpp::MessageInitialization::ZERO);
@[ else]@
return @('::'.join(message.structure.namespaced_type.namespaces))::builder::Init_@(message.structure.namespaced_type.name)_@(message.structure.members[0].name)();
@[ end if]@
Expand Down
24 changes: 12 additions & 12 deletions rosidl_generator_cpp/resource/msg__struct.hpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def generate_zero_string(membset, fill_args):
strlist.append('this->%s = %s;' % (member.name, member.zero_value))
return strlist
}@
explicit @(message.structure.namespaced_type.name)_(rosidl_generator_cpp::MessageInitialization _init = rosidl_generator_cpp::MessageInitialization::ALL)
explicit @(message.structure.namespaced_type.name)_(rosidl_runtime_cpp::MessageInitialization _init = rosidl_runtime_cpp::MessageInitialization::ALL)
@[if init_list]@
: @(',\n '.join(init_list))
@[end if]@
Expand All @@ -158,16 +158,16 @@ non_defaulted_zero_initialized_members = [
]
}@
@[if default_value_members]@
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
if (rosidl_runtime_cpp::MessageInitialization::ALL == _init ||
rosidl_runtime_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
@[ for membset in default_value_members]@
@[ for line in generate_default_string(membset)]@
@(line)
@[ end for]@
@[ end for]@
@[ if zero_value_members]@
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
} else if (rosidl_runtime_cpp::MessageInitialization::ZERO == _init) {
@[ for membset in zero_value_members]@
@[ for line in generate_zero_string(membset, '_init')]@
@(line)
Expand All @@ -177,8 +177,8 @@ non_defaulted_zero_initialized_members = [
}
@[ end if]@
@[ if non_defaulted_zero_initialized_members]@
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
if (rosidl_runtime_cpp::MessageInitialization::ALL == _init ||
rosidl_runtime_cpp::MessageInitialization::ZERO == _init)
{
@[ for membset in non_defaulted_zero_initialized_members]@
@[ for line in generate_zero_string(membset, '_init')]@
Expand All @@ -191,7 +191,7 @@ non_defaulted_zero_initialized_members = [
@[end if]@
}

explicit @(message.structure.namespaced_type.name)_(const ContainerAllocator & _alloc, rosidl_generator_cpp::MessageInitialization _init = rosidl_generator_cpp::MessageInitialization::ALL)
explicit @(message.structure.namespaced_type.name)_(const ContainerAllocator & _alloc, rosidl_runtime_cpp::MessageInitialization _init = rosidl_runtime_cpp::MessageInitialization::ALL)
@[if alloc_list]@
: @(',\n '.join(alloc_list))
@[end if]@
Expand All @@ -203,16 +203,16 @@ non_defaulted_zero_initialized_members = [
(void)_alloc;
@[end if]@
@[if default_value_members]@
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
if (rosidl_runtime_cpp::MessageInitialization::ALL == _init ||
rosidl_runtime_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
@[ for membset in default_value_members]@
@[ for line in generate_default_string(membset)]@
@(line)
@[ end for]@
@[ end for]@
@[ if zero_value_members]@
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
} else if (rosidl_runtime_cpp::MessageInitialization::ZERO == _init) {
@[ for membset in zero_value_members]@
@[ for line in generate_zero_string(membset, '_alloc, _init')]@
@(line)
Expand All @@ -222,8 +222,8 @@ non_defaulted_zero_initialized_members = [
}
@[end if]@
@[if non_defaulted_zero_initialized_members]@
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
if (rosidl_runtime_cpp::MessageInitialization::ALL == _init ||
rosidl_runtime_cpp::MessageInitialization::ZERO == _init)
{
@[ for membset in non_defaulted_zero_initialized_members]@
@[ for line in generate_zero_string(membset, '_alloc, _init')]@
Expand Down
2 changes: 1 addition & 1 deletion rosidl_generator_cpp/rosidl_generator_cpp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def msg_type_to_cpp(type_):
'rebind<%s>::other>') % (cpp_type, cpp_type)
elif isinstance(type_, BoundedSequence):
return \
('rosidl_generator_cpp::BoundedVector<%s, %u, typename ContainerAllocator::' +
('rosidl_runtime_cpp::BoundedVector<%s, %u, typename ContainerAllocator::' +
'template rebind<%s>::other>') % (cpp_type, type_.maximum_size, cpp_type)
else:
assert isinstance(type_, Array)
Expand Down
6 changes: 3 additions & 3 deletions rosidl_generator_cpp/test/test_bounded_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#include <gtest/gtest.h>
#include <utility>

#include "rosidl_generator_cpp/bounded_vector.hpp"
#include "rosidl_runtime_cpp/bounded_vector.hpp"


TEST(rosidl_generator_cpp, bounded_vector) {
rosidl_generator_cpp::BoundedVector<int, 2> v;
rosidl_runtime_cpp::BoundedVector<int, 2> v;
ASSERT_EQ(v.size(), 0u);
ASSERT_EQ(v.max_size(), 2u);
v.push_back(1);
Expand All @@ -35,7 +35,7 @@ TEST(rosidl_generator_cpp, bounded_vector) {
}

TEST(rosidl_generator_cpp, bounded_vector_rvalue) {
rosidl_generator_cpp::BoundedVector<int, 2> v;
rosidl_runtime_cpp::BoundedVector<int, 2> v;
// emplace back
ASSERT_EQ(v.size(), 0u);
ASSERT_EQ(v.max_size(), 2u);
Expand Down
4 changes: 2 additions & 2 deletions rosidl_generator_cpp/test/test_interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void test_message_basic_types(rosidl_generator_cpp::msg::BasicTypes message)

#define TEST_BOUNDED_SEQUENCE_TYPES( \
Message, FieldName, BasicType, ArraySize, MinVal, MaxVal) \
rosidl_generator_cpp::BoundedVector<BasicType, ArraySize> pattern_ ## FieldName; \
rosidl_runtime_cpp::BoundedVector<BasicType, ArraySize> pattern_ ## FieldName; \
Message.FieldName.resize(ArraySize); \
pattern_ ## FieldName.resize(ArraySize); \
test_vector_fill<decltype(pattern_ ## FieldName)>( \
Expand All @@ -185,7 +185,7 @@ void test_message_basic_types(rosidl_generator_cpp::msg::BasicTypes message)

#define TEST_BOUNDED_SEQUENCE_STRING( \
Message, FieldName, BasicType, ArraySize, MinVal, MaxVal, MinLength, MaxLength) \
rosidl_generator_cpp::BoundedVector<BasicType, ArraySize> pattern_ ## FieldName; \
rosidl_runtime_cpp::BoundedVector<BasicType, ArraySize> pattern_ ## FieldName; \
Message.FieldName.resize(ArraySize); \
pattern_ ## FieldName.resize(ArraySize); \
test_vector_fill<decltype(pattern_ ## FieldName)>( \
Expand Down
8 changes: 4 additions & 4 deletions rosidl_generator_cpp/test/test_msg_initialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ TEST(Test_msg_initialization, no_arg_constructor) {

TEST(Test_msg_initialization, all_constructor) {
rosidl_generator_cpp::msg::Defaults def(
rosidl_generator_cpp::MessageInitialization::ALL);
rosidl_runtime_cpp::MessageInitialization::ALL);
ASSERT_TRUE(def.bool_value);
ASSERT_EQ(50, def.byte_value);
ASSERT_EQ(100, def.char_value);
Expand Down Expand Up @@ -109,7 +109,7 @@ TEST(Test_msg_initialization, all_constructor) {

TEST(Test_msg_initialization, zero_constructor) {
rosidl_generator_cpp::msg::Defaults def(
rosidl_generator_cpp::MessageInitialization::ZERO);
rosidl_runtime_cpp::MessageInitialization::ZERO);
ASSERT_FALSE(def.bool_value);
ASSERT_EQ(0, def.byte_value);
ASSERT_EQ(0, def.char_value);
Expand Down Expand Up @@ -141,7 +141,7 @@ TEST(Test_msg_initialization, zero_constructor) {

TEST(Test_msg_initialization, defaults_only_constructor) {
rosidl_generator_cpp::msg::Defaults def(
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY);
rosidl_runtime_cpp::MessageInitialization::DEFAULTS_ONLY);
ASSERT_TRUE(def.bool_value);
ASSERT_EQ(50, def.byte_value);
ASSERT_EQ(100, def.char_value);
Expand Down Expand Up @@ -179,7 +179,7 @@ TEST(Test_msg_initialization, skip_constructor) {
std::memset(memory, 0xfe, sizeof(rosidl_generator_cpp::msg::BoundedSequences));
rosidl_generator_cpp::msg::BoundedSequences * bounded =
new(memory) rosidl_generator_cpp::msg::BoundedSequences(
rosidl_generator_cpp::MessageInitialization::SKIP);
rosidl_runtime_cpp::MessageInitialization::SKIP);

// ensures that the memory gets freed even if an ASSERT is raised
SCOPE_EXIT(bounded->~BoundedSequences_(); delete[] memory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef ROSIDL_GENERATOR_CPP__ACTION_TYPE_SUPPORT_DECL_HPP_
#define ROSIDL_GENERATOR_CPP__ACTION_TYPE_SUPPORT_DECL_HPP_
#ifndef ROSIDL_RUNTIME_CPP__ACTION_TYPE_SUPPORT_DECL_HPP_
#define ROSIDL_RUNTIME_CPP__ACTION_TYPE_SUPPORT_DECL_HPP_

#include <rosidl_generator_c/action_type_support_struct.h>
#include <rosidl_generator_c/visibility_control.h>

namespace rosidl_generator_cpp
namespace rosidl_runtime_cpp
{

template<typename T>
const rosidl_action_type_support_t * get_action_type_support_handle();

} // namespace rosidl_generator_cpp
} // namespace rosidl_runtime_cpp

#endif // ROSIDL_GENERATOR_CPP__ACTION_TYPE_SUPPORT_DECL_HPP_
#endif // ROSIDL_RUNTIME_CPP__ACTION_TYPE_SUPPORT_DECL_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef ROSIDL_GENERATOR_CPP__BOUNDED_VECTOR_HPP_
#define ROSIDL_GENERATOR_CPP__BOUNDED_VECTOR_HPP_
#ifndef ROSIDL_RUNTIME_CPP__BOUNDED_VECTOR_HPP_
#define ROSIDL_RUNTIME_CPP__BOUNDED_VECTOR_HPP_

#include <algorithm>
#include <memory>
#include <stdexcept>
#include <utility>
#include <vector>

namespace rosidl_generator_cpp
namespace rosidl_runtime_cpp
{

/// A container based on std::vector but with an upper bound.
Expand Down Expand Up @@ -740,14 +740,14 @@ operator>=(
*reinterpret_cast<const std::vector<_Tp, _Alloc> *>(&__y));
}

/// See rosidl_generator_cpp::BoundedVector::swap().
/// See rosidl_runtime_cpp::BoundedVector::swap().
template<typename _Tp, std::size_t _UpperBound, typename _Alloc>
inline void
swap(BoundedVector<_Tp, _UpperBound, _Alloc> & __x, BoundedVector<_Tp, _UpperBound, _Alloc> & __y)
{
__x.swap(__y);
}

} // namespace rosidl_generator_cpp
} // namespace rosidl_runtime_cpp

#endif // ROSIDL_GENERATOR_CPP__BOUNDED_VECTOR_HPP_
#endif // ROSIDL_RUNTIME_CPP__BOUNDED_VECTOR_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef ROSIDL_GENERATOR_CPP__MESSAGE_INITIALIZATION_HPP_
#define ROSIDL_GENERATOR_CPP__MESSAGE_INITIALIZATION_HPP_
#ifndef ROSIDL_RUNTIME_CPP__MESSAGE_INITIALIZATION_HPP_
#define ROSIDL_RUNTIME_CPP__MESSAGE_INITIALIZATION_HPP_

// TODO(clalancette): this should be moved out into a separate runtime package

#include <rosidl_generator_c/message_initialization.h>

namespace rosidl_generator_cpp
namespace rosidl_runtime_cpp
{

enum class MessageInitialization
Expand All @@ -30,6 +30,6 @@ enum class MessageInitialization
DEFAULTS_ONLY = ROSIDL_RUNTIME_C_MSG_INIT_DEFAULTS_ONLY,
};

} // namespace rosidl_generator_cpp
} // namespace rosidl_runtime_cpp

#endif // ROSIDL_GENERATOR_CPP__MESSAGE_INITIALIZATION_HPP_
#endif // ROSIDL_RUNTIME_CPP__MESSAGE_INITIALIZATION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef ROSIDL_GENERATOR_CPP__MESSAGE_TYPE_SUPPORT_DECL_HPP_
#define ROSIDL_GENERATOR_CPP__MESSAGE_TYPE_SUPPORT_DECL_HPP_
#ifndef ROSIDL_RUNTIME_CPP__MESSAGE_TYPE_SUPPORT_DECL_HPP_
#define ROSIDL_RUNTIME_CPP__MESSAGE_TYPE_SUPPORT_DECL_HPP_

#include <rosidl_generator_c/message_type_support_struct.h>
#include <rosidl_generator_c/visibility_control.h>

namespace rosidl_generator_cpp
namespace rosidl_runtime_cpp
{

template<typename T>
const rosidl_message_type_support_t * get_message_type_support_handle();

} // namespace rosidl_generator_cpp
} // namespace rosidl_runtime_cpp

#endif // ROSIDL_GENERATOR_CPP__MESSAGE_TYPE_SUPPORT_DECL_HPP_
#endif // ROSIDL_RUNTIME_CPP__MESSAGE_TYPE_SUPPORT_DECL_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef ROSIDL_GENERATOR_CPP__SERVICE_TYPE_SUPPORT_DECL_HPP_
#define ROSIDL_GENERATOR_CPP__SERVICE_TYPE_SUPPORT_DECL_HPP_
#ifndef ROSIDL_RUNTIME_CPP__SERVICE_TYPE_SUPPORT_DECL_HPP_
#define ROSIDL_RUNTIME_CPP__SERVICE_TYPE_SUPPORT_DECL_HPP_

#include <rosidl_generator_c/service_type_support_struct.h>
#include <rosidl_generator_c/visibility_control.h>

namespace rosidl_generator_cpp
namespace rosidl_runtime_cpp
{

template<typename T>
const rosidl_service_type_support_t * get_service_type_support_handle();

} // namespace rosidl_generator_cpp
} // namespace rosidl_runtime_cpp

#endif // ROSIDL_GENERATOR_CPP__SERVICE_TYPE_SUPPORT_DECL_HPP_
#endif // ROSIDL_RUNTIME_CPP__SERVICE_TYPE_SUPPORT_DECL_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef ROSIDL_GENERATOR_CPP__TRAITS_HPP_
#define ROSIDL_GENERATOR_CPP__TRAITS_HPP_
#ifndef ROSIDL_RUNTIME_CPP__TRAITS_HPP_
#define ROSIDL_RUNTIME_CPP__TRAITS_HPP_

#include <type_traits>

// TODO(dirk-thomas) this should be in the rosidl_generator_cpp namespace
namespace rosidl_generator_traits
{

Expand Down Expand Up @@ -56,4 +55,4 @@ struct is_action_feedback : std::false_type {};

} // namespace rosidl_generator_traits

#endif // ROSIDL_GENERATOR_CPP__TRAITS_HPP_
#endif // ROSIDL_RUNTIME_CPP__TRAITS_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "rosidl_generator_c/message_type_support_struct.h"

#include "rosidl_generator_cpp/message_initialization.hpp"
#include "rosidl_runtime_cpp/message_initialization.hpp"

#include "rosidl_typesupport_introspection_cpp/visibility_control.h"

Expand Down Expand Up @@ -51,7 +51,7 @@ typedef struct ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_PUBLIC MessageMembers
uint32_t member_count_;
size_t size_of_;
const MessageMember * members_;
void (* init_function)(void *, rosidl_generator_cpp::MessageInitialization);
void (* init_function)(void *, rosidl_runtime_cpp::MessageInitialization);
void (* fini_function)(void *);
} MessageMembers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace rosidl_typesupport_introspection_cpp
{

void @(message.structure.namespaced_type.name)_init_function(
void * message_memory, rosidl_generator_cpp::MessageInitialization _init)
void * message_memory, rosidl_runtime_cpp::MessageInitialization _init)
{
new (message_memory) @('::'.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name]))(_init);
}
Expand Down