HelloWorldSupport.cpp

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 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.

HelloWorldSupport.h

[$(NDDSHOME)/example/CPPCLI/helloWorld/HelloWorldSupport.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

#include "HelloWorld.h"


class DDSDataWriter;
class DDSDataReader;
    
// ---------------------------------------------------------------------------
// HelloWorldTypeSupport
// ---------------------------------------------------------------------------

ref class HelloWorldPlugin;

/* A collection of useful methods for dealing with objects of type
 * HelloWorld.
 */
public ref class HelloWorldTypeSupport
        : public DDS::TypedTypeSupport<HelloWorld^> {
    // --- Type name: --------------------------------------------------------
  public:
    static System::String^ TYPENAME = "HelloWorld";


    // --- Public Methods: ---------------------------------------------------
  public:
    /* Get the default name of this type.
     *
     * An application can choose to register a type under any name, so
     * calling this method is strictly optional.
     */
    static System::String^ get_type_name();

    /* Register this type with the given participant under the given logical
     * name. This type must be registered before a Topic can be created that
     * uses it.
     */
    static void register_type(
            DDS::DomainParticipant^ participant,
            System::String^ type_name);

    /* Unregister this type from the given participant, where it was
     * previously registered under the given name. No further Topic creation
     * using this type will be possible.
     *
     * Unregistration allows some middleware resources to be reclaimed.
     */
    static void unregister_type(
            DDS::DomainParticipant^ participant,
            System::String^ type_name);

    /* Create an instance of the HelloWorld type.
     */
    static HelloWorld^ create_data();

    /* If instances of the HelloWorld type require any
     * explicit finalization, perform it now on the given sample.
     */
    static void delete_data(HelloWorld^ data);

    /* Write the contents of the data sample to standard out.
     */
    static void print_data(HelloWorld^ a_data);

    /* Perform a deep copy of the contents of one data sample over those of
     * another, overwriting it.
     */
    static void copy_data(
        HelloWorld^ dst_data,
        HelloWorld^ src_data);


    // --- Implementation: ---------------------------------------------------
    /* The following code is for the use of the middleware infrastructure.
     * Applications are not expected to call it directly.
     */
public:
    virtual DDS::DataReader^ create_datareaderI(
        System::IntPtr impl) override;
    virtual DDS::DataWriter^ create_datawriterI(
        System::IntPtr impl) override;

private:
    static HelloWorldTypeSupport^ get_instance();

    HelloWorldTypeSupport();

private:
    static HelloWorldTypeSupport^ _singleton;
    HelloWorldPlugin^ _type_plugin;
};


// ---------------------------------------------------------------------------
// HelloWorldDataReader
// ---------------------------------------------------------------------------

public ref class HelloWorldDataReader :
        public DDS::TypedDataReader<HelloWorld^> {
    /* The following code is for the use of the middleware infrastructure.
     * Applications are not expected to call it directly.
     */
  internal:
    HelloWorldDataReader(System::IntPtr impl);
};


// ---------------------------------------------------------------------------
// HelloWorldDataWriter
// ---------------------------------------------------------------------------

public ref class HelloWorldDataWriter :
        public DDS::TypedDataWriter<HelloWorld^> {
    /* The following code is for the use of the middleware infrastructure.
     * Applications are not expected to call it directly.
     */
  internal:
    HelloWorldDataWriter(System::IntPtr impl);
};

HelloWorldSupport.cpp

[$(NDDSHOME)/example/CPPCLI/helloWorld/HelloWorldSupport.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.
*/

#include "HelloWorldSupport.h"
#include "HelloWorldPlugin.h"


using namespace System;
using namespace DDS;
    
/* ========================================================================= */

// ---------------------------------------------------------------------------
// HelloWorldDataWriter
// ---------------------------------------------------------------------------

HelloWorldDataWriter::HelloWorldDataWriter(
        System::IntPtr impl) : DDS::TypedDataWriter<HelloWorld^>(impl) {
    // empty
}


// ---------------------------------------------------------------------------
// HelloWorldDataReader
// ---------------------------------------------------------------------------

HelloWorldDataReader::HelloWorldDataReader(
        System::IntPtr impl) : DDS::TypedDataReader<HelloWorld^>(impl) {
    // empty
}


// ---------------------------------------------------------------------------
// HelloWorldTypeSupport
// ---------------------------------------------------------------------------

HelloWorldTypeSupport::HelloWorldTypeSupport()
        : DDS::TypedTypeSupport<HelloWorld^>(
            HelloWorldPlugin::get_instance()) {

    _type_plugin = HelloWorldPlugin::get_instance();
}

void HelloWorldTypeSupport::register_type(
        DDS::DomainParticipant^ participant,
        System::String^ type_name) {

    get_instance()->register_type_untyped(participant, type_name);
}

void HelloWorldTypeSupport::unregister_type(
        DDS::DomainParticipant^ participant,
        System::String^ type_name) {

    get_instance()->unregister_type_untyped(participant, type_name);
}

HelloWorld^ HelloWorldTypeSupport::create_data() {
    return gcnew HelloWorld();
}

void HelloWorldTypeSupport::delete_data(
        HelloWorld^ a_data) {
    /* If the generated type does not implement IDisposable (the default),
     * the following will no a no-op.
     */
    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;
}

DDS::DataReader^ HelloWorldTypeSupport::create_datareaderI(
        System::IntPtr impl) {

    return gcnew HelloWorldDataReader(impl);
}

DDS::DataWriter^ HelloWorldTypeSupport::create_datawriterI(
        System::IntPtr impl) {

    return gcnew HelloWorldDataWriter(impl);
}

HelloWorldTypeSupport^
HelloWorldTypeSupport::get_instance() {
    if (_singleton == nullptr) {
        _singleton = gcnew HelloWorldTypeSupport();
    }
    return _singleton;
}
    

RTI Data Distribution Service .Net APIs Version 4.5e Copyright © 23 Oct 2011 Real-Time Innovations, Inc