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:
public:
HelloWorld();
public:
virtual void clear() ;
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 = "";
}
void HelloWorld::clear(){
msg = "";
}
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,
RTI_CDR_REQUIRED_MEMBER,
DDS_PUBLIC_MEMBER,
1,
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;
}