_MultiTouch.py
Go to the documentation of this file.
00001 """autogenerated by genpy from jsk_gui_msgs/MultiTouch.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 jsk_gui_msgs.msg
00008 
00009 class MultiTouch(genpy.Message):
00010   _md5sum = "9f4a309588ef669e69a71aa5601ea65e"
00011   _type = "jsk_gui_msgs/MultiTouch"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """Touch[] touches
00014 ================================================================================
00015 MSG: jsk_gui_msgs/Touch
00016 # finger_id
00017 int64 finger_id
00018 # touch point(screen point)
00019 float64 x
00020 float64 y
00021 # based image size (usually not needed)
00022 int64 image_width
00023 int64 image_height
00024 """
00025   __slots__ = ['touches']
00026   _slot_types = ['jsk_gui_msgs/Touch[]']
00027 
00028   def __init__(self, *args, **kwds):
00029     """
00030     Constructor. Any message fields that are implicitly/explicitly
00031     set to None will be assigned a default value. The recommend
00032     use is keyword arguments as this is more robust to future message
00033     changes.  You cannot mix in-order arguments and keyword arguments.
00034 
00035     The available fields are:
00036        touches
00037 
00038     :param args: complete set of field values, in .msg order
00039     :param kwds: use keyword arguments corresponding to message field names
00040     to set specific fields.
00041     """
00042     if args or kwds:
00043       super(MultiTouch, self).__init__(*args, **kwds)
00044       #message fields cannot be None, assign default values for those that are
00045       if self.touches is None:
00046         self.touches = []
00047     else:
00048       self.touches = []
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       length = len(self.touches)
00063       buff.write(_struct_I.pack(length))
00064       for val1 in self.touches:
00065         _x = val1
00066         buff.write(_struct_q2d2q.pack(_x.finger_id, _x.x, _x.y, _x.image_width, _x.image_height))
00067     except struct.error as se: self._check_types(se)
00068     except TypeError as te: self._check_types(te)
00069 
00070   def deserialize(self, str):
00071     """
00072     unpack serialized message in str into this message instance
00073     :param str: byte array of serialized message, ``str``
00074     """
00075     try:
00076       if self.touches is None:
00077         self.touches = None
00078       end = 0
00079       start = end
00080       end += 4
00081       (length,) = _struct_I.unpack(str[start:end])
00082       self.touches = []
00083       for i in range(0, length):
00084         val1 = jsk_gui_msgs.msg.Touch()
00085         _x = val1
00086         start = end
00087         end += 40
00088         (_x.finger_id, _x.x, _x.y, _x.image_width, _x.image_height,) = _struct_q2d2q.unpack(str[start:end])
00089         self.touches.append(val1)
00090       return self
00091     except struct.error as e:
00092       raise genpy.DeserializationError(e) #most likely buffer underfill
00093 
00094 
00095   def serialize_numpy(self, buff, numpy):
00096     """
00097     serialize message with numpy array types into buffer
00098     :param buff: buffer, ``StringIO``
00099     :param numpy: numpy python module
00100     """
00101     try:
00102       length = len(self.touches)
00103       buff.write(_struct_I.pack(length))
00104       for val1 in self.touches:
00105         _x = val1
00106         buff.write(_struct_q2d2q.pack(_x.finger_id, _x.x, _x.y, _x.image_width, _x.image_height))
00107     except struct.error as se: self._check_types(se)
00108     except TypeError as te: self._check_types(te)
00109 
00110   def deserialize_numpy(self, str, numpy):
00111     """
00112     unpack serialized message in str into this message instance using numpy for array types
00113     :param str: byte array of serialized message, ``str``
00114     :param numpy: numpy python module
00115     """
00116     try:
00117       if self.touches is None:
00118         self.touches = None
00119       end = 0
00120       start = end
00121       end += 4
00122       (length,) = _struct_I.unpack(str[start:end])
00123       self.touches = []
00124       for i in range(0, length):
00125         val1 = jsk_gui_msgs.msg.Touch()
00126         _x = val1
00127         start = end
00128         end += 40
00129         (_x.finger_id, _x.x, _x.y, _x.image_width, _x.image_height,) = _struct_q2d2q.unpack(str[start:end])
00130         self.touches.append(val1)
00131       return self
00132     except struct.error as e:
00133       raise genpy.DeserializationError(e) #most likely buffer underfill
00134 
00135 _struct_I = genpy.struct_I
00136 _struct_q2d2q = struct.Struct("<q2d2q")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends


jsk_gui_msgs
Author(s): chen
autogenerated on Sat Mar 23 2013 16:13:08