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
#pragma once
struct DDS_TypeCode;
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;
#ifndef NDDS_STANDALONE_TYPE
private:
#endif
};
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) {
}
};
#ifndef NDDS_STANDALONE_TYPE
#define NDDSUSERDllExport
NDDSUSERDllExport DDS_TypeCode* HelloWorld_get_typecode();
#endif
HelloWorld.cpp
#pragma unmanaged
#include "ndds/ndds_cpp.h"
#pragma managed
#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;
}
#ifndef NDDS_STANDALONE_TYPE
if (_typecode == nullptr) {
}
return _typecode;
}
#endif
#ifndef NDDS_STANDALONE_TYPE
DDS_TypeCode * HelloWorld_get_typecode(void)
{
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,
RTICdrTypeCodeAnnotations_INITIALIZER
}
};
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,
RTICdrTypeCodeAnnotations_INITIALIZER,
DDS_BOOLEAN_TRUE,
NULL,
NULL
}};
if (is_initialized) {
return &HelloWorld_g_tc;
}
HelloWorld_g_tc._data._annotations._allowedDataRepresentationMask = 5;
HelloWorld_g_tc_members[0]._representation._typeCode = (RTICdrTypeCode *)&HelloWorld_g_tc_msg_string;
HelloWorld_g_tc_members[0]._annotations._defaultValue._d = RTI_XCDR_TK_STRING;
HelloWorld_g_tc_members[0]._annotations._defaultValue._u.string_value = (DDS_Char *) "";
HelloWorld_g_tc._data._sampleAccessInfo = NULL;
is_initialized = RTI_TRUE;
return &HelloWorld_g_tc;
}
#endif