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)
126 stream_name(the_stream_name);
127 type_info().type_name(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(
176 &native().stream_name,
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_ Definition of the type information associated with a RTI Routing Service stream.
Definition: TypeInfo.hpp:169
Definition of the stream information that RTI Routing Service needs to manage user data streams...
Definition: StreamInfo.hpp:106
StreamInfo & disposed(bool the_disposed)
Sets the dispose flag in this object.
Definition: StreamInfo.hpp:153
StreamInfo(const std::string &the_stream_name, const std::string &the_type_name)
Constructs a StreamInfo with the minimum required information.
Definition: StreamInfo.hpp:122
bool disposed() const
Getter (see setter with the same name)
Definition: StreamInfo.hpp:138
const TypeInfo & type_info() const
Sets the type information associated with the stream.
Definition: StreamInfo.hpp:199
StreamInfo & stream_name(const std::string &the_stream_name)
Sets the name of the stream.
Definition: StreamInfo.hpp:173
Definition: AdapterPlugin.hpp:25
std::string stream_name() const
Getter (see setter with the same name)
Definition: StreamInfo.hpp:162
TypeInfo & type_info()
Getter (see setter with the same name)
Definition: StreamInfo.hpp:187