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
[$(NDDSHOME)/example/CPPCLI/helloWorld/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);
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
[$(NDDSHOME)/example/CPPCLI/helloWorld/HelloWorldSupport.cpp]
#include "HelloWorldSupport.h"
#include "HelloWorldPlugin.h"
using namespace System;
using namespace DDS;
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);
}
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;
}