"""autogenerated by genmsg_py from TransitiveImport.msg. Do not edit."""
import roslib.message
import struct

import test_rospy.msg
import std_msgs.msg

class TransitiveImport(roslib.message.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
    @type  buff: StringIO
    """
    try:
      _x = self.data.str1.data
      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)
      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)
        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)
          buff.write(struct.pack('<I%ss'%length, length, _x))
    except struct.error, se: self._check_types(se)
    except TypeError, 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
    @type  str: 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
      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 xrange(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
      self.data.val.val = str[start:end]
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.data.vals = []
      for i in xrange(0, length):
        val1 = test_rospy.msg.Val()
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        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 xrange(0, length):
        val1 = test_rospy.msg.ArrayVal()
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.vals = []
        for i in xrange(0, length):
          val2 = test_rospy.msg.Val()
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          start = end
          end += length
          val2.val = str[start:end]
          val1.vals.append(val2)
        self.data.arrayval.append(val1)
      return self
    except struct.error, e:
      raise roslib.message.DeserializationError(e) #most likely buffer underfill


  def serialize_numpy(self, buff, numpy):
    """
    serialize message with numpy array types into buffer
    @param buff: buffer
    @type  buff: StringIO
    @param numpy: numpy python module
    @type  numpy module
    """
    try:
      _x = self.data.str1.data
      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)
      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)
        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)
          buff.write(struct.pack('<I%ss'%length, length, _x))
    except struct.error, se: self._check_types(se)
    except TypeError, 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
    @type  str: str
    @param numpy: numpy python module
    @type  numpy: 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
      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 xrange(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
      self.data.val.val = str[start:end]
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.data.vals = []
      for i in xrange(0, length):
        val1 = test_rospy.msg.Val()
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        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 xrange(0, length):
        val1 = test_rospy.msg.ArrayVal()
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.vals = []
        for i in xrange(0, length):
          val2 = test_rospy.msg.Val()
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          start = end
          end += length
          val2.val = str[start:end]
          val1.vals.append(val2)
        self.data.arrayval.append(val1)
      return self
    except struct.error, e:
      raise roslib.message.DeserializationError(e) #most likely buffer underfill

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