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

import roslib.msg

class FixedLengthArrayOfExternal(roslib.message.Message):
  _md5sum = "cc431047757f431ecd2754e03aa592f8"
  _type = "test_roscpp_serialization/FixedLengthArrayOfExternal"
  _has_header = False #flag to mark the presence of a Header object
  _full_text = """# This comment has "quotes" in it and \slashes\
roslib/Log[4] a
================================================================================
MSG: roslib/Log
##
## Severity level constants
##
byte DEBUG=1 #debug level
byte INFO=2  #general level
byte WARN=4  #warning level
byte ERROR=8 #error level
byte FATAL=16 #fatal/critical level
##
## Fields
##
Header header
byte level
string name # name of the node
string msg # message 
string file # file the message came from
string function # function the message came from
uint32 line # line the message came from
string[] topics # topic names that the node publishes

================================================================================
MSG: roslib/Header
# Standard metadata for higher-level stamped data types.
# This is generally used to communicate timestamped data 
# in a particular coordinate frame.
# 
# sequence ID: consecutively increasing ID 
uint32 seq
#Two-integer timestamp that is expressed as:
# * stamp.secs: seconds (stamp_secs) since epoch
# * stamp.nsecs: nanoseconds since stamp_secs
# time-handling sugar is provided by the client library
time stamp
#Frame this data is associated with
# 0: no frame
# 1: global frame
string frame_id

"""
  __slots__ = ['a']
  _slot_types = ['roslib/Log[4]']

  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:
       a
    
    @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(FixedLengthArrayOfExternal, self).__init__(*args, **kwds)
      #message fields cannot be None, assign default values for those that are
      if self.a is None:
        self.a = [roslib.msg.Log(),roslib.msg.Log(),roslib.msg.Log(),roslib.msg.Log()]
    else:
      self.a = [roslib.msg.Log(),roslib.msg.Log(),roslib.msg.Log(),roslib.msg.Log()]

  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:
      for val1 in self.a:
        _v1 = val1.header
        buff.write(_struct_I.pack(_v1.seq))
        _v2 = _v1.stamp
        _x = _v2
        buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
        _x = _v1.frame_id
        length = len(_x)
        buff.write(struct.pack('<I%ss'%length, length, _x))
        buff.write(_struct_b.pack(val1.level))
        _x = val1.name
        length = len(_x)
        buff.write(struct.pack('<I%ss'%length, length, _x))
        _x = val1.msg
        length = len(_x)
        buff.write(struct.pack('<I%ss'%length, length, _x))
        _x = val1.file
        length = len(_x)
        buff.write(struct.pack('<I%ss'%length, length, _x))
        _x = val1.function
        length = len(_x)
        buff.write(struct.pack('<I%ss'%length, length, _x))
        buff.write(_struct_I.pack(val1.line))
        length = len(val1.topics)
        buff.write(_struct_I.pack(length))
        for val2 in val1.topics:
          length = len(val2)
          buff.write(struct.pack('<I%ss'%length, length, val2))
    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:
      end = 0
      self.a = []
      for i in xrange(0, 4):
        val1 = roslib.msg.Log()
        _v3 = val1.header
        start = end
        end += 4
        (_v3.seq,) = _struct_I.unpack(str[start:end])
        _v4 = _v3.stamp
        _x = _v4
        start = end
        end += 8
        (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        _v3.frame_id = str[start:end]
        start = end
        end += 1
        (val1.level,) = _struct_b.unpack(str[start:end])
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        val1.name = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        val1.msg = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        val1.file = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        val1.function = str[start:end]
        start = end
        end += 4
        (val1.line,) = _struct_I.unpack(str[start:end])
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.topics = []
        for i in xrange(0, length):
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          start = end
          end += length
          val2 = str[start:end]
          val1.topics.append(val2)
        self.a.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:
      for val1 in self.a:
        _v5 = val1.header
        buff.write(_struct_I.pack(_v5.seq))
        _v6 = _v5.stamp
        _x = _v6
        buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
        _x = _v5.frame_id
        length = len(_x)
        buff.write(struct.pack('<I%ss'%length, length, _x))
        buff.write(_struct_b.pack(val1.level))
        _x = val1.name
        length = len(_x)
        buff.write(struct.pack('<I%ss'%length, length, _x))
        _x = val1.msg
        length = len(_x)
        buff.write(struct.pack('<I%ss'%length, length, _x))
        _x = val1.file
        length = len(_x)
        buff.write(struct.pack('<I%ss'%length, length, _x))
        _x = val1.function
        length = len(_x)
        buff.write(struct.pack('<I%ss'%length, length, _x))
        buff.write(_struct_I.pack(val1.line))
        length = len(val1.topics)
        buff.write(_struct_I.pack(length))
        for val2 in val1.topics:
          length = len(val2)
          buff.write(struct.pack('<I%ss'%length, length, val2))
    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:
      end = 0
      self.a = []
      for i in xrange(0, 4):
        val1 = roslib.msg.Log()
        _v7 = val1.header
        start = end
        end += 4
        (_v7.seq,) = _struct_I.unpack(str[start:end])
        _v8 = _v7.stamp
        _x = _v8
        start = end
        end += 8
        (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        _v7.frame_id = str[start:end]
        start = end
        end += 1
        (val1.level,) = _struct_b.unpack(str[start:end])
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        val1.name = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        val1.msg = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        val1.file = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        val1.function = str[start:end]
        start = end
        end += 4
        (val1.line,) = _struct_I.unpack(str[start:end])
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.topics = []
        for i in xrange(0, length):
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          start = end
          end += length
          val2 = str[start:end]
          val1.topics.append(val2)
        self.a.append(val1)
      return self
    except struct.error, e:
      raise roslib.message.DeserializationError(e) #most likely buffer underfill

_struct_I = roslib.message.struct_I
_struct_b = struct.Struct("<b")
_struct_2I = struct.Struct("<2I")
