11 #ifndef RTI_ROUTING_ADAPTER_STREAM_INFO_HPP_
12 #define RTI_ROUTING_ADAPTER_STREAM_INFO_HPP_
16 #include <dds/core/macros.hpp>
19 #include <routingservice/routingservice_infrastructure.h>
20 #include <dds/core/Value.hpp>
21 #include <dds/core/Exception.hpp>
22 #include <rti/core/NativeValueType.hpp>
23 #include <rti/routing/TypeInfo.hpp>
25 namespace rti {
namespace routing {
31 class StreamInfoAdapter {
33 typedef RTI_RoutingServiceStreamInfo native_type;
35 static void initialize(native_type& native_value)
39 sizeof (RTI_RoutingServiceStreamInfo));
42 static void finalize(native_type& native_value)
44 TypeInfoAdapter::finalize(native_value.type_info);
45 if (native_value.stream_name != NULL) {
46 DDS_String_free(native_value.stream_name);
47 native_value.stream_name = NULL;
51 static void copy(native_type& destination,
const native_type& source)
53 char *result = DDS_String_replace(
54 &destination.stream_name,
56 if (source.stream_name != NULL && result == NULL) {
57 throw std::bad_alloc();
59 destination.disposed = source.disposed;
60 TypeInfoAdapter::copy(
61 destination.type_info,
65 static bool equals(
const native_type& first,
const native_type& second)
67 if (strcmp(first.stream_name, second.stream_name) != 0) {
70 if (first.disposed != second.disposed) {
73 return TypeInfoAdapter::equals(first.type_info, second.type_info);
86 struct native_type_traits<rti::routing::StreamInfo> {
87 typedef rti::routing::StreamInfoAdapter adapter_type;
88 typedef RTI_RoutingServiceStreamInfo native_type;
106 class StreamInfo :
public rti::core::NativeValueType<StreamInfo> {
108 RTI_NATIVE_VALUE_TYPE_DEFINE_DEFAULT_MOVE_OPERATIONS(
StreamInfo)
110 typedef rti::core::NativeValueType<StreamInfo> Base;
123 const std::string& the_stream_name,
124 const std::string& the_type_name)
130 StreamInfo(
const RTI_RoutingServiceStreamInfo &native_stream_info)
131 : Base(native_stream_info)
140 return native().disposed ?
true :
false;
155 native().disposed = the_disposed ? 1 : 0;
164 return native().stream_name;
175 if (DDS_String_replace(
177 the_stream_name.c_str()) == NULL) {
178 throw std::bad_alloc();
189 using namespace rti::core::native_conversions;
191 return cast_from_native<TypeInfo>(native().type_info);
201 using namespace rti::core::native_conversions;
203 return cast_from_native<TypeInfo>(native().type_info);
210 #endif // RTI_ROUTING_ADAPTER_STREAM_INFO_HPP_