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>
25namespace rti {
namespace routing {
31class 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);
86struct native_type_traits<rti::routing::StreamInfo> {
87 typedef rti::routing::StreamInfoAdapter adapter_type;
88 typedef RTI_RoutingServiceStreamInfo native_type;
106class 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);
Definition of the stream information that RTI Routing Service needs to manage user data streams.
Definition: StreamInfo.hpp:106
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
StreamInfo & disposed(bool the_disposed)
Sets the dispose flag in this object.
Definition: StreamInfo.hpp:153
TypeInfo & type_info()
Getter (see setter with the same name)
Definition: StreamInfo.hpp:187
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
std::string stream_name() const
Getter (see setter with the same name)
Definition: StreamInfo.hpp:162
bool disposed() const
Getter (see setter with the same name)
Definition: StreamInfo.hpp:138
Definition of the type information associated with a RTI Routing Service stream.
Definition: TypeInfo.hpp:169
std::string type_name() const
Getter (see setter with the same name)
Definition: TypeInfo.hpp:209