Programming Language Type Description
The following programming language specific type representation is generated by rtiddsgen for use in application code, 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.
HelloWorld.h
[$(NDDSHOME)/example/CPPCLI/helloWorld/HelloWorld.h]
#pragma once
struct DDS_TypeCode;
using namespace System;
using namespace DDS;
public ref struct HelloWorld
public:
System::String^ msg;
public:
#define HelloWorld_LAST_MEMBER_ID 0
public:
HelloWorld();
public:
virtual System::Boolean copy_from(HelloWorld^ src);
virtual System::Boolean Equals(System::Object^ other) override;
private:
};
public ref class HelloWorldSeq sealed
: public DDS::UserRefSequence<HelloWorld^> {
public:
HelloWorldSeq() :
DDS::UserRefSequence<HelloWorld^>() {
}
HelloWorldSeq(System::Int32 max) :
DDS::UserRefSequence<HelloWorld^>(max) {
}
HelloWorldSeq(HelloWorldSeq^ src) :
DDS::UserRefSequence<HelloWorld^>(src) {
}
};
#define NDDSUSERDllExport
NDDSUSERDllExport DDS_TypeCode* HelloWorld_get_typecode();
HelloWorld.cpp
[$(NDDSHOME)/example/CPPCLI/helloWorld/HelloWorld.cpp]
#pragma unmanaged
#include "ndds/ndds_cpp.h"
#pragma managed
using namespace System;
using namespace System::Collections;
using namespace DDS;
#include "HelloWorld.h"
HelloWorld::HelloWorld() {
msg = L"";
}
System::Boolean HelloWorld::copy_from(HelloWorld^ src) {
HelloWorld^ dst = this;
dst->msg = src->msg;
return true;
}
Boolean HelloWorld::Equals(Object^ other) {
if (other == nullptr) {
return false;
}
if (this == other) {
return true;
}
HelloWorld^ otherObj =
dynamic_cast<HelloWorld^>(other);
if (otherObj == nullptr) {
return false;
}
if (!msg->Equals(otherObj->msg)) {
return false;
}
return true;
}
if (_typecode == nullptr) {
}
return _typecode;
}
DDS_TypeCode* HelloWorld_get_typecode()
{
static RTIBool is_initialized = RTI_FALSE;
static DDS_TypeCode HelloWorld_g_tc_msg_string = DDS_INITIALIZE_STRING_TYPECODE(128);
static DDS_TypeCode_Member HelloWorld_g_tc_members[1]=
{
{
(char *)"msg",
{
0,
DDS_BOOLEAN_FALSE,
-1,
NULL
},
0,
0,
0,
NULL,
DDS_BOOLEAN_FALSE,
DDS_PRIVATE_MEMBER,
0,
NULL
}
};
static DDS_TypeCode HelloWorld_g_tc =
{{
DDS_TK_STRUCT,
DDS_BOOLEAN_FALSE,
-1,
(char *)"HelloWorld",
NULL,
0,
0,
NULL,
1,
HelloWorld_g_tc_members,
DDS_VM_NONE
}};
if (is_initialized) {
return &HelloWorld_g_tc;
}
HelloWorld_g_tc_members[0]._representation._typeCode = (RTICdrTypeCode *)&HelloWorld_g_tc_msg_string;
is_initialized = RTI_TRUE;
return &HelloWorld_g_tc;
}