// Auto-generated. Do not edit!

// (in-package detect_targets.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;

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

class component_center {
  constructor(initObj={}) {
    if (initObj === null) {
      // initObj === null is a special case for deserialization where we don't initialize fields
      this.label = null;
      this.nb_vertex = null;
      this.x = null;
      this.y = null;
    }
    else {
      if (initObj.hasOwnProperty('label')) {
        this.label = initObj.label
      }
      else {
        this.label = 0;
      }
      if (initObj.hasOwnProperty('nb_vertex')) {
        this.nb_vertex = initObj.nb_vertex
      }
      else {
        this.nb_vertex = 0;
      }
      if (initObj.hasOwnProperty('x')) {
        this.x = initObj.x
      }
      else {
        this.x = 0.0;
      }
      if (initObj.hasOwnProperty('y')) {
        this.y = initObj.y
      }
      else {
        this.y = 0.0;
      }
    }
  }

  static serialize(obj, buffer, bufferOffset) {
    // Serializes a message object of type component_center
    // Serialize message field [label]
    bufferOffset = _serializer.int64(obj.label, buffer, bufferOffset);
    // Serialize message field [nb_vertex]
    bufferOffset = _serializer.int64(obj.nb_vertex, buffer, bufferOffset);
    // Serialize message field [x]
    bufferOffset = _serializer.float64(obj.x, buffer, bufferOffset);
    // Serialize message field [y]
    bufferOffset = _serializer.float64(obj.y, buffer, bufferOffset);
    return bufferOffset;
  }

  static deserialize(buffer, bufferOffset=[0]) {
    //deserializes a message object of type component_center
    let len;
    let data = new component_center(null);
    // Deserialize message field [label]
    data.label = _deserializer.int64(buffer, bufferOffset);
    // Deserialize message field [nb_vertex]
    data.nb_vertex = _deserializer.int64(buffer, bufferOffset);
    // Deserialize message field [x]
    data.x = _deserializer.float64(buffer, bufferOffset);
    // Deserialize message field [y]
    data.y = _deserializer.float64(buffer, bufferOffset);
    return data;
  }

  static getMessageSize(object) {
    return 32;
  }

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

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

  static messageDefinition() {
    // Returns full string definition for message
    return `
    int64   label
    int64   nb_vertex
    float64 x
    float64 y
    
    `;
  }

  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 component_center(null);
    if (msg.label !== undefined) {
      resolved.label = msg.label;
    }
    else {
      resolved.label = 0
    }

    if (msg.nb_vertex !== undefined) {
      resolved.nb_vertex = msg.nb_vertex;
    }
    else {
      resolved.nb_vertex = 0
    }

    if (msg.x !== undefined) {
      resolved.x = msg.x;
    }
    else {
      resolved.x = 0.0
    }

    if (msg.y !== undefined) {
      resolved.y = msg.y;
    }
    else {
      resolved.y = 0.0
    }

    return resolved;
    }
};

module.exports = component_center;
