"""autogenerated by genpy from test_rospy/TransitiveImport.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct

import test_rospy.msg
import std_msgs.msg

class TransitiveImport(genpy.Message):
  _md5sum = "27665539bacd6d2d02a7538692d3d3d0"
  _type = "test_rospy/TransitiveImport"
  _has_header = False #flag to mark the presence of a Header object
  _full_text = """# Bug #2133/2139: EmbedTest uses std_msgs, so TransitiveImport needs it as well
EmbedTest data
================================================================================
MSG: test_rospy/EmbedTest
std_msgs/String str1
std_msgs/Int32 int1
std_msgs/Int32[] ints
Val val
Val[] vals
ArrayVal[] arrayval

================================================================================
MSG: std_msgs/String
string data

================================================================================
MSG: std_msgs/Int32
int32 data
================================================================================
MSG: test_rospy/Val
string val
================================================================================
MSG: test_rospy/ArrayVal
Val[] vals
#Val[10] vals_fixed

"""
  __slots__ = ['data']
  _slot_types = ['test_rospy/EmbedTest']

  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:
       data

    :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(TransitiveImport, self).__init__(*args, **kwds)
      #message fields cannot be None, assign default values for those that are
      if self.data is None:
        self.data = test_rospy.msg.EmbedTest()
    else:
      self.data = test_rospy.msg.EmbedTest()

  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.data.str1.data
      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))
      buff.write(_struct_i.pack(self.data.int1.data))
      length = len(self.data.ints)
      buff.write(_struct_I.pack(length))
      for val1 in self.data.ints:
        buff.write(_struct_i.pack(val1.data))
      _x = self.data.val.val
      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))
      length = len(self.data.vals)
      buff.write(_struct_I.pack(length))
      for val1 in self.data.vals:
        _x = val1.val
        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))
      length = len(self.data.arrayval)
      buff.write(_struct_I.pack(length))
      for val1 in self.data.arrayval:
        length = len(val1.vals)
        buff.write(_struct_I.pack(length))
        for val2 in val1.vals:
          _x = val2.val
          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))
    except struct.error as se: self._check_types(se)
    except TypeError as te: self._check_types(te)

  def deserialize(self, str):
    """
    unpack serialized message in str into this message instance
    :param str: byte array of serialized message, ``str``
    """
    try:
      if self.data is None:
        self.data = test_rospy.msg.EmbedTest()
      end = 0
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.data.str1.data = str[start:end].decode('utf-8')
      else:
        self.data.str1.data = str[start:end]
      start = end
      end += 4
      (self.data.int1.data,) = _struct_i.unpack(str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.data.ints = []
      for i in range(0, length):
        val1 = std_msgs.msg.Int32()
        start = end
        end += 4
        (val1.data,) = _struct_i.unpack(str[start:end])
        self.data.ints.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.data.val.val = str[start:end].decode('utf-8')
      else:
        self.data.val.val = str[start:end]
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.data.vals = []
      for i in range(0, length):
        val1 = test_rospy.msg.Val()
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          val1.val = str[start:end].decode('utf-8')
        else:
          val1.val = str[start:end]
        self.data.vals.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.data.arrayval = []
      for i in range(0, length):
        val1 = test_rospy.msg.ArrayVal()
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.vals = []
        for i in range(0, length):
          val2 = test_rospy.msg.Val()
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          start = end
          end += length
          if python3:
            val2.val = str[start:end].decode('utf-8')
          else:
            val2.val = str[start:end]
          val1.vals.append(val2)
        self.data.arrayval.append(val1)
      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.data.str1.data
      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))
      buff.write(_struct_i.pack(self.data.int1.data))
      length = len(self.data.ints)
      buff.write(_struct_I.pack(length))
      for val1 in self.data.ints:
        buff.write(_struct_i.pack(val1.data))
      _x = self.data.val.val
      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))
      length = len(self.data.vals)
      buff.write(_struct_I.pack(length))
      for val1 in self.data.vals:
        _x = val1.val
        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))
      length = len(self.data.arrayval)
      buff.write(_struct_I.pack(length))
      for val1 in self.data.arrayval:
        length = len(val1.vals)
        buff.write(_struct_I.pack(length))
        for val2 in val1.vals:
          _x = val2.val
          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))
    except struct.error as se: self._check_types(se)
    except TypeError as te: self._check_types(te)

  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.data is None:
        self.data = test_rospy.msg.EmbedTest()
      end = 0
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.data.str1.data = str[start:end].decode('utf-8')
      else:
        self.data.str1.data = str[start:end]
      start = end
      end += 4
      (self.data.int1.data,) = _struct_i.unpack(str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.data.ints = []
      for i in range(0, length):
        val1 = std_msgs.msg.Int32()
        start = end
        end += 4
        (val1.data,) = _struct_i.unpack(str[start:end])
        self.data.ints.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.data.val.val = str[start:end].decode('utf-8')
      else:
        self.data.val.val = str[start:end]
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.data.vals = []
      for i in range(0, length):
        val1 = test_rospy.msg.Val()
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          val1.val = str[start:end].decode('utf-8')
        else:
          val1.val = str[start:end]
        self.data.vals.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.data.arrayval = []
      for i in range(0, length):
        val1 = test_rospy.msg.ArrayVal()
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.vals = []
        for i in range(0, length):
          val2 = test_rospy.msg.Val()
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          start = end
          end += length
          if python3:
            val2.val = str[start:end].decode('utf-8')
          else:
            val2.val = str[start:end]
          val1.vals.append(val2)
        self.data.arrayval.append(val1)
      return self
    except struct.error as e:
      raise genpy.DeserializationError(e) #most likely buffer underfill

_struct_I = genpy.struct_I
_struct_i = struct.Struct("<i")
