Skip to content

Commit

Permalink
Refs #3061. Package rmw_fastrtps_cpp duplicated as rmw_fastrtps_dynam…
Browse files Browse the repository at this point in the history
…ic_cpp.
  • Loading branch information
MiguelCompany committed Jul 6, 2018
1 parent 10c8c26 commit e374da9
Show file tree
Hide file tree
Showing 57 changed files with 4,511 additions and 0 deletions.
135 changes: 135 additions & 0 deletions rmw_fastrtps_dynamic_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Copyright 2016-2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.5)

project(rmw_fastrtps_cpp)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake_ros REQUIRED)

find_package(rcutils REQUIRED)
find_package(rmw_fastrtps_shared_cpp REQUIRED)

find_package(fastrtps_cmake_module REQUIRED)
find_package(fastcdr REQUIRED CONFIG)
find_package(fastrtps REQUIRED CONFIG)
find_package(FastRTPS REQUIRED MODULE)

find_package(rmw REQUIRED)
find_package(rosidl_generator_c REQUIRED)
find_package(rosidl_typesupport_introspection_c REQUIRED)
find_package(rosidl_typesupport_introspection_cpp REQUIRED)

include_directories(include)

add_library(rmw_fastrtps_cpp
src/client_service_common.cpp
src/get_client.cpp
src/get_participant.cpp
src/get_publisher.cpp
src/get_service.cpp
src/get_subscriber.cpp
src/identifier.cpp
src/namespace_prefix.cpp
src/qos.cpp
src/rmw_logging.cpp
src/rmw_client.cpp
src/rmw_compare_gids_equal.cpp
src/rmw_count.cpp
src/rmw_get_gid_for_publisher.cpp
src/rmw_get_implementation_identifier.cpp
src/rmw_guard_condition.cpp
src/rmw_init.cpp
src/rmw_node.cpp
src/rmw_node_names.cpp
src/rmw_publish.cpp
src/rmw_publisher.cpp
src/rmw_request.cpp
src/rmw_response.cpp
src/rmw_serialize.cpp
src/rmw_service.cpp
src/rmw_service_names_and_types.cpp
src/rmw_service_server_is_available.cpp
src/rmw_subscription.cpp
src/rmw_take.cpp
src/rmw_topic_names_and_types.cpp
src/rmw_trigger_guard_condition.cpp
src/rmw_wait.cpp
src/rmw_wait_set.cpp
src/type_support_common.cpp
)
target_link_libraries(rmw_fastrtps_cpp
fastcdr fastrtps)

# specific order: dependents before dependencies
ament_target_dependencies(rmw_fastrtps_cpp
"rcutils"
"rosidl_typesupport_introspection_c"
"rosidl_typesupport_introspection_cpp"
"rmw_fastrtps_shared_cpp"
"rmw"
"rosidl_generator_c"
)

configure_rmw_library(rmw_fastrtps_cpp)

# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(${PROJECT_NAME}
PRIVATE "RMW_FASTRTPS_CPP_BUILDING_LIBRARY")

# specific order: dependents before dependencies
ament_export_include_directories(include)
ament_export_libraries(rmw_fastrtps_cpp)

ament_export_dependencies(rosidl_typesupport_introspection_cpp)
ament_export_dependencies(rosidl_typesupport_introspection_c)
ament_export_dependencies(rosidl_generator_c)
ament_export_dependencies(rcutils)
ament_export_dependencies(rmw_fastrtps_shared_cpp)
ament_export_dependencies(rmw)

register_rmw_implementation(
"c:rosidl_typesupport_c:rosidl_typesupport_introspection_c"
"cpp:rosidl_typesupport_cpp:rosidl_typesupport_introspection_cpp")

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

ament_package(
CONFIG_EXTRAS_POST "rmw_fastrtps_cpp-extras.cmake"
)

install(
DIRECTORY include/
DESTINATION include
)

install(
TARGETS rmw_fastrtps_cpp
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2016-2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RMW_FASTRTPS_CPP__MESSAGETYPESUPPORT_HPP_
#define RMW_FASTRTPS_CPP__MESSAGETYPESUPPORT_HPP_

#include <fastcdr/FastBuffer.h>
#include <fastcdr/Cdr.h>

#include <cassert>
#include <memory>

#include "TypeSupport.hpp"
#include "rosidl_typesupport_introspection_cpp/message_introspection.hpp"
#include "rosidl_typesupport_introspection_cpp/field_types.hpp"

namespace rmw_fastrtps_cpp
{

template<typename MembersType>
class MessageTypeSupport : public TypeSupport<MembersType>
{
public:
explicit MessageTypeSupport(const MembersType * members);
};

} // namespace rmw_fastrtps_cpp

#include "MessageTypeSupport_impl.hpp"

#endif // RMW_FASTRTPS_CPP__MESSAGETYPESUPPORT_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright 2016-2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RMW_FASTRTPS_CPP__MESSAGETYPESUPPORT_IMPL_HPP_
#define RMW_FASTRTPS_CPP__MESSAGETYPESUPPORT_IMPL_HPP_

#include <fastcdr/FastBuffer.h>
#include <fastcdr/Cdr.h>

#include <cassert>
#include <memory>
#include <string>

#include "rmw_fastrtps_cpp/MessageTypeSupport.hpp"
#include "rosidl_typesupport_introspection_cpp/field_types.hpp"

namespace rmw_fastrtps_cpp
{

template<typename MembersType>
MessageTypeSupport<MembersType>::MessageTypeSupport(const MembersType * members)
{
assert(members);
this->members_ = members;

std::string name = std::string(members->package_name_) + "::msg::dds_::" +
members->message_name_ + "_";
this->setName(name.c_str());

// Fully bound by default
this->max_size_bound_ = true;
// Encapsulation size
this->m_typeSize = 4;
if (this->members_->member_count_ != 0) {
this->m_typeSize += static_cast<uint32_t>(this->calculateMaxSerializedSize(members, 0));
} else {
this->m_typeSize++;
}
}

} // namespace rmw_fastrtps_cpp

#endif // RMW_FASTRTPS_CPP__MESSAGETYPESUPPORT_IMPL_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 2016-2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RMW_FASTRTPS_CPP__SERVICETYPESUPPORT_HPP_
#define RMW_FASTRTPS_CPP__SERVICETYPESUPPORT_HPP_

#include <fastcdr/FastBuffer.h>
#include <fastcdr/Cdr.h>
#include <cassert>

#include "TypeSupport.hpp"
#include "rosidl_typesupport_introspection_cpp/field_types.hpp"

namespace rmw_fastrtps_cpp
{

template<typename MembersType>
class ServiceTypeSupport : public TypeSupport<MembersType>
{
protected:
ServiceTypeSupport();
};

template<typename ServiceMembersType, typename MessageMembersType>
class RequestTypeSupport : public ServiceTypeSupport<MessageMembersType>
{
public:
explicit RequestTypeSupport(const ServiceMembersType * members);
};

template<typename ServiceMembersType, typename MessageMembersType>
class ResponseTypeSupport : public ServiceTypeSupport<MessageMembersType>
{
public:
explicit ResponseTypeSupport(const ServiceMembersType * members);
};

} // namespace rmw_fastrtps_cpp

#include "ServiceTypeSupport_impl.hpp"

#endif // RMW_FASTRTPS_CPP__SERVICETYPESUPPORT_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright 2016-2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RMW_FASTRTPS_CPP__SERVICETYPESUPPORT_IMPL_HPP_
#define RMW_FASTRTPS_CPP__SERVICETYPESUPPORT_IMPL_HPP_

#include <fastcdr/FastBuffer.h>
#include <fastcdr/Cdr.h>
#include <cassert>
#include <string>

#include "rmw_fastrtps_cpp/ServiceTypeSupport.hpp"
#include "rosidl_typesupport_introspection_cpp/field_types.hpp"

namespace rmw_fastrtps_cpp
{

template<typename MembersType>
ServiceTypeSupport<MembersType>::ServiceTypeSupport()
{
}

template<typename ServiceMembersType, typename MessageMembersType>
RequestTypeSupport<ServiceMembersType, MessageMembersType>::RequestTypeSupport(
const ServiceMembersType * members)
{
assert(members);
this->members_ = members->request_members_;

std::string name = std::string(members->package_name_) + "::srv::dds_::" +
members->service_name_ + "_Request_";
this->setName(name.c_str());

// Fully bound by default
this->max_size_bound_ = true;
// Encapsulation size
this->m_typeSize = 4;
if (this->members_->member_count_ != 0) {
this->m_typeSize += static_cast<uint32_t>(this->calculateMaxSerializedSize(this->members_, 0));
} else {
this->m_typeSize++;
}
}

template<typename ServiceMembersType, typename MessageMembersType>
ResponseTypeSupport<ServiceMembersType, MessageMembersType>::ResponseTypeSupport(
const ServiceMembersType * members)
{
assert(members);
this->members_ = members->response_members_;

std::string name = std::string(members->package_name_) + "::srv::dds_::" +
members->service_name_ + "_Response_";
this->setName(name.c_str());

// Fully bound by default
this->max_size_bound_ = true;
// Encapsulation size
this->m_typeSize = 4;
if (this->members_->member_count_ != 0) {
this->m_typeSize += static_cast<uint32_t>(this->calculateMaxSerializedSize(this->members_, 0));
} else {
this->m_typeSize++;
}
}

} // namespace rmw_fastrtps_cpp

#endif // RMW_FASTRTPS_CPP__SERVICETYPESUPPORT_IMPL_HPP_
Loading

0 comments on commit e374da9

Please sign in to comment.