// Auto-generated. Do not edit!

// (in-package kmriiwa_chemist_msgs.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 LBRCommand {
  constructor(initObj={}) {
    if (initObj === null) {
      // initObj === null is a special case for deserialization where we don't initialize fields
      this.cmd_seq = null;
      this.priority_task = null;
      this.task_name = null;
      this.task_parameters = null;
    }
    else {
      if (initObj.hasOwnProperty('cmd_seq')) {
        this.cmd_seq = initObj.cmd_seq
      }
      else {
        this.cmd_seq = 0;
      }
      if (initObj.hasOwnProperty('priority_task')) {
        this.priority_task = initObj.priority_task
      }
      else {
        this.priority_task = false;
      }
      if (initObj.hasOwnProperty('task_name')) {
        this.task_name = initObj.task_name
      }
      else {
        this.task_name = '';
      }
      if (initObj.hasOwnProperty('task_parameters')) {
        this.task_parameters = initObj.task_parameters
      }
      else {
        this.task_parameters = [];
      }
    }
  }

  static serialize(obj, buffer, bufferOffset) {
    // Serializes a message object of type LBRCommand
    // Serialize message field [cmd_seq]
    bufferOffset = _serializer.int32(obj.cmd_seq, buffer, bufferOffset);
    // Serialize message field [priority_task]
    bufferOffset = _serializer.bool(obj.priority_task, buffer, bufferOffset);
    // Serialize message field [task_name]
    bufferOffset = _serializer.string(obj.task_name, buffer, bufferOffset);
    // Serialize message field [task_parameters]
    bufferOffset = _arraySerializer.string(obj.task_parameters, buffer, bufferOffset, null);
    return bufferOffset;
  }

  static deserialize(buffer, bufferOffset=[0]) {
    //deserializes a message object of type LBRCommand
    let len;
    let data = new LBRCommand(null);
    // Deserialize message field [cmd_seq]
    data.cmd_seq = _deserializer.int32(buffer, bufferOffset);
    // Deserialize message field [priority_task]
    data.priority_task = _deserializer.bool(buffer, bufferOffset);
    // Deserialize message field [task_name]
    data.task_name = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [task_parameters]
    data.task_parameters = _arrayDeserializer.string(buffer, bufferOffset, null)
    return data;
  }

  static getMessageSize(object) {
    let length = 0;
    length += _getByteLength(object.task_name);
    object.task_parameters.forEach((val) => {
      length += 4 + _getByteLength(val);
    });
    return length + 13;
  }

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

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

  static messageDefinition() {
    // Returns full string definition for message
    return `
    int32 cmd_seq
    bool priority_task
    string task_name
    string[] task_parameters
    
    `;
  }

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

    if (msg.priority_task !== undefined) {
      resolved.priority_task = msg.priority_task;
    }
    else {
      resolved.priority_task = false
    }

    if (msg.task_name !== undefined) {
      resolved.task_name = msg.task_name;
    }
    else {
      resolved.task_name = ''
    }

    if (msg.task_parameters !== undefined) {
      resolved.task_parameters = msg.task_parameters;
    }
    else {
      resolved.task_parameters = []
    }

    return resolved;
    }
};

module.exports = LBRCommand;
