# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from cpp_observer/ViconPosition.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct

import std_msgs.msg

class ViconPosition(genpy.Message):
  _md5sum = "ea4dd0ef64adcd7c57a97c8704a08f71"
  _type = "cpp_observer/ViconPosition"
  _has_header = False #flag to mark the presence of a Header object
  _full_text = """string Name
std_msgs/Int32 X
std_msgs/Int32 Y
std_msgs/Int32 A
std_msgs/Int32 worksite1Id
std_msgs/Int32 worksite1X
std_msgs/Int32 worksite1Y
std_msgs/Int32 resourcePortionId
std_msgs/Int32 resourceReceived
std_msgs/Int32 resourceLeft
std_msgs/Int32 globalTime

================================================================================
MSG: std_msgs/Int32
int32 data"""
  __slots__ = ['Name','X','Y','A','worksite1Id','worksite1X','worksite1Y','resourcePortionId','resourceReceived','resourceLeft','globalTime']
  _slot_types = ['string','std_msgs/Int32','std_msgs/Int32','std_msgs/Int32','std_msgs/Int32','std_msgs/Int32','std_msgs/Int32','std_msgs/Int32','std_msgs/Int32','std_msgs/Int32','std_msgs/Int32']

  def __init__(self, *args, **kwds):
    """
    Constructor. Any message fields that are implicitly/explicitly
    set to None will be assigned a default value. The recommend
    use is keyword arguments as this is more robust to future message
    changes.  You cannot mix in-order arguments and keyword arguments.

    The available fields are:
       Name,X,Y,A,worksite1Id,worksite1X,worksite1Y,resourcePortionId,resourceReceived,resourceLeft,globalTime

    :param args: complete set of field values, in .msg order
    :param kwds: use keyword arguments corresponding to message field names
    to set specific fields.
    """
    if args or kwds:
      super(ViconPosition, self).__init__(*args, **kwds)
      #message fields cannot be None, assign default values for those that are
      if self.Name is None:
        self.Name = ''
      if self.X is None:
        self.X = std_msgs.msg.Int32()
      if self.Y is None:
        self.Y = std_msgs.msg.Int32()
      if self.A is None:
        self.A = std_msgs.msg.Int32()
      if self.worksite1Id is None:
        self.worksite1Id = std_msgs.msg.Int32()
      if self.worksite1X is None:
        self.worksite1X = std_msgs.msg.Int32()
      if self.worksite1Y is None:
        self.worksite1Y = std_msgs.msg.Int32()
      if self.resourcePortionId is None:
        self.resourcePortionId = std_msgs.msg.Int32()
      if self.resourceReceived is None:
        self.resourceReceived = std_msgs.msg.Int32()
      if self.resourceLeft is None:
        self.resourceLeft = std_msgs.msg.Int32()
      if self.globalTime is None:
        self.globalTime = std_msgs.msg.Int32()
    else:
      self.Name = ''
      self.X = std_msgs.msg.Int32()
      self.Y = std_msgs.msg.Int32()
      self.A = std_msgs.msg.Int32()
      self.worksite1Id = std_msgs.msg.Int32()
      self.worksite1X = std_msgs.msg.Int32()
      self.worksite1Y = std_msgs.msg.Int32()
      self.resourcePortionId = std_msgs.msg.Int32()
      self.resourceReceived = std_msgs.msg.Int32()
      self.resourceLeft = std_msgs.msg.Int32()
      self.globalTime = std_msgs.msg.Int32()

  def _get_types(self):
    """
    internal API method
    """
    return self._slot_types

  def serialize(self, buff):
    """
    serialize message into buffer
    :param buff: buffer, ``StringIO``
    """
    try:
      _x = self.Name
      length = len(_x)
      if python3 or type(_x) == unicode:
        _x = _x.encode('utf-8')
        length = len(_x)
      buff.write(struct.pack('<I%ss'%length, length, _x))
      _x = self
      buff.write(_get_struct_10i().pack(_x.X.data, _x.Y.data, _x.A.data, _x.worksite1Id.data, _x.worksite1X.data, _x.worksite1Y.data, _x.resourcePortionId.data, _x.resourceReceived.data, _x.resourceLeft.data, _x.globalTime.data))
    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))

  def deserialize(self, str):
    """
    unpack serialized message in str into this message instance
    :param str: byte array of serialized message, ``str``
    """
    try:
      if self.X is None:
        self.X = std_msgs.msg.Int32()
      if self.Y is None:
        self.Y = std_msgs.msg.Int32()
      if self.A is None:
        self.A = std_msgs.msg.Int32()
      if self.worksite1Id is None:
        self.worksite1Id = std_msgs.msg.Int32()
      if self.worksite1X is None:
        self.worksite1X = std_msgs.msg.Int32()
      if self.worksite1Y is None:
        self.worksite1Y = std_msgs.msg.Int32()
      if self.resourcePortionId is None:
        self.resourcePortionId = std_msgs.msg.Int32()
      if self.resourceReceived is None:
        self.resourceReceived = std_msgs.msg.Int32()
      if self.resourceLeft is None:
        self.resourceLeft = std_msgs.msg.Int32()
      if self.globalTime is None:
        self.globalTime = std_msgs.msg.Int32()
      end = 0
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.Name = str[start:end].decode('utf-8')
      else:
        self.Name = str[start:end]
      _x = self
      start = end
      end += 40
      (_x.X.data, _x.Y.data, _x.A.data, _x.worksite1Id.data, _x.worksite1X.data, _x.worksite1Y.data, _x.resourcePortionId.data, _x.resourceReceived.data, _x.resourceLeft.data, _x.globalTime.data,) = _get_struct_10i().unpack(str[start:end])
      return self
    except struct.error as e:
      raise genpy.DeserializationError(e) #most likely buffer underfill


  def serialize_numpy(self, buff, numpy):
    """
    serialize message with numpy array types into buffer
    :param buff: buffer, ``StringIO``
    :param numpy: numpy python module
    """
    try:
      _x = self.Name
      length = len(_x)
      if python3 or type(_x) == unicode:
        _x = _x.encode('utf-8')
        length = len(_x)
      buff.write(struct.pack('<I%ss'%length, length, _x))
      _x = self
      buff.write(_get_struct_10i().pack(_x.X.data, _x.Y.data, _x.A.data, _x.worksite1Id.data, _x.worksite1X.data, _x.worksite1Y.data, _x.resourcePortionId.data, _x.resourceReceived.data, _x.resourceLeft.data, _x.globalTime.data))
    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))

  def deserialize_numpy(self, str, numpy):
    """
    unpack serialized message in str into this message instance using numpy for array types
    :param str: byte array of serialized message, ``str``
    :param numpy: numpy python module
    """
    try:
      if self.X is None:
        self.X = std_msgs.msg.Int32()
      if self.Y is None:
        self.Y = std_msgs.msg.Int32()
      if self.A is None:
        self.A = std_msgs.msg.Int32()
      if self.worksite1Id is None:
        self.worksite1Id = std_msgs.msg.Int32()
      if self.worksite1X is None:
        self.worksite1X = std_msgs.msg.Int32()
      if self.worksite1Y is None:
        self.worksite1Y = std_msgs.msg.Int32()
      if self.resourcePortionId is None:
        self.resourcePortionId = std_msgs.msg.Int32()
      if self.resourceReceived is None:
        self.resourceReceived = std_msgs.msg.Int32()
      if self.resourceLeft is None:
        self.resourceLeft = std_msgs.msg.Int32()
      if self.globalTime is None:
        self.globalTime = std_msgs.msg.Int32()
      end = 0
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.Name = str[start:end].decode('utf-8')
      else:
        self.Name = str[start:end]
      _x = self
      start = end
      end += 40
      (_x.X.data, _x.Y.data, _x.A.data, _x.worksite1Id.data, _x.worksite1X.data, _x.worksite1Y.data, _x.resourcePortionId.data, _x.resourceReceived.data, _x.resourceLeft.data, _x.globalTime.data,) = _get_struct_10i().unpack(str[start:end])
      return self
    except struct.error as e:
      raise genpy.DeserializationError(e) #most likely buffer underfill

_struct_I = genpy.struct_I
def _get_struct_I():
    global _struct_I
    return _struct_I
_struct_10i = None
def _get_struct_10i():
    global _struct_10i
    if _struct_10i is None:
        _struct_10i = struct.Struct("<10i")
    return _struct_10i
