// Auto-generated. Do not edit!

// (in-package mettler_toledo_quantos_q2_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 QuantosSample {
  constructor(initObj={}) {
    if (initObj === null) {
      // initObj === null is a special case for deserialization where we don't initialize fields
      this.Substance = null;
      this.LotID = null;
      this.UserID = null;
      this.FillingDate = null;
      this.ExpiryDate = null;
      this.RetestDate = null;
      this.mgFillWeight = null;
      this.RemainingDoses = null;
      this.TerminalSNR = null;
      this.BridgeSNR = null;
      this.BalanceType = null;
      this.BalanceID = null;
      this.LastCalibration = null;
      this.OptionSNR = null;
      this.DoseUnitSNR = null;
      this.ApplicationName = null;
      this.DateTime = null;
      this.LevelControl = null;
      this.ProductionDateHead = null;
      this.HeadType = null;
      this.DoseHeadLimit = null;
      this.DosesDoneHead = null;
      this.mgRemainingPowderHead = null;
    }
    else {
      if (initObj.hasOwnProperty('Substance')) {
        this.Substance = initObj.Substance
      }
      else {
        this.Substance = '';
      }
      if (initObj.hasOwnProperty('LotID')) {
        this.LotID = initObj.LotID
      }
      else {
        this.LotID = '';
      }
      if (initObj.hasOwnProperty('UserID')) {
        this.UserID = initObj.UserID
      }
      else {
        this.UserID = '';
      }
      if (initObj.hasOwnProperty('FillingDate')) {
        this.FillingDate = initObj.FillingDate
      }
      else {
        this.FillingDate = '';
      }
      if (initObj.hasOwnProperty('ExpiryDate')) {
        this.ExpiryDate = initObj.ExpiryDate
      }
      else {
        this.ExpiryDate = '';
      }
      if (initObj.hasOwnProperty('RetestDate')) {
        this.RetestDate = initObj.RetestDate
      }
      else {
        this.RetestDate = '';
      }
      if (initObj.hasOwnProperty('mgFillWeight')) {
        this.mgFillWeight = initObj.mgFillWeight
      }
      else {
        this.mgFillWeight = '';
      }
      if (initObj.hasOwnProperty('RemainingDoses')) {
        this.RemainingDoses = initObj.RemainingDoses
      }
      else {
        this.RemainingDoses = '';
      }
      if (initObj.hasOwnProperty('TerminalSNR')) {
        this.TerminalSNR = initObj.TerminalSNR
      }
      else {
        this.TerminalSNR = '';
      }
      if (initObj.hasOwnProperty('BridgeSNR')) {
        this.BridgeSNR = initObj.BridgeSNR
      }
      else {
        this.BridgeSNR = '';
      }
      if (initObj.hasOwnProperty('BalanceType')) {
        this.BalanceType = initObj.BalanceType
      }
      else {
        this.BalanceType = '';
      }
      if (initObj.hasOwnProperty('BalanceID')) {
        this.BalanceID = initObj.BalanceID
      }
      else {
        this.BalanceID = '';
      }
      if (initObj.hasOwnProperty('LastCalibration')) {
        this.LastCalibration = initObj.LastCalibration
      }
      else {
        this.LastCalibration = '';
      }
      if (initObj.hasOwnProperty('OptionSNR')) {
        this.OptionSNR = initObj.OptionSNR
      }
      else {
        this.OptionSNR = '';
      }
      if (initObj.hasOwnProperty('DoseUnitSNR')) {
        this.DoseUnitSNR = initObj.DoseUnitSNR
      }
      else {
        this.DoseUnitSNR = '';
      }
      if (initObj.hasOwnProperty('ApplicationName')) {
        this.ApplicationName = initObj.ApplicationName
      }
      else {
        this.ApplicationName = '';
      }
      if (initObj.hasOwnProperty('DateTime')) {
        this.DateTime = initObj.DateTime
      }
      else {
        this.DateTime = '';
      }
      if (initObj.hasOwnProperty('LevelControl')) {
        this.LevelControl = initObj.LevelControl
      }
      else {
        this.LevelControl = '';
      }
      if (initObj.hasOwnProperty('ProductionDateHead')) {
        this.ProductionDateHead = initObj.ProductionDateHead
      }
      else {
        this.ProductionDateHead = '';
      }
      if (initObj.hasOwnProperty('HeadType')) {
        this.HeadType = initObj.HeadType
      }
      else {
        this.HeadType = '';
      }
      if (initObj.hasOwnProperty('DoseHeadLimit')) {
        this.DoseHeadLimit = initObj.DoseHeadLimit
      }
      else {
        this.DoseHeadLimit = '';
      }
      if (initObj.hasOwnProperty('DosesDoneHead')) {
        this.DosesDoneHead = initObj.DosesDoneHead
      }
      else {
        this.DosesDoneHead = '';
      }
      if (initObj.hasOwnProperty('mgRemainingPowderHead')) {
        this.mgRemainingPowderHead = initObj.mgRemainingPowderHead
      }
      else {
        this.mgRemainingPowderHead = '';
      }
    }
  }

  static serialize(obj, buffer, bufferOffset) {
    // Serializes a message object of type QuantosSample
    // Serialize message field [Substance]
    bufferOffset = _serializer.string(obj.Substance, buffer, bufferOffset);
    // Serialize message field [LotID]
    bufferOffset = _serializer.string(obj.LotID, buffer, bufferOffset);
    // Serialize message field [UserID]
    bufferOffset = _serializer.string(obj.UserID, buffer, bufferOffset);
    // Serialize message field [FillingDate]
    bufferOffset = _serializer.string(obj.FillingDate, buffer, bufferOffset);
    // Serialize message field [ExpiryDate]
    bufferOffset = _serializer.string(obj.ExpiryDate, buffer, bufferOffset);
    // Serialize message field [RetestDate]
    bufferOffset = _serializer.string(obj.RetestDate, buffer, bufferOffset);
    // Serialize message field [mgFillWeight]
    bufferOffset = _serializer.string(obj.mgFillWeight, buffer, bufferOffset);
    // Serialize message field [RemainingDoses]
    bufferOffset = _serializer.string(obj.RemainingDoses, buffer, bufferOffset);
    // Serialize message field [TerminalSNR]
    bufferOffset = _serializer.string(obj.TerminalSNR, buffer, bufferOffset);
    // Serialize message field [BridgeSNR]
    bufferOffset = _serializer.string(obj.BridgeSNR, buffer, bufferOffset);
    // Serialize message field [BalanceType]
    bufferOffset = _serializer.string(obj.BalanceType, buffer, bufferOffset);
    // Serialize message field [BalanceID]
    bufferOffset = _serializer.string(obj.BalanceID, buffer, bufferOffset);
    // Serialize message field [LastCalibration]
    bufferOffset = _serializer.string(obj.LastCalibration, buffer, bufferOffset);
    // Serialize message field [OptionSNR]
    bufferOffset = _serializer.string(obj.OptionSNR, buffer, bufferOffset);
    // Serialize message field [DoseUnitSNR]
    bufferOffset = _serializer.string(obj.DoseUnitSNR, buffer, bufferOffset);
    // Serialize message field [ApplicationName]
    bufferOffset = _serializer.string(obj.ApplicationName, buffer, bufferOffset);
    // Serialize message field [DateTime]
    bufferOffset = _serializer.string(obj.DateTime, buffer, bufferOffset);
    // Serialize message field [LevelControl]
    bufferOffset = _serializer.string(obj.LevelControl, buffer, bufferOffset);
    // Serialize message field [ProductionDateHead]
    bufferOffset = _serializer.string(obj.ProductionDateHead, buffer, bufferOffset);
    // Serialize message field [HeadType]
    bufferOffset = _serializer.string(obj.HeadType, buffer, bufferOffset);
    // Serialize message field [DoseHeadLimit]
    bufferOffset = _serializer.string(obj.DoseHeadLimit, buffer, bufferOffset);
    // Serialize message field [DosesDoneHead]
    bufferOffset = _serializer.string(obj.DosesDoneHead, buffer, bufferOffset);
    // Serialize message field [mgRemainingPowderHead]
    bufferOffset = _serializer.string(obj.mgRemainingPowderHead, buffer, bufferOffset);
    return bufferOffset;
  }

  static deserialize(buffer, bufferOffset=[0]) {
    //deserializes a message object of type QuantosSample
    let len;
    let data = new QuantosSample(null);
    // Deserialize message field [Substance]
    data.Substance = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [LotID]
    data.LotID = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [UserID]
    data.UserID = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [FillingDate]
    data.FillingDate = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [ExpiryDate]
    data.ExpiryDate = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [RetestDate]
    data.RetestDate = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [mgFillWeight]
    data.mgFillWeight = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [RemainingDoses]
    data.RemainingDoses = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [TerminalSNR]
    data.TerminalSNR = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [BridgeSNR]
    data.BridgeSNR = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [BalanceType]
    data.BalanceType = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [BalanceID]
    data.BalanceID = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [LastCalibration]
    data.LastCalibration = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [OptionSNR]
    data.OptionSNR = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [DoseUnitSNR]
    data.DoseUnitSNR = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [ApplicationName]
    data.ApplicationName = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [DateTime]
    data.DateTime = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [LevelControl]
    data.LevelControl = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [ProductionDateHead]
    data.ProductionDateHead = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [HeadType]
    data.HeadType = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [DoseHeadLimit]
    data.DoseHeadLimit = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [DosesDoneHead]
    data.DosesDoneHead = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [mgRemainingPowderHead]
    data.mgRemainingPowderHead = _deserializer.string(buffer, bufferOffset);
    return data;
  }

  static getMessageSize(object) {
    let length = 0;
    length += _getByteLength(object.Substance);
    length += _getByteLength(object.LotID);
    length += _getByteLength(object.UserID);
    length += _getByteLength(object.FillingDate);
    length += _getByteLength(object.ExpiryDate);
    length += _getByteLength(object.RetestDate);
    length += _getByteLength(object.mgFillWeight);
    length += _getByteLength(object.RemainingDoses);
    length += _getByteLength(object.TerminalSNR);
    length += _getByteLength(object.BridgeSNR);
    length += _getByteLength(object.BalanceType);
    length += _getByteLength(object.BalanceID);
    length += _getByteLength(object.LastCalibration);
    length += _getByteLength(object.OptionSNR);
    length += _getByteLength(object.DoseUnitSNR);
    length += _getByteLength(object.ApplicationName);
    length += _getByteLength(object.DateTime);
    length += _getByteLength(object.LevelControl);
    length += _getByteLength(object.ProductionDateHead);
    length += _getByteLength(object.HeadType);
    length += _getByteLength(object.DoseHeadLimit);
    length += _getByteLength(object.DosesDoneHead);
    length += _getByteLength(object.mgRemainingPowderHead);
    return length + 92;
  }

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

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

  static messageDefinition() {
    // Returns full string definition for message
    return `
    string Substance
    string LotID
    string UserID
    string FillingDate
    string ExpiryDate
    string RetestDate
    string mgFillWeight
    string RemainingDoses
    string TerminalSNR
    string BridgeSNR
    string BalanceType
    string BalanceID
    string LastCalibration
    string OptionSNR
    string DoseUnitSNR
    string ApplicationName
    string DateTime
    string LevelControl
    string ProductionDateHead
    string HeadType
    string DoseHeadLimit
    string DosesDoneHead
    string mgRemainingPowderHead
    
    `;
  }

  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 QuantosSample(null);
    if (msg.Substance !== undefined) {
      resolved.Substance = msg.Substance;
    }
    else {
      resolved.Substance = ''
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    return resolved;
    }
};

module.exports = QuantosSample;
