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


#ifndef NDDS_STANDALONE_TYPE
    #ifdef __cplusplus
        #ifndef ndds_cpp_h
            #include "ndds/ndds_cpp.h"
        #endif
        #ifndef dds_c_log_impl_h              
            #include "dds_c/dds_c_log_impl.h"                                
        #endif        
    #else
        #ifndef ndds_c_h
            #include "ndds/ndds_c.h"
        #endif
    #endif
    
    #ifndef cdr_type_h
        #include "cdr/cdr_type.h"
    #endif    

    #ifndef osapi_heap_h
        #include "osapi/osapi_heap.h" 
    #endif
#else
    #include "ndds_standalone_type.h"
#endif



#include "test.h"

/* ========================================================================= */
const char *TestData_tTYPENAME = "TestData_t";

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),NULL,NULL);
    static DDS_TypeCode TestData_t_g_tc_bin_data_sequence = DDS_INITIALIZE_SEQUENCE_TYPECODE((MAX_BINDATA_SIZE),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;
}


RTIBool TestData_t_initialize(
    TestData_t* sample) {
  return TestData_t_initialize_ex(sample,RTI_TRUE);
}
        
RTIBool TestData_t_initialize_ex(
    TestData_t* sample,RTIBool allocatePointers)
{

    void* buffer;                
    buffer = NULL;        
    
    if (!RTICdrType_initArray(
        sample->key, ((KEY_SIZE)), RTI_CDR_OCTET_SIZE)) {
        return RTI_FALSE;
    }
            
    if (!RTICdrType_initLong(&sample->entity_id)) {
        return RTI_FALSE;
    }                
            
    if (!RTICdrType_initUnsignedLong(&sample->seq_num)) {
        return RTI_FALSE;
    }                
            
    if (!RTICdrType_initLong(&sample->timestamp_sec)) {
        return RTI_FALSE;
    }                
            
    if (!RTICdrType_initUnsignedLong(&sample->timestamp_usec)) {
        return RTI_FALSE;
    }                
            
    if (!RTICdrType_initLong(&sample->latency_ping)) {
        return RTI_FALSE;
    }                
            
    DDS_OctetSeq_initialize(&sample->bin_data);
                
    if (!DDS_OctetSeq_set_maximum(&sample->bin_data,
            ((MAX_BINDATA_SIZE)))) {
        return RTI_FALSE;
    }
            

    return RTI_TRUE;
}

void TestData_t_finalize(
    TestData_t* sample)
{
    TestData_t_finalize_ex(sample,RTI_TRUE);
}
        
void TestData_t_finalize_ex(
    TestData_t* sample,RTIBool deletePointers)
{        

    DDS_OctetSeq_finalize(&sample->bin_data);
            
}

RTIBool TestData_t_copy(
    TestData_t* dst,
    const TestData_t* src)
{        

    if (!RTICdrType_copyArray(
        dst->key, src->key, ((KEY_SIZE)), RTI_CDR_OCTET_SIZE)) {
        return RTI_FALSE;
    }
            
    if (!RTICdrType_copyLong(
        &dst->entity_id, &src->entity_id)) {
        return RTI_FALSE;
    }
            
    if (!RTICdrType_copyUnsignedLong(
        &dst->seq_num, &src->seq_num)) {
        return RTI_FALSE;
    }
            
    if (!RTICdrType_copyLong(
        &dst->timestamp_sec, &src->timestamp_sec)) {
        return RTI_FALSE;
    }
            
    if (!RTICdrType_copyUnsignedLong(
        &dst->timestamp_usec, &src->timestamp_usec)) {
        return RTI_FALSE;
    }
            
    if (!RTICdrType_copyLong(
        &dst->latency_ping, &src->latency_ping)) {
        return RTI_FALSE;
    }
            
    if (!DDS_OctetSeq_copy_no_alloc(&dst->bin_data,
                                          &src->bin_data)) {
        return RTI_FALSE;
    }
            

    return RTI_TRUE;
}


/**
 * <<IMPLEMENTATION>>
 *
 * Defines:  TSeq, T
 *
 * Configure and implement 'TestData_t' sequence class.
 */
#define T TestData_t
#define TSeq TestData_tSeq
#define T_initialize_ex TestData_t_initialize_ex
#define T_finalize_ex   TestData_t_finalize_ex
#define T_copy       TestData_t_copy

#ifndef NDDS_STANDALONE_TYPE
#include "dds_c/generic/dds_c_sequence_TSeq.gen"
#ifdef __cplusplus
#include "dds_cpp/generic/dds_cpp_sequence_TSeq.gen"
#endif
#else
#include "dds_c_sequence_TSeq.gen"
#ifdef __cplusplus
#include "dds_cpp_sequence_TSeq.gen"
#endif
#endif

#undef T_copy
#undef T_finalize_ex
#undef T_initialize_ex
#undef TSeq
#undef T

