text: 
  
  /*
  WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.
  
  This file was generated from BatteryState_.idl using "rtiddsgen".
  The rtiddsgen tool is part of the RTI Connext distribution.
  For more information, type 'rtiddsgen -help' at a command shell
  or consult the RTI Connext manual.
  */
  
  #ifndef NDDS_STANDALONE_TYPE
  #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        
  
  #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 "BatteryState_.h"
  
  #include <new>
  
  namespace sensor_msgs {
      namespace msg {
          namespace dds_ {
  
              /* ========================================================================= */
              const char *BatteryState_TYPENAME = "sensor_msgs::msg::dds_::BatteryState_";
  
              DDS_TypeCode* BatteryState__get_typecode()
              {
                  static RTIBool is_initialized = RTI_FALSE;
  
                  static DDS_TypeCode BatteryState__g_tc_cell_voltage__sequence = DDS_INITIALIZE_SEQUENCE_TYPECODE(RTI_INT32_MAX,NULL);
                  static DDS_TypeCode BatteryState__g_tc_location__string = DDS_INITIALIZE_STRING_TYPECODE(RTI_INT32_MAX);
                  static DDS_TypeCode BatteryState__g_tc_serial_number__string = DDS_INITIALIZE_STRING_TYPECODE(RTI_INT32_MAX);
                  static DDS_TypeCode_Member BatteryState__g_tc_members[14]=
                  {
  
                      {
                          (char *)"header_",/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"voltage_",/* Member name */
                          {
                              1,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"current_",/* Member name */
                          {
                              2,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"charge_",/* Member name */
                          {
                              3,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"capacity_",/* Member name */
                          {
                              4,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"design_capacity_",/* Member name */
                          {
                              5,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"percentage_",/* Member name */
                          {
                              6,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"power_supply_status_",/* Member name */
                          {
                              7,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"power_supply_health_",/* Member name */
                          {
                              8,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"power_supply_technology_",/* Member name */
                          {
                              9,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"present_",/* Member name */
                          {
                              10,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"cell_voltage_",/* Member name */
                          {
                              11,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"location_",/* Member name */
                          {
                              12,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }, 
                      {
                          (char *)"serial_number_",/* Member name */
                          {
                              13,/* 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 */
                          RTI_CDR_REQUIRED_MEMBER, /* Is a key? */
                          DDS_PUBLIC_MEMBER,/* Member visibility */
                          1,
                          NULL/* Ignored */
                      }
                  };
  
                  static DDS_TypeCode BatteryState__g_tc =
                  {{
                          DDS_TK_STRUCT,/* Kind */
                          DDS_BOOLEAN_FALSE, /* Ignored */
                          -1, /*Ignored*/
                          (char *)"sensor_msgs::msg::dds_::BatteryState_", /* Name */
                          NULL, /* Ignored */      
                          0, /* Ignored */
                          0, /* Ignored */
                          NULL, /* Ignored */
                          14, /* Number of members */
                          BatteryState__g_tc_members, /* Members */
                          DDS_VM_NONE  /* Ignored */         
                      }}; /* Type code for BatteryState_*/
  
                  if (is_initialized) {
                      return &BatteryState__g_tc;
                  }
  
                  BatteryState__g_tc_cell_voltage__sequence._data._typeCode = (RTICdrTypeCode *)&DDS_g_tc_float;
  
                  BatteryState__g_tc_members[0]._representation._typeCode = (RTICdrTypeCode *)std_msgs::msg::dds_::Header__get_typecode();
  
                  BatteryState__g_tc_members[1]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_float;
  
                  BatteryState__g_tc_members[2]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_float;
  
                  BatteryState__g_tc_members[3]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_float;
  
                  BatteryState__g_tc_members[4]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_float;
  
                  BatteryState__g_tc_members[5]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_float;
  
                  BatteryState__g_tc_members[6]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_float;
  
                  BatteryState__g_tc_members[7]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_octet;
  
                  BatteryState__g_tc_members[8]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_octet;
  
                  BatteryState__g_tc_members[9]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_octet;
  
                  BatteryState__g_tc_members[10]._representation._typeCode = (RTICdrTypeCode *)&DDS_g_tc_boolean;
  
                  BatteryState__g_tc_members[11]._representation._typeCode = (RTICdrTypeCode *)& BatteryState__g_tc_cell_voltage__sequence;
                  BatteryState__g_tc_members[12]._representation._typeCode = (RTICdrTypeCode *)&BatteryState__g_tc_location__string;
  
                  BatteryState__g_tc_members[13]._representation._typeCode = (RTICdrTypeCode *)&BatteryState__g_tc_serial_number__string;
  
                  is_initialized = RTI_TRUE;
  
                  return &BatteryState__g_tc;
              }
  
              RTIBool BatteryState__initialize(
                  BatteryState_* sample) {
                  return sensor_msgs::msg::dds_::BatteryState__initialize_ex(sample,RTI_TRUE,RTI_TRUE);
              }
  
              RTIBool BatteryState__initialize_ex(
                  BatteryState_* sample,RTIBool allocatePointers, RTIBool allocateMemory)
              {
  
                  struct DDS_TypeAllocationParams_t allocParams =
                  DDS_TYPE_ALLOCATION_PARAMS_DEFAULT;
  
                  allocParams.allocate_pointers =  (DDS_Boolean)allocatePointers;
                  allocParams.allocate_memory = (DDS_Boolean)allocateMemory;
  
                  return sensor_msgs::msg::dds_::BatteryState__initialize_w_params(
                      sample,&allocParams);
  
              }
  
              RTIBool BatteryState__initialize_w_params(
                  BatteryState_* sample, const struct DDS_TypeAllocationParams_t * allocParams)
              {
  
                  void* buffer = NULL;
                  if (buffer) {} /* To avoid warnings */
  
                  if (sample == NULL) {
                      return RTI_FALSE;
                  }
                  if (allocParams == NULL) {
                      return RTI_FALSE;
                  }
  
                  if (!std_msgs::msg::dds_::Header__initialize_w_params(&sample->header_,
                  allocParams)) {
                      return RTI_FALSE;
                  }
  
                  if (!RTICdrType_initFloat(&sample->voltage_)) {
                      return RTI_FALSE;
                  }
  
                  if (!RTICdrType_initFloat(&sample->current_)) {
                      return RTI_FALSE;
                  }
  
                  if (!RTICdrType_initFloat(&sample->charge_)) {
                      return RTI_FALSE;
                  }
  
                  if (!RTICdrType_initFloat(&sample->capacity_)) {
                      return RTI_FALSE;
                  }
  
                  if (!RTICdrType_initFloat(&sample->design_capacity_)) {
                      return RTI_FALSE;
                  }
  
                  if (!RTICdrType_initFloat(&sample->percentage_)) {
                      return RTI_FALSE;
                  }
  
                  if (!RTICdrType_initOctet(&sample->power_supply_status_)) {
                      return RTI_FALSE;
                  }
  
                  if (!RTICdrType_initOctet(&sample->power_supply_health_)) {
                      return RTI_FALSE;
                  }
  
                  if (!RTICdrType_initOctet(&sample->power_supply_technology_)) {
                      return RTI_FALSE;
                  }
  
                  if (!RTICdrType_initBoolean(&sample->present_)) {
                      return RTI_FALSE;
                  }
  
                  if (allocParams->allocate_memory) {
                      DDS_FloatSeq_initialize(&sample->cell_voltage_  );
                      DDS_FloatSeq_set_absolute_maximum(&sample->cell_voltage_ , RTI_INT32_MAX);
                      if (!DDS_FloatSeq_set_maximum(&sample->cell_voltage_ , (0))) {
                          return RTI_FALSE;
                      }
                  } else { 
                      DDS_FloatSeq_set_length(&sample->cell_voltage_, 0);
                  }
                  if (allocParams->allocate_memory){
                      sample->location_= DDS_String_alloc ((0));
                      if (sample->location_ == NULL) {
                          return RTI_FALSE;
                      }
  
                  } else {
                      if (sample->location_!= NULL) { 
                          sample->location_[0] = '\0';
                      }
                  }
  
                  if (allocParams->allocate_memory){
                      sample->serial_number_= DDS_String_alloc ((0));
                      if (sample->serial_number_ == NULL) {
                          return RTI_FALSE;
                      }
  
                  } else {
                      if (sample->serial_number_!= NULL) { 
                          sample->serial_number_[0] = '\0';
                      }
                  }
  
                  return RTI_TRUE;
              }
  
              void BatteryState__finalize(
                  BatteryState_* sample)
              {
  
                  sensor_msgs::msg::dds_::BatteryState__finalize_ex(sample,RTI_TRUE);
              }
  
              void BatteryState__finalize_ex(
                  BatteryState_* sample,RTIBool deletePointers)
              {
                  struct DDS_TypeDeallocationParams_t deallocParams =
                  DDS_TYPE_DEALLOCATION_PARAMS_DEFAULT;
  
                  if (sample==NULL) {
                      return;
                  } 
  
                  deallocParams.delete_pointers = (DDS_Boolean)deletePointers;
  
                  sensor_msgs::msg::dds_::BatteryState__finalize_w_params(
                      sample,&deallocParams);
              }
  
              void BatteryState__finalize_w_params(
                  BatteryState_* sample,const struct DDS_TypeDeallocationParams_t * deallocParams)
              {
  
                  if (sample==NULL) {
                      return;
                  }
  
                  if (deallocParams == NULL) {
                      return;
                  }
  
                  std_msgs::msg::dds_::Header__finalize_w_params(&sample->header_,deallocParams);
  
                  DDS_FloatSeq_finalize(&sample->cell_voltage_);
  
                  if (sample->location_ != NULL) {
                      DDS_String_free(sample->location_);
                      sample->location_=NULL;
  
                  }
                  if (sample->serial_number_ != NULL) {
                      DDS_String_free(sample->serial_number_);
                      sample->serial_number_=NULL;
  
                  }
              }
  
              void BatteryState__finalize_optional_members(
                  BatteryState_* sample, RTIBool deletePointers)
              {
                  struct DDS_TypeDeallocationParams_t deallocParamsTmp =
                  DDS_TYPE_DEALLOCATION_PARAMS_DEFAULT;
                  struct DDS_TypeDeallocationParams_t * deallocParams =
                  &deallocParamsTmp;
  
                  if (sample==NULL) {
                      return;
                  } 
                  if (deallocParams) {} /* To avoid warnings */
  
                  deallocParamsTmp.delete_pointers = (DDS_Boolean)deletePointers;
                  deallocParamsTmp.delete_optional_members = DDS_BOOLEAN_TRUE;
  
                  std_msgs::msg::dds_::Header__finalize_optional_members(&sample->header_, deallocParams->delete_pointers);
              }
  
              RTIBool BatteryState__copy(
                  BatteryState_* dst,
                  const BatteryState_* src)
              {
                  try {
  
                      if (dst == NULL || src == NULL) {
                          return RTI_FALSE;
                      }
  
                      if (!std_msgs::msg::dds_::Header__copy(
                          &dst->header_,(const std_msgs::msg::dds_::Header_*)&src->header_)) {
                          return RTI_FALSE;
                      } 
                      if (!RTICdrType_copyFloat (
                          &dst->voltage_, &src->voltage_)) { 
                          return RTI_FALSE;
                      }
                      if (!RTICdrType_copyFloat (
                          &dst->current_, &src->current_)) { 
                          return RTI_FALSE;
                      }
                      if (!RTICdrType_copyFloat (
                          &dst->charge_, &src->charge_)) { 
                          return RTI_FALSE;
                      }
                      if (!RTICdrType_copyFloat (
                          &dst->capacity_, &src->capacity_)) { 
                          return RTI_FALSE;
                      }
                      if (!RTICdrType_copyFloat (
                          &dst->design_capacity_, &src->design_capacity_)) { 
                          return RTI_FALSE;
                      }
                      if (!RTICdrType_copyFloat (
                          &dst->percentage_, &src->percentage_)) { 
                          return RTI_FALSE;
                      }
                      if (!RTICdrType_copyOctet (
                          &dst->power_supply_status_, &src->power_supply_status_)) { 
                          return RTI_FALSE;
                      }
                      if (!RTICdrType_copyOctet (
                          &dst->power_supply_health_, &src->power_supply_health_)) { 
                          return RTI_FALSE;
                      }
                      if (!RTICdrType_copyOctet (
                          &dst->power_supply_technology_, &src->power_supply_technology_)) { 
                          return RTI_FALSE;
                      }
                      if (!RTICdrType_copyBoolean (
                          &dst->present_, &src->present_)) { 
                          return RTI_FALSE;
                      }
                      if (!DDS_FloatSeq_copy(&dst->cell_voltage_ ,
                      &src->cell_voltage_ )) {
                          return RTI_FALSE;
                      }
                      if (!RTICdrType_copyStringEx (
                          &dst->location_, src->location_, 
                          (RTI_INT32_MAX-1) + 1,RTI_TRUE)){
                          return RTI_FALSE;
                      }
                      if (!RTICdrType_copyStringEx (
                          &dst->serial_number_, src->serial_number_, 
                          (RTI_INT32_MAX-1) + 1,RTI_TRUE)){
                          return RTI_FALSE;
                      }
  
                      return RTI_TRUE;
  
                  } catch (std::bad_alloc&) {
                      return RTI_FALSE;
                  }
              }
  
              /**
              * <<IMPLEMENTATION>>
              *
              * Defines:  TSeq, T
              *
              * Configure and implement 'BatteryState_' sequence class.
              */
              #define T BatteryState_
              #define TSeq BatteryState_Seq
  
              #define T_initialize_w_params sensor_msgs::msg::dds_::BatteryState__initialize_w_params
  
              #define T_finalize_w_params   sensor_msgs::msg::dds_::BatteryState__finalize_w_params
              #define T_copy       sensor_msgs::msg::dds_::BatteryState__copy
  
              #ifndef NDDS_STANDALONE_TYPE
              #include "dds_c/generic/dds_c_sequence_TSeq.gen"
              #include "dds_cpp/generic/dds_cpp_sequence_TSeq.gen"
              #else
              #include "dds_c_sequence_TSeq.gen"
              #include "dds_cpp_sequence_TSeq.gen"
              #endif
  
              #undef T_copy
              #undef T_finalize_w_params
  
              #undef T_initialize_w_params
  
              #undef TSeq
              #undef T
          } /* namespace dds_  */
      } /* namespace msg  */
  } /* namespace sensor_msgs  */
  
  