Skip to content

Commit

Permalink
Refs #3061. Adapting code on rmw_fastrtps_dynamic_cpp.
Browse files Browse the repository at this point in the history
  • Loading branch information
MiguelCompany committed Jul 6, 2018
1 parent e374da9 commit 02783b9
Show file tree
Hide file tree
Showing 44 changed files with 183 additions and 180 deletions.
18 changes: 9 additions & 9 deletions rmw_fastrtps_dynamic_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

cmake_minimum_required(VERSION 3.5)

project(rmw_fastrtps_cpp)
project(rmw_fastrtps_dynamic_cpp)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
Expand Down Expand Up @@ -42,7 +42,7 @@ find_package(rosidl_typesupport_introspection_cpp REQUIRED)

include_directories(include)

add_library(rmw_fastrtps_cpp
add_library(rmw_fastrtps_dynamic_cpp
src/client_service_common.cpp
src/get_client.cpp
src/get_participant.cpp
Expand Down Expand Up @@ -78,11 +78,11 @@ add_library(rmw_fastrtps_cpp
src/rmw_wait_set.cpp
src/type_support_common.cpp
)
target_link_libraries(rmw_fastrtps_cpp
target_link_libraries(rmw_fastrtps_dynamic_cpp
fastcdr fastrtps)

# specific order: dependents before dependencies
ament_target_dependencies(rmw_fastrtps_cpp
ament_target_dependencies(rmw_fastrtps_dynamic_cpp
"rcutils"
"rosidl_typesupport_introspection_c"
"rosidl_typesupport_introspection_cpp"
Expand All @@ -91,16 +91,16 @@ ament_target_dependencies(rmw_fastrtps_cpp
"rosidl_generator_c"
)

configure_rmw_library(rmw_fastrtps_cpp)
configure_rmw_library(rmw_fastrtps_dynamic_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")
PRIVATE "RMW_FASTRTPS_DYNAMIC_CPP_BUILDING_LIBRARY")

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

ament_export_dependencies(rosidl_typesupport_introspection_cpp)
ament_export_dependencies(rosidl_typesupport_introspection_c)
Expand All @@ -119,7 +119,7 @@ if(BUILD_TESTING)
endif()

ament_package(
CONFIG_EXTRAS_POST "rmw_fastrtps_cpp-extras.cmake"
CONFIG_EXTRAS_POST "rmw_fastrtps_dynamic_cpp-extras.cmake"
)

install(
Expand All @@ -128,7 +128,7 @@ install(
)

install(
TARGETS rmw_fastrtps_cpp
TARGETS rmw_fastrtps_dynamic_cpp
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// 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_
#ifndef RMW_FASTRTPS_DYNAMIC_CPP__MESSAGETYPESUPPORT_HPP_
#define RMW_FASTRTPS_DYNAMIC_CPP__MESSAGETYPESUPPORT_HPP_

#include <fastcdr/FastBuffer.h>
#include <fastcdr/Cdr.h>
Expand All @@ -25,7 +25,7 @@
#include "rosidl_typesupport_introspection_cpp/message_introspection.hpp"
#include "rosidl_typesupport_introspection_cpp/field_types.hpp"

namespace rmw_fastrtps_cpp
namespace rmw_fastrtps_dynamic_cpp
{

template<typename MembersType>
Expand All @@ -35,8 +35,8 @@ class MessageTypeSupport : public TypeSupport<MembersType>
explicit MessageTypeSupport(const MembersType * members);
};

} // namespace rmw_fastrtps_cpp
} // namespace rmw_fastrtps_dynamic_cpp

#include "MessageTypeSupport_impl.hpp"

#endif // RMW_FASTRTPS_CPP__MESSAGETYPESUPPORT_HPP_
#endif // RMW_FASTRTPS_DYNAMIC_CPP__MESSAGETYPESUPPORT_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// 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_
#ifndef RMW_FASTRTPS_DYNAMIC_CPP__MESSAGETYPESUPPORT_IMPL_HPP_
#define RMW_FASTRTPS_DYNAMIC_CPP__MESSAGETYPESUPPORT_IMPL_HPP_

#include <fastcdr/FastBuffer.h>
#include <fastcdr/Cdr.h>
Expand All @@ -22,10 +22,10 @@
#include <memory>
#include <string>

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

namespace rmw_fastrtps_cpp
namespace rmw_fastrtps_dynamic_cpp
{

template<typename MembersType>
Expand All @@ -49,6 +49,6 @@ MessageTypeSupport<MembersType>::MessageTypeSupport(const MembersType * members)
}
}

} // namespace rmw_fastrtps_cpp
} // namespace rmw_fastrtps_dynamic_cpp

#endif // RMW_FASTRTPS_CPP__MESSAGETYPESUPPORT_IMPL_HPP_
#endif // RMW_FASTRTPS_DYNAMIC_CPP__MESSAGETYPESUPPORT_IMPL_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// 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_
#ifndef RMW_FASTRTPS_DYNAMIC_CPP__SERVICETYPESUPPORT_HPP_
#define RMW_FASTRTPS_DYNAMIC_CPP__SERVICETYPESUPPORT_HPP_

#include <fastcdr/FastBuffer.h>
#include <fastcdr/Cdr.h>
Expand All @@ -22,7 +22,7 @@
#include "TypeSupport.hpp"
#include "rosidl_typesupport_introspection_cpp/field_types.hpp"

namespace rmw_fastrtps_cpp
namespace rmw_fastrtps_dynamic_cpp
{

template<typename MembersType>
Expand All @@ -46,8 +46,8 @@ class ResponseTypeSupport : public ServiceTypeSupport<MessageMembersType>
explicit ResponseTypeSupport(const ServiceMembersType * members);
};

} // namespace rmw_fastrtps_cpp
} // namespace rmw_fastrtps_dynamic_cpp

#include "ServiceTypeSupport_impl.hpp"

#endif // RMW_FASTRTPS_CPP__SERVICETYPESUPPORT_HPP_
#endif // RMW_FASTRTPS_DYNAMIC_CPP__SERVICETYPESUPPORT_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 RMW_FASTRTPS_CPP__SERVICETYPESUPPORT_IMPL_HPP_
#define RMW_FASTRTPS_CPP__SERVICETYPESUPPORT_IMPL_HPP_
#ifndef RMW_FASTRTPS_DYNAMIC_CPP__SERVICETYPESUPPORT_IMPL_HPP_
#define RMW_FASTRTPS_DYNAMIC_CPP__SERVICETYPESUPPORT_IMPL_HPP_

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

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

namespace rmw_fastrtps_cpp
namespace rmw_fastrtps_dynamic_cpp
{

template<typename MembersType>
Expand Down Expand Up @@ -75,6 +75,6 @@ ResponseTypeSupport<ServiceMembersType, MessageMembersType>::ResponseTypeSupport
}
}

} // namespace rmw_fastrtps_cpp
} // namespace rmw_fastrtps_dynamic_cpp

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

#ifndef RMW_FASTRTPS_CPP__TYPESUPPORT_HPP_
#define RMW_FASTRTPS_CPP__TYPESUPPORT_HPP_
#ifndef RMW_FASTRTPS_DYNAMIC_CPP__TYPESUPPORT_HPP_
#define RMW_FASTRTPS_DYNAMIC_CPP__TYPESUPPORT_HPP_

#include <rosidl_generator_c/string.h>
#include <rosidl_generator_c/string_functions.h>
Expand Down Expand Up @@ -41,7 +41,7 @@

#include "rmw_fastrtps_shared_cpp/TypeSupport.hpp"

namespace rmw_fastrtps_cpp
namespace rmw_fastrtps_dynamic_cpp
{

// Helper class that uses template specialization to read/write string types to/from a
Expand All @@ -61,13 +61,13 @@ struct StringHelper<rosidl_typesupport_introspection_c__MessageMembers>
auto c_string = static_cast<rosidl_generator_c__String *>(data);
if (!c_string) {
RCUTILS_LOG_ERROR_NAMED(
"rmw_fastrtps_cpp",
"rmw_fastrtps_dynamic_cpp",
"Failed to cast data as rosidl_generator_c__String")
return current_alignment;
}
if (!c_string->data) {
RCUTILS_LOG_ERROR_NAMED(
"rmw_fastrtps_cpp",
"rmw_fastrtps_dynamic_cpp",
"rosidl_generator_c_String had invalid data")
return current_alignment;
}
Expand All @@ -82,13 +82,13 @@ struct StringHelper<rosidl_typesupport_introspection_c__MessageMembers>
auto c_string = static_cast<rosidl_generator_c__String *>(data);
if (!c_string) {
RCUTILS_LOG_ERROR_NAMED(
"rmw_fastrtps_cpp",
"rmw_fastrtps_dynamic_cpp",
"Failed to cast data as rosidl_generator_c__String")
return "";
}
if (!c_string->data) {
RCUTILS_LOG_ERROR_NAMED(
"rmw_fastrtps_cpp",
"rmw_fastrtps_dynamic_cpp",
"rosidl_generator_c_String had invalid data")
return "";
}
Expand Down Expand Up @@ -159,8 +159,8 @@ class TypeSupport : public rmw_fastrtps_shared_cpp::TypeSupport
bool call_new);
};

} // namespace rmw_fastrtps_cpp
} // namespace rmw_fastrtps_dynamic_cpp

#include "TypeSupport_impl.hpp"

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

#ifndef RMW_FASTRTPS_CPP__TYPESUPPORT_IMPL_HPP_
#define RMW_FASTRTPS_CPP__TYPESUPPORT_IMPL_HPP_
#ifndef RMW_FASTRTPS_DYNAMIC_CPP__TYPESUPPORT_IMPL_HPP_
#define RMW_FASTRTPS_DYNAMIC_CPP__TYPESUPPORT_IMPL_HPP_

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

#include "rmw_fastrtps_cpp/TypeSupport.hpp"
#include "rmw_fastrtps_cpp/macros.hpp"
#include "rmw_fastrtps_dynamic_cpp/TypeSupport.hpp"
#include "rmw_fastrtps_dynamic_cpp/macros.hpp"
#include "rosidl_typesupport_introspection_cpp/field_types.hpp"
#include "rosidl_typesupport_introspection_cpp/message_introspection.hpp"
#include "rosidl_typesupport_introspection_cpp/service_introspection.hpp"
Expand All @@ -32,7 +32,7 @@

#include "rosidl_generator_c/primitives_array_functions.h"

namespace rmw_fastrtps_cpp
namespace rmw_fastrtps_dynamic_cpp
{

template<typename T>
Expand Down Expand Up @@ -977,6 +977,6 @@ bool TypeSupport<MembersType>::deserializeROSmessage(
return true;
}

} // namespace rmw_fastrtps_cpp
} // namespace rmw_fastrtps_dynamic_cpp

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

#ifndef RMW_FASTRTPS_CPP__GET_CLIENT_HPP_
#define RMW_FASTRTPS_CPP__GET_CLIENT_HPP_
#ifndef RMW_FASTRTPS_DYNAMIC_CPP__GET_CLIENT_HPP_
#define RMW_FASTRTPS_DYNAMIC_CPP__GET_CLIENT_HPP_

#include "fastrtps/publisher/Publisher.h"
#include "fastrtps/subscriber/Subscriber.h"
#include "rmw/rmw.h"
#include "rmw_fastrtps_cpp/visibility_control.h"
#include "rmw_fastrtps_dynamic_cpp/visibility_control.h"

namespace rmw_fastrtps_cpp
namespace rmw_fastrtps_dynamic_cpp
{

/// Return a native FastRTPS publisher handle for the request.
Expand All @@ -30,7 +30,7 @@ namespace rmw_fastrtps_cpp
*
* \return native FastRTPS publisher handle if successful, otherwise `NULL`
*/
RMW_FASTRTPS_CPP_PUBLIC
RMW_FASTRTPS_DYNAMIC_CPP_PUBLIC
eprosima::fastrtps::Publisher *
get_request_publisher(rmw_client_t * client);

Expand All @@ -41,10 +41,10 @@ get_request_publisher(rmw_client_t * client);
*
* \return native FastRTPS subscriber handle if successful, otherwise `NULL`
*/
RMW_FASTRTPS_CPP_PUBLIC
RMW_FASTRTPS_DYNAMIC_CPP_PUBLIC
eprosima::fastrtps::Subscriber *
get_response_subscriber(rmw_client_t * client);

} // namespace rmw_fastrtps_cpp
} // namespace rmw_fastrtps_dynamic_cpp

#endif // RMW_FASTRTPS_CPP__GET_CLIENT_HPP_
#endif // RMW_FASTRTPS_DYNAMIC_CPP__GET_CLIENT_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 RMW_FASTRTPS_CPP__GET_PARTICIPANT_HPP_
#define RMW_FASTRTPS_CPP__GET_PARTICIPANT_HPP_
#ifndef RMW_FASTRTPS_DYNAMIC_CPP__GET_PARTICIPANT_HPP_
#define RMW_FASTRTPS_DYNAMIC_CPP__GET_PARTICIPANT_HPP_

#include "fastrtps/participant/Participant.h"
#include "rmw/rmw.h"
#include "rmw_fastrtps_cpp/visibility_control.h"
#include "rmw_fastrtps_dynamic_cpp/visibility_control.h"

namespace rmw_fastrtps_cpp
namespace rmw_fastrtps_dynamic_cpp
{

/// Return a native FastRTPS participant handle.
Expand All @@ -29,10 +29,10 @@ namespace rmw_fastrtps_cpp
*
* \return native FastRTPS participant handle if successful, otherwise `NULL`
*/
RMW_FASTRTPS_CPP_PUBLIC
RMW_FASTRTPS_DYNAMIC_CPP_PUBLIC
eprosima::fastrtps::Participant *
get_participant(rmw_node_t * node);

} // namespace rmw_fastrtps_cpp
} // namespace rmw_fastrtps_dynamic_cpp

#endif // RMW_FASTRTPS_CPP__GET_PARTICIPANT_HPP_
#endif // RMW_FASTRTPS_DYNAMIC_CPP__GET_PARTICIPANT_HPP_
Loading

0 comments on commit 02783b9

Please sign in to comment.