_TimeArrayTest.py
Go to the documentation of this file.
00001 """autogenerated by genpy from rosbridge_test/TimeArrayTest.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import genpy
00008 
00009 class TimeArrayTest(genpy.Message):
00010   _md5sum = "237b97d24fd33588beee4cd8978b149d"
00011   _type = "rosbridge_test/TimeArrayTest"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """time[] times
00014 """
00015   __slots__ = ['times']
00016   _slot_types = ['time[]']
00017 
00018   def __init__(self, *args, **kwds):
00019     """
00020     Constructor. Any message fields that are implicitly/explicitly
00021     set to None will be assigned a default value. The recommend
00022     use is keyword arguments as this is more robust to future message
00023     changes.  You cannot mix in-order arguments and keyword arguments.
00024 
00025     The available fields are:
00026        times
00027 
00028     :param args: complete set of field values, in .msg order
00029     :param kwds: use keyword arguments corresponding to message field names
00030     to set specific fields.
00031     """
00032     if args or kwds:
00033       super(TimeArrayTest, self).__init__(*args, **kwds)
00034       #message fields cannot be None, assign default values for those that are
00035       if self.times is None:
00036         self.times = []
00037     else:
00038       self.times = []
00039 
00040   def _get_types(self):
00041     """
00042     internal API method
00043     """
00044     return self._slot_types
00045 
00046   def serialize(self, buff):
00047     """
00048     serialize message into buffer
00049     :param buff: buffer, ``StringIO``
00050     """
00051     try:
00052       length = len(self.times)
00053       buff.write(_struct_I.pack(length))
00054       for val1 in self.times:
00055         _x = val1
00056         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00057     except struct.error as se: self._check_types(se)
00058     except TypeError as te: self._check_types(te)
00059 
00060   def deserialize(self, str):
00061     """
00062     unpack serialized message in str into this message instance
00063     :param str: byte array of serialized message, ``str``
00064     """
00065     try:
00066       if self.times is None:
00067         self.times = None
00068       end = 0
00069       start = end
00070       end += 4
00071       (length,) = _struct_I.unpack(str[start:end])
00072       self.times = []
00073       for i in range(0, length):
00074         val1 = genpy.Time()
00075         _x = val1
00076         start = end
00077         end += 8
00078         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00079         self.times.append(val1)
00080       return self
00081     except struct.error as e:
00082       raise genpy.DeserializationError(e) #most likely buffer underfill
00083 
00084 
00085   def serialize_numpy(self, buff, numpy):
00086     """
00087     serialize message with numpy array types into buffer
00088     :param buff: buffer, ``StringIO``
00089     :param numpy: numpy python module
00090     """
00091     try:
00092       length = len(self.times)
00093       buff.write(_struct_I.pack(length))
00094       for val1 in self.times:
00095         _x = val1
00096         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00097     except struct.error as se: self._check_types(se)
00098     except TypeError as te: self._check_types(te)
00099 
00100   def deserialize_numpy(self, str, numpy):
00101     """
00102     unpack serialized message in str into this message instance using numpy for array types
00103     :param str: byte array of serialized message, ``str``
00104     :param numpy: numpy python module
00105     """
00106     try:
00107       if self.times is None:
00108         self.times = None
00109       end = 0
00110       start = end
00111       end += 4
00112       (length,) = _struct_I.unpack(str[start:end])
00113       self.times = []
00114       for i in range(0, length):
00115         val1 = genpy.Time()
00116         _x = val1
00117         start = end
00118         end += 8
00119         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00120         self.times.append(val1)
00121       return self
00122     except struct.error as e:
00123       raise genpy.DeserializationError(e) #most likely buffer underfill
00124 
00125 _struct_I = genpy.struct_I
00126 _struct_2I = struct.Struct("<2I")


rosbridge_test
Author(s): Jonathan Mace
autogenerated on Thu Jan 2 2014 11:54:04