HelloWorld.cpp

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 Data Distribution Service. 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]
/*
  WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.

  This file was generated from HelloWorld.idl using "rtiddsgen".
  The rtiddsgen tool is part of the RTI Data Distribution Service distribution.
  For more information, type 'rtiddsgen -help' at a command shell
  or consult the RTI Data Distribution Service manual.
*/

#pragma once


struct DDS_TypeCode;
    

using namespace System;
using namespace DDS;

    

public ref struct HelloWorld
        : public DDS::ICopyable<HelloWorld^> {
    // --- Declared members: -------------------------------------------------
  public:            
    
    System::String^ msg; // maximum length = (128)

    // --- Constructors and destructors: -------------------------------------
  public:
    HelloWorld();

    // --- Utility methods: --------------------------------------------------
  public:
    virtual System::Boolean copy_from(HelloWorld^ src);

    virtual System::Boolean Equals(System::Object^ other) override;

    
    static DDS::TypeCode^ get_typecode();

  private:
    static DDS::TypeCode^ _typecode;

}; // class HelloWorld




public ref class HelloWorldSeq sealed
        : public DDS::UserRefSequence<HelloWorld^> {
public:
    HelloWorldSeq() :
            DDS::UserRefSequence<HelloWorld^>() {
        // empty
    }
    HelloWorldSeq(System::Int32 max) :
            DDS::UserRefSequence<HelloWorld^>(max) {
        // empty
    }
    HelloWorldSeq(HelloWorldSeq^ src) :
            DDS::UserRefSequence<HelloWorld^>(src) {
        // empty
    }
};


DDS_TypeCode* HelloWorld_get_typecode();

HelloWorld.cpp

[$(NDDSHOME)/example/CPPCLI/helloWorld/HelloWorld.cpp]

/*
  WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.

  This file was generated from HelloWorld.idl using "rtiddsgen".
  The rtiddsgen tool is part of the RTI Data Distribution Service distribution.
  For more information, type 'rtiddsgen -help' at a command shell
  or consult the RTI Data Distribution Service manual.
*/

    
#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;
}



DDS::TypeCode^ HelloWorld::get_typecode() {
    if (_typecode == nullptr) {
        _typecode = gcnew DDS::TypeCode(HelloWorld_get_typecode());
    }
    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",/* Member name */
            {
                0,/* Representation ID */
                DDS_BOOLEAN_FALSE,/* Is a pointer? */
                -1, /* Bitfield bits */
                NULL/* Member type code is assigned later */
            },
            0, /* Ignored */
            0, /* Ignored */
            0, /* Ignored */
            NULL, /* Ignored */
            DDS_BOOLEAN_FALSE, /* Is a key? */
            DDS_PRIVATE_MEMBER,/* Ignored */
            0,/* Ignored */
            NULL/* Ignored */
        }
    };

    static DDS_TypeCode HelloWorld_g_tc =
    {{
        DDS_TK_STRUCT,/* Kind */
        DDS_BOOLEAN_FALSE, /* Ignored */
        -1,/* Ignored */
        (char *)"HelloWorld", /* Name */
        NULL, /* Ignored */
        0, /* Ignored */
        0, /* Ignored */
        NULL, /* Ignored */
        1, /* Number of members */
        HelloWorld_g_tc_members, /* Members */
        DDS_VM_NONE /* Ignored */
    }}; /* Type code for HelloWorld*/

    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;
}

RTI Data Distribution Service .Net APIs Version 4.5c Copyright © 9 Jun 2010 Real-Time Innovations, Inc