// Auto-generated. Do not edit!

// (in-package ros_merge_test.msg)


"use strict";

const _serializer = _ros_msg_utils.Serialize;
const _arraySerializer = _serializer.Array;
const _deserializer = _ros_msg_utils.Deserialize;
const _arrayDeserializer = _deserializer.Array;
const _finder = _ros_msg_utils.Find;
const _getByteLength = _ros_msg_utils.getByteLength;
let dis_info = require('./dis_info.js');

//-----------------------------------------------------------

class dis_info_array {
  constructor(initObj={}) {
    if (initObj === null) {
      // initObj === null is a special case for deserialization where we don't initialize fields
      this.dis = null;
    }
    else {
      if (initObj.hasOwnProperty('dis')) {
        this.dis = initObj.dis
      }
      else {
        this.dis = [];
      }
    }
  }

  static serialize(obj, buffer, bufferOffset) {
    // Serializes a message object of type dis_info_array
    // Serialize message field [dis]
    // Serialize the length for message field [dis]
    bufferOffset = _serializer.uint32(obj.dis.length, buffer, bufferOffset);
    obj.dis.forEach((val) => {
      bufferOffset = dis_info.serialize(val, buffer, bufferOffset);
    });
    return bufferOffset;
  }

  static deserialize(buffer, bufferOffset=[0]) {
    //deserializes a message object of type dis_info_array
    let len;
    let data = new dis_info_array(null);
    // Deserialize message field [dis]
    // Deserialize array length for message field [dis]
    len = _deserializer.uint32(buffer, bufferOffset);
    data.dis = new Array(len);
    for (let i = 0; i < len; ++i) {
      data.dis[i] = dis_info.deserialize(buffer, bufferOffset)
    }
    return data;
  }

  static getMessageSize(object) {
    let length = 0;
    length += 16 * object.dis.length;
    return length + 4;
  }

  static datatype() {
    // Returns string type for a message object
    return 'ros_merge_test/dis_info_array';
  }

  static md5sum() {
    //Returns md5sum for a message object
    return '154c19253095a5ca966c5dce84293342';
  }

  static messageDefinition() {
    // Returns full string definition for message
    return `
    ros_merge_test/dis_info[] dis
    ================================================================================
    MSG: ros_merge_test/dis_info
    float32 distance
    float32 width
    float32 height
    float32 angle
    
    `;
  }

  static Resolve(msg) {
    // deep-construct a valid message object instance of whatever was passed in
    if (typeof msg !== 'object' || msg === null) {
      msg = {};
    }
    const resolved = new dis_info_array(null);
    if (msg.dis !== undefined) {
      resolved.dis = new Array(msg.dis.length);
      for (let i = 0; i < resolved.dis.length; ++i) {
        resolved.dis[i] = dis_info.Resolve(msg.dis[i]);
      }
    }
    else {
      resolved.dis = []
    }

    return resolved;
    }
};

module.exports = dis_info_array;
