User Data Type Support
Files generated by rtiddsgen that implement the type specific APIs required by the DDS specification, as described in the User Data Type Support, where:
The following files are always generated in the C++/CLI language, even when code is generated with the -language C#
option, because they depend on unmanaged code that ships with RTI Connext. Once compiled, the code can be used from either C++/CLI or C# code; see the C# publisher and subscriber example code.
HelloWorldSupport.h
#pragma once
#include "HelloWorld.h"
class DDSDataWriter;
class DDSDataReader;
ref class HelloWorldPlugin;
public ref class HelloWorldTypeSupport
: public DDS::TypedTypeSupport<HelloWorld^> {
public:
static System::String^ TYPENAME = "HelloWorld";
public:
static System::String^ get_type_name();
static void register_type(
System::String^ type_name);
static void unregister_type(
System::String^ type_name);
static HelloWorld^ create_data();
static void delete_data(HelloWorld^ data);
static void print_data(HelloWorld^ a_data);
static void copy_data(
HelloWorld^ dst_data,
HelloWorld^ src_data);
static void serialize_data_to_cdr_buffer(
array<System::Byte>^ buffer,
System::UInt32% length,
HelloWorld^ a_data);
static void deserialize_data_from_cdr_buffer(
HelloWorld^ a_data,
array<System::Byte>^ buffer,
System::UInt32 length);
static System::String^ data_to_string(
HelloWorld ^sample,
PrintFormatProperty ^property);
static System::String^ data_to_string(
HelloWorld ^sample);
public:
virtual System::String^ get_type_name_untyped() override;
System::IntPtr impl) override;
System::IntPtr impl) override;
virtual HelloWorld^ create_data_untyped() override;
public:
static HelloWorldTypeSupport^ get_instance();
HelloWorldTypeSupport();
private:
static HelloWorldTypeSupport^ _singleton;
HelloWorldPlugin^ _type_plugin;
};
public ref class HelloWorldDataReader :
internal:
HelloWorldDataReader(System::IntPtr impl);
};
public ref class HelloWorldDataWriter :
internal:
HelloWorldDataWriter(System::IntPtr impl);
};
HelloWorldSupport.cpp
#include "HelloWorldSupport.h"
#include "HelloWorldPlugin.h"
#pragma unmanaged
#include "ndds/ndds_cpp.h"
#pragma managed
HelloWorldDataWriter::HelloWorldDataWriter(
}
HelloWorldDataReader::HelloWorldDataReader(
}
HelloWorldTypeSupport::HelloWorldTypeSupport()
: DDS::TypedTypeSupport<HelloWorld^>(
HelloWorldPlugin::get_instance()) {
_type_plugin = HelloWorldPlugin::get_instance();
}
void HelloWorldTypeSupport::register_type(
System::String^ type_name) {
get_instance()->register_type_untyped(participant, type_name);
}
void HelloWorldTypeSupport::unregister_type(
System::String^ type_name) {
get_instance()->unregister_type_untyped(participant, type_name);
}
HelloWorld^ HelloWorldTypeSupport::create_data() {
return gcnew HelloWorld();
}
HelloWorld^ HelloWorldTypeSupport::create_data_untyped() {
return create_data();
}
void HelloWorldTypeSupport::delete_data(
HelloWorld^ a_data) {
delete a_data;
}
void HelloWorldTypeSupport::print_data(HelloWorld^ a_data) {
get_instance()->_type_plugin->print_data(a_data, nullptr, 0);
}
void HelloWorldTypeSupport::copy_data(
HelloWorld^ dst, HelloWorld^ src) {
get_instance()->copy_data_untyped(dst, src);
}
void HelloWorldTypeSupport::serialize_data_to_cdr_buffer(
array<System::Byte>^ buffer,
System::UInt32% length,
HelloWorld^ a_data)
{
if (!get_instance()->_type_plugin->serialize_to_cdr_buffer(buffer,length,a_data)) {
}
}
void HelloWorldTypeSupport::deserialize_data_from_cdr_buffer(
HelloWorld^ a_data,
array<System::Byte>^ buffer,
System::UInt32 length)
{
if (!get_instance()->_type_plugin->deserialize_from_cdr_buffer(a_data,buffer,length)) {
}
}
System::String^ HelloWorldTypeSupport::data_to_string(
HelloWorld ^sample,
{
return get_instance()->_type_plugin->data_to_string(
sample,
formatProperty);
}
System::String^ HelloWorldTypeSupport::data_to_string(
HelloWorld ^sample)
{
return get_instance()->_type_plugin->data_to_string(
sample,
formatProperty);
}
return HelloWorld::get_typecode();
}
System::String^ HelloWorldTypeSupport::get_type_name() {
return TYPENAME;
}
System::String^ HelloWorldTypeSupport::get_type_name_untyped() {
return TYPENAME;
}
System::IntPtr impl) {
return gcnew HelloWorldDataReader(impl);
}
System::IntPtr impl) {
return gcnew HelloWorldDataWriter(impl);
}
HelloWorldTypeSupport^
HelloWorldTypeSupport::get_instance() {
if (_singleton == nullptr) {
_singleton = gcnew HelloWorldTypeSupport();
}
return _singleton;
}