11 #ifndef RTI_ROUTING_DETAIL_ForwarderType_UTILS_HPP_
12 #define RTI_ROUTING_DETAIL_ForwarderType_UTILS_HPP_
16 #include <rti/core/Exception.hpp>
17 #include <routingservice/routingservice_infrastructure.h>
19 #define RTI_ROUTING_THROW_ON_NULL(pointer) \
20 if ((pointer) == NULL) { \
21 throw dds::core::Error("invalid return of NULL"); \
24 #define RTI_ROUTING_THROW_ON_ENV_ERROR(NATIVE_ENV) \
25 if (RTI_RoutingServiceEnvironment_error_occurred((NATIVE_ENV))) { \
26 dds::core::Error rex( \
27 RTI_RoutingServiceEnvironment_get_error_message((NATIVE_ENV))); \
28 RTI_RoutingServiceEnvironment_clear_error((NATIVE_ENV)); \
32 #define RTI_ROUTING_SAMPLE_VECTOR_COPY_FROM_NATIVE( \
36 (VECTOR).resize((ARRAY_LENGTH)); \
37 memcpy(&((VECTOR)[0]), \
39 sizeof (void*) * (ARRAY_LENGTH));
41 #define RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS( \
44 (TO_VECTOR).resize((FROM_VECTOR).size()); \
45 memcpy(&(TO_VECTOR[0]), &(FROM_VECTOR)[0], sizeof(void*) * (FROM_VECTOR).size());
48 template <
typename OwnerType,
typename ForwarderType>
49 struct ScopedForwarder {
53 ForwarderType *forwarder,
54 RTI_RoutingServiceEnvironment *environment)
55 :owner_(owner), forwarder_(forwarder), environment_(environment)
66 if (forwarder_ != NULL) {
67 ForwarderType::delete_native(owner_, forwarder_->native(), environment_);
73 ForwarderType *forwarder_;
74 RTI_RoutingServiceEnvironment *environment_;
79 #endif // RTI_ROUTING_DETAIL_ForwarderType_UTILS_HPP_