_Diagnosis.py
Go to the documentation of this file.
00001 """autogenerated by genpy from tug_ist_diagnosis_msgs/Diagnosis.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 tug_ist_diagnosis_msgs.msg
00008 
00009 class Diagnosis(genpy.Message):
00010   _md5sum = "1a2002a6f57e647d108be3b4d120bbb7"
00011   _type = "tug_ist_diagnosis_msgs/Diagnosis"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """float32 o_time
00014 DiagnosisResults[] diag
00015 
00016 ================================================================================
00017 MSG: tug_ist_diagnosis_msgs/DiagnosisResults
00018 string[] good
00019 string[] bad
00020 
00021 """
00022   __slots__ = ['o_time','diag']
00023   _slot_types = ['float32','tug_ist_diagnosis_msgs/DiagnosisResults[]']
00024 
00025   def __init__(self, *args, **kwds):
00026     """
00027     Constructor. Any message fields that are implicitly/explicitly
00028     set to None will be assigned a default value. The recommend
00029     use is keyword arguments as this is more robust to future message
00030     changes.  You cannot mix in-order arguments and keyword arguments.
00031 
00032     The available fields are:
00033        o_time,diag
00034 
00035     :param args: complete set of field values, in .msg order
00036     :param kwds: use keyword arguments corresponding to message field names
00037     to set specific fields.
00038     """
00039     if args or kwds:
00040       super(Diagnosis, self).__init__(*args, **kwds)
00041       #message fields cannot be None, assign default values for those that are
00042       if self.o_time is None:
00043         self.o_time = 0.
00044       if self.diag is None:
00045         self.diag = []
00046     else:
00047       self.o_time = 0.
00048       self.diag = []
00049 
00050   def _get_types(self):
00051     """
00052     internal API method
00053     """
00054     return self._slot_types
00055 
00056   def serialize(self, buff):
00057     """
00058     serialize message into buffer
00059     :param buff: buffer, ``StringIO``
00060     """
00061     try:
00062       buff.write(_struct_f.pack(self.o_time))
00063       length = len(self.diag)
00064       buff.write(_struct_I.pack(length))
00065       for val1 in self.diag:
00066         length = len(val1.good)
00067         buff.write(_struct_I.pack(length))
00068         for val2 in val1.good:
00069           length = len(val2)
00070           if python3 or type(val2) == unicode:
00071             val2 = val2.encode('utf-8')
00072             length = len(val2)
00073           buff.write(struct.pack('<I%ss'%length, length, val2))
00074         length = len(val1.bad)
00075         buff.write(_struct_I.pack(length))
00076         for val2 in val1.bad:
00077           length = len(val2)
00078           if python3 or type(val2) == unicode:
00079             val2 = val2.encode('utf-8')
00080             length = len(val2)
00081           buff.write(struct.pack('<I%ss'%length, length, val2))
00082     except struct.error as se: self._check_types(se)
00083     except TypeError as te: self._check_types(te)
00084 
00085   def deserialize(self, str):
00086     """
00087     unpack serialized message in str into this message instance
00088     :param str: byte array of serialized message, ``str``
00089     """
00090     try:
00091       if self.diag is None:
00092         self.diag = None
00093       end = 0
00094       start = end
00095       end += 4
00096       (self.o_time,) = _struct_f.unpack(str[start:end])
00097       start = end
00098       end += 4
00099       (length,) = _struct_I.unpack(str[start:end])
00100       self.diag = []
00101       for i in range(0, length):
00102         val1 = tug_ist_diagnosis_msgs.msg.DiagnosisResults()
00103         start = end
00104         end += 4
00105         (length,) = _struct_I.unpack(str[start:end])
00106         val1.good = []
00107         for i in range(0, length):
00108           start = end
00109           end += 4
00110           (length,) = _struct_I.unpack(str[start:end])
00111           start = end
00112           end += length
00113           if python3:
00114             val2 = str[start:end].decode('utf-8')
00115           else:
00116             val2 = str[start:end]
00117           val1.good.append(val2)
00118         start = end
00119         end += 4
00120         (length,) = _struct_I.unpack(str[start:end])
00121         val1.bad = []
00122         for i in range(0, length):
00123           start = end
00124           end += 4
00125           (length,) = _struct_I.unpack(str[start:end])
00126           start = end
00127           end += length
00128           if python3:
00129             val2 = str[start:end].decode('utf-8')
00130           else:
00131             val2 = str[start:end]
00132           val1.bad.append(val2)
00133         self.diag.append(val1)
00134       return self
00135     except struct.error as e:
00136       raise genpy.DeserializationError(e) #most likely buffer underfill
00137 
00138 
00139   def serialize_numpy(self, buff, numpy):
00140     """
00141     serialize message with numpy array types into buffer
00142     :param buff: buffer, ``StringIO``
00143     :param numpy: numpy python module
00144     """
00145     try:
00146       buff.write(_struct_f.pack(self.o_time))
00147       length = len(self.diag)
00148       buff.write(_struct_I.pack(length))
00149       for val1 in self.diag:
00150         length = len(val1.good)
00151         buff.write(_struct_I.pack(length))
00152         for val2 in val1.good:
00153           length = len(val2)
00154           if python3 or type(val2) == unicode:
00155             val2 = val2.encode('utf-8')
00156             length = len(val2)
00157           buff.write(struct.pack('<I%ss'%length, length, val2))
00158         length = len(val1.bad)
00159         buff.write(_struct_I.pack(length))
00160         for val2 in val1.bad:
00161           length = len(val2)
00162           if python3 or type(val2) == unicode:
00163             val2 = val2.encode('utf-8')
00164             length = len(val2)
00165           buff.write(struct.pack('<I%ss'%length, length, val2))
00166     except struct.error as se: self._check_types(se)
00167     except TypeError as te: self._check_types(te)
00168 
00169   def deserialize_numpy(self, str, numpy):
00170     """
00171     unpack serialized message in str into this message instance using numpy for array types
00172     :param str: byte array of serialized message, ``str``
00173     :param numpy: numpy python module
00174     """
00175     try:
00176       if self.diag is None:
00177         self.diag = None
00178       end = 0
00179       start = end
00180       end += 4
00181       (self.o_time,) = _struct_f.unpack(str[start:end])
00182       start = end
00183       end += 4
00184       (length,) = _struct_I.unpack(str[start:end])
00185       self.diag = []
00186       for i in range(0, length):
00187         val1 = tug_ist_diagnosis_msgs.msg.DiagnosisResults()
00188         start = end
00189         end += 4
00190         (length,) = _struct_I.unpack(str[start:end])
00191         val1.good = []
00192         for i in range(0, length):
00193           start = end
00194           end += 4
00195           (length,) = _struct_I.unpack(str[start:end])
00196           start = end
00197           end += length
00198           if python3:
00199             val2 = str[start:end].decode('utf-8')
00200           else:
00201             val2 = str[start:end]
00202           val1.good.append(val2)
00203         start = end
00204         end += 4
00205         (length,) = _struct_I.unpack(str[start:end])
00206         val1.bad = []
00207         for i in range(0, length):
00208           start = end
00209           end += 4
00210           (length,) = _struct_I.unpack(str[start:end])
00211           start = end
00212           end += length
00213           if python3:
00214             val2 = str[start:end].decode('utf-8')
00215           else:
00216             val2 = str[start:end]
00217           val1.bad.append(val2)
00218         self.diag.append(val1)
00219       return self
00220     except struct.error as e:
00221       raise genpy.DeserializationError(e) #most likely buffer underfill
00222 
00223 _struct_I = genpy.struct_I
00224 _struct_f = struct.Struct("<f")


tug_ist_diagnosis_msgs
Author(s): Safdar Zaman, Gerald Steinbauer
autogenerated on Mon Jan 6 2014 11:51:02