// Auto-generated. Do not edit!

// (in-package colorimetry_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 ColorimetryResult {
  constructor(initObj={}) {
    if (initObj === null) {
      // initObj === null is a special case for deserialization where we don't initialize fields
      this.result_file_name = null;
      this.red = null;
      this.green = null;
      this.blue = null;
    }
    else {
      if (initObj.hasOwnProperty('result_file_name')) {
        this.result_file_name = initObj.result_file_name
      }
      else {
        this.result_file_name = '';
      }
      if (initObj.hasOwnProperty('red')) {
        this.red = initObj.red
      }
      else {
        this.red = 0;
      }
      if (initObj.hasOwnProperty('green')) {
        this.green = initObj.green
      }
      else {
        this.green = 0;
      }
      if (initObj.hasOwnProperty('blue')) {
        this.blue = initObj.blue
      }
      else {
        this.blue = 0;
      }
    }
  }

  static serialize(obj, buffer, bufferOffset) {
    // Serializes a message object of type ColorimetryResult
    // Serialize message field [result_file_name]
    bufferOffset = _serializer.string(obj.result_file_name, buffer, bufferOffset);
    // Serialize message field [red]
    bufferOffset = _serializer.uint32(obj.red, buffer, bufferOffset);
    // Serialize message field [green]
    bufferOffset = _serializer.uint32(obj.green, buffer, bufferOffset);
    // Serialize message field [blue]
    bufferOffset = _serializer.uint32(obj.blue, buffer, bufferOffset);
    return bufferOffset;
  }

  static deserialize(buffer, bufferOffset=[0]) {
    //deserializes a message object of type ColorimetryResult
    let len;
    let data = new ColorimetryResult(null);
    // Deserialize message field [result_file_name]
    data.result_file_name = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [red]
    data.red = _deserializer.uint32(buffer, bufferOffset);
    // Deserialize message field [green]
    data.green = _deserializer.uint32(buffer, bufferOffset);
    // Deserialize message field [blue]
    data.blue = _deserializer.uint32(buffer, bufferOffset);
    return data;
  }

  static getMessageSize(object) {
    let length = 0;
    length += _getByteLength(object.result_file_name);
    return length + 16;
  }

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

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

  static messageDefinition() {
    // Returns full string definition for message
    return `
    string result_file_name
    uint32 red
    uint32 green
    uint32 blue
    `;
  }

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

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

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

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

    return resolved;
    }
};

module.exports = ColorimetryResult;
