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

  This file was generated from test.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 "test.h"
    
/* ========================================================================= */
TestData_t::TestData_t() {
    
    key = gcnew array<System::Byte, 1>((KEY_SIZE::VALUE));
    bin_data = gcnew DDS::ByteSeq(((MAX_BINDATA_SIZE::VALUE)));
            
}

System::Boolean TestData_t::copy_from(TestData_t^ src) {
    TestData_t^ dst = this;

    System::Array::Copy(
        src->key, dst->key, src->key->Length);
    dst->entity_id = src->entity_id;
    dst->seq_num = src->seq_num;
    dst->timestamp_sec = src->timestamp_sec;
    dst->timestamp_usec = src->timestamp_usec;
    dst->latency_ping = src->latency_ping;
    if (!dst->bin_data->copy_from_no_alloc(src->bin_data)) {
        return false;
    }
            

    return true;
}

Boolean TestData_t::Equals(Object^ other) {
    if (other == nullptr) {
        return false;
    }        
    if (this == other) {
        return true;
    }

    TestData_t^ otherObj =
        dynamic_cast<TestData_t^>(other);
    if (otherObj == nullptr) {
        return false;
    }


    if (key->Length != otherObj->key->Length) {
        return false;
    }
    for (Int32 i = 0; i < ((KEY_SIZE::VALUE)); ++i) {
        if (key[i] != otherObj->key[i]) {
            return false;
        }
    }
            
    if (entity_id != otherObj->entity_id) {
        return false;
    }
            
    if (seq_num != otherObj->seq_num) {
        return false;
    }
            
    if (timestamp_sec != otherObj->timestamp_sec) {
        return false;
    }
            
    if (timestamp_usec != otherObj->timestamp_usec) {
        return false;
    }
            
    if (latency_ping != otherObj->latency_ping) {
        return false;
    }
            
    if (!bin_data->Equals(otherObj->bin_data)) {
        return false;
    }
            
    return true;
}



DDS::TypeCode^ TestData_t::get_typecode() {
    if (_typecode == nullptr) {
        _typecode = gcnew DDS::TypeCode(TestData_t_get_typecode());
    }
    return _typecode;
}


DDS_TypeCode* TestData_t_get_typecode()
{
    static RTIBool is_initialized = RTI_FALSE;

    static DDS_TypeCode TestData_t_g_tc_key_array = DDS_INITIALIZE_ARRAY_TYPECODE(1,(KEY_SIZE::VALUE),NULL,NULL);
    static DDS_TypeCode TestData_t_g_tc_bin_data_sequence = DDS_INITIALIZE_SEQUENCE_TYPECODE((MAX_BINDATA_SIZE::VALUE),NULL);

    static DDS_TypeCode_Member TestData_t_g_tc_members[7]=
    {
        {
            (char *)"key",/* 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 */
        },
        {
            (char *)"entity_id",/* 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 */
        },
        {
            (char *)"seq_num",/* 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 */
        },
        {
            (char *)"timestamp_sec",/* 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 */
        },
        {
            (char *)"timestamp_usec",/* 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 */
        },
        {
            (char *)"latency_ping",/* 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 */
        },
        {
            (char *)"bin_data",/* 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 TestData_t_g_tc =
    {{
        DDS_TK_STRUCT,/* Kind */
        DDS_BOOLEAN_FALSE, /* Ignored */
        -1,/* Ignored */
        (char *)"TestData_t", /* Name */
        NULL, /* Ignored */
        0, /* Ignored */
        0, /* Ignored */
        NULL, /* Ignored */
        7, /* Number of members */
        TestData_t_g_tc_members, /* Members */
        DDS_VM_NONE /* Ignored */
    }}; /* Type code for TestData_t*/

    if (is_initialized) {
        return &TestData_t_g_tc;
    }

    TestData_t_g_tc_key_array._data._typeCode = (RTICdrTypeCode *)&DDS_g_tc_octet;
    TestData_t_g_tc_bin_data_sequence._data._typeCode = (RTICdrTypeCode *)&DDS_g_tc_octet;

    TestData_t_g_tc_members[0]._representation._typeCode = (RTICdrTypeCode *)&TestData_t_g_tc_key_array;
    TestData_t_g_tc_members[1]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_long;
    TestData_t_g_tc_members[2]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_ulong;
    TestData_t_g_tc_members[3]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_long;
    TestData_t_g_tc_members[4]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_ulong;
    TestData_t_g_tc_members[5]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_long;
    TestData_t_g_tc_members[6]._representation._typeCode = (RTICdrTypeCode *)&TestData_t_g_tc_bin_data_sequence;

    is_initialized = RTI_TRUE;

    return &TestData_t_g_tc;
}
