_MouseEvent.py
Go to the documentation of this file.
00001 """autogenerated by genpy from rve_msgs/MouseEvent.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class MouseEvent(genpy.Message):
00009   _md5sum = "508b38c1b01055ec1a8ae9bd4eb8c10b"
00010   _type = "rve_msgs/MouseEvent"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """uint8 BUTTON_NONE = 0
00013 uint8 BUTTON_LEFT = 1
00014 uint8 BUTTON_MIDDLE = 2
00015 uint8 BUTTON_RIGHT = 4
00016 
00017 uint8 EVENT_PRESS = 0
00018 uint8 EVENT_RELEASE = 1
00019 uint8 EVENT_MOVE = 2
00020 
00021 uint8 MODIFIER_NONE = 0
00022 uint8 MODIFIER_SHIFT = 1
00023 uint8 MODIFIER_CONTROL = 2
00024 uint8 MODIFIER_ALT = 4
00025 uint8 MODIFIER_META = 8
00026 
00027 uint8 type
00028 
00029 uint8 button
00030 uint8 buttons
00031 
00032 uint32 x
00033 uint32 y
00034 
00035 uint32 window_width
00036 uint32 window_height
00037 
00038 uint8 modifiers
00039 """
00040   # Pseudo-constants
00041   BUTTON_NONE = 0
00042   BUTTON_LEFT = 1
00043   BUTTON_MIDDLE = 2
00044   BUTTON_RIGHT = 4
00045   EVENT_PRESS = 0
00046   EVENT_RELEASE = 1
00047   EVENT_MOVE = 2
00048   MODIFIER_NONE = 0
00049   MODIFIER_SHIFT = 1
00050   MODIFIER_CONTROL = 2
00051   MODIFIER_ALT = 4
00052   MODIFIER_META = 8
00053 
00054   __slots__ = ['type','button','buttons','x','y','window_width','window_height','modifiers']
00055   _slot_types = ['uint8','uint8','uint8','uint32','uint32','uint32','uint32','uint8']
00056 
00057   def __init__(self, *args, **kwds):
00058     """
00059     Constructor. Any message fields that are implicitly/explicitly
00060     set to None will be assigned a default value. The recommend
00061     use is keyword arguments as this is more robust to future message
00062     changes.  You cannot mix in-order arguments and keyword arguments.
00063 
00064     The available fields are:
00065        type,button,buttons,x,y,window_width,window_height,modifiers
00066 
00067     :param args: complete set of field values, in .msg order
00068     :param kwds: use keyword arguments corresponding to message field names
00069     to set specific fields.
00070     """
00071     if args or kwds:
00072       super(MouseEvent, self).__init__(*args, **kwds)
00073       #message fields cannot be None, assign default values for those that are
00074       if self.type is None:
00075         self.type = 0
00076       if self.button is None:
00077         self.button = 0
00078       if self.buttons is None:
00079         self.buttons = 0
00080       if self.x is None:
00081         self.x = 0
00082       if self.y is None:
00083         self.y = 0
00084       if self.window_width is None:
00085         self.window_width = 0
00086       if self.window_height is None:
00087         self.window_height = 0
00088       if self.modifiers is None:
00089         self.modifiers = 0
00090     else:
00091       self.type = 0
00092       self.button = 0
00093       self.buttons = 0
00094       self.x = 0
00095       self.y = 0
00096       self.window_width = 0
00097       self.window_height = 0
00098       self.modifiers = 0
00099 
00100   def _get_types(self):
00101     """
00102     internal API method
00103     """
00104     return self._slot_types
00105 
00106   def serialize(self, buff):
00107     """
00108     serialize message into buffer
00109     :param buff: buffer, ``StringIO``
00110     """
00111     try:
00112       _x = self
00113       buff.write(_struct_3B4IB.pack(_x.type, _x.button, _x.buttons, _x.x, _x.y, _x.window_width, _x.window_height, _x.modifiers))
00114     except struct.error as se: self._check_types(se)
00115     except TypeError as te: self._check_types(te)
00116 
00117   def deserialize(self, str):
00118     """
00119     unpack serialized message in str into this message instance
00120     :param str: byte array of serialized message, ``str``
00121     """
00122     try:
00123       end = 0
00124       _x = self
00125       start = end
00126       end += 20
00127       (_x.type, _x.button, _x.buttons, _x.x, _x.y, _x.window_width, _x.window_height, _x.modifiers,) = _struct_3B4IB.unpack(str[start:end])
00128       return self
00129     except struct.error as e:
00130       raise genpy.DeserializationError(e) #most likely buffer underfill
00131 
00132 
00133   def serialize_numpy(self, buff, numpy):
00134     """
00135     serialize message with numpy array types into buffer
00136     :param buff: buffer, ``StringIO``
00137     :param numpy: numpy python module
00138     """
00139     try:
00140       _x = self
00141       buff.write(_struct_3B4IB.pack(_x.type, _x.button, _x.buttons, _x.x, _x.y, _x.window_width, _x.window_height, _x.modifiers))
00142     except struct.error as se: self._check_types(se)
00143     except TypeError as te: self._check_types(te)
00144 
00145   def deserialize_numpy(self, str, numpy):
00146     """
00147     unpack serialized message in str into this message instance using numpy for array types
00148     :param str: byte array of serialized message, ``str``
00149     :param numpy: numpy python module
00150     """
00151     try:
00152       end = 0
00153       _x = self
00154       start = end
00155       end += 20
00156       (_x.type, _x.button, _x.buttons, _x.x, _x.y, _x.window_width, _x.window_height, _x.modifiers,) = _struct_3B4IB.unpack(str[start:end])
00157       return self
00158     except struct.error as e:
00159       raise genpy.DeserializationError(e) #most likely buffer underfill
00160 
00161 _struct_I = genpy.struct_I
00162 _struct_3B4IB = struct.Struct("<3B4IB")


rve_msgs
Author(s): Josh Faust
autogenerated on Wed Dec 11 2013 14:30:38