_SetVariable.py
Go to the documentation of this file.
00001 """autogenerated by genpy from asebaros/SetVariableRequest.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 SetVariableRequest(genpy.Message):
00009   _md5sum = "44d6658323411da63b773411b762c345"
00010   _type = "asebaros/SetVariableRequest"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string nodeName
00013 string variableName
00014 int16[] data
00015 
00016 
00017 """
00018   __slots__ = ['nodeName','variableName','data']
00019   _slot_types = ['string','string','int16[]']
00020 
00021   def __init__(self, *args, **kwds):
00022     """
00023     Constructor. Any message fields that are implicitly/explicitly
00024     set to None will be assigned a default value. The recommend
00025     use is keyword arguments as this is more robust to future message
00026     changes.  You cannot mix in-order arguments and keyword arguments.
00027 
00028     The available fields are:
00029        nodeName,variableName,data
00030 
00031     :param args: complete set of field values, in .msg order
00032     :param kwds: use keyword arguments corresponding to message field names
00033     to set specific fields.
00034     """
00035     if args or kwds:
00036       super(SetVariableRequest, self).__init__(*args, **kwds)
00037       #message fields cannot be None, assign default values for those that are
00038       if self.nodeName is None:
00039         self.nodeName = ''
00040       if self.variableName is None:
00041         self.variableName = ''
00042       if self.data is None:
00043         self.data = []
00044     else:
00045       self.nodeName = ''
00046       self.variableName = ''
00047       self.data = []
00048 
00049   def _get_types(self):
00050     """
00051     internal API method
00052     """
00053     return self._slot_types
00054 
00055   def serialize(self, buff):
00056     """
00057     serialize message into buffer
00058     :param buff: buffer, ``StringIO``
00059     """
00060     try:
00061       _x = self.nodeName
00062       length = len(_x)
00063       if python3 or type(_x) == unicode:
00064         _x = _x.encode('utf-8')
00065         length = len(_x)
00066       buff.write(struct.pack('<I%ss'%length, length, _x))
00067       _x = self.variableName
00068       length = len(_x)
00069       if python3 or type(_x) == unicode:
00070         _x = _x.encode('utf-8')
00071         length = len(_x)
00072       buff.write(struct.pack('<I%ss'%length, length, _x))
00073       length = len(self.data)
00074       buff.write(_struct_I.pack(length))
00075       pattern = '<%sh'%length
00076       buff.write(struct.pack(pattern, *self.data))
00077     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00078     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00079 
00080   def deserialize(self, str):
00081     """
00082     unpack serialized message in str into this message instance
00083     :param str: byte array of serialized message, ``str``
00084     """
00085     try:
00086       end = 0
00087       start = end
00088       end += 4
00089       (length,) = _struct_I.unpack(str[start:end])
00090       start = end
00091       end += length
00092       if python3:
00093         self.nodeName = str[start:end].decode('utf-8')
00094       else:
00095         self.nodeName = str[start:end]
00096       start = end
00097       end += 4
00098       (length,) = _struct_I.unpack(str[start:end])
00099       start = end
00100       end += length
00101       if python3:
00102         self.variableName = str[start:end].decode('utf-8')
00103       else:
00104         self.variableName = str[start:end]
00105       start = end
00106       end += 4
00107       (length,) = _struct_I.unpack(str[start:end])
00108       pattern = '<%sh'%length
00109       start = end
00110       end += struct.calcsize(pattern)
00111       self.data = struct.unpack(pattern, str[start:end])
00112       return self
00113     except struct.error as e:
00114       raise genpy.DeserializationError(e) #most likely buffer underfill
00115 
00116 
00117   def serialize_numpy(self, buff, numpy):
00118     """
00119     serialize message with numpy array types into buffer
00120     :param buff: buffer, ``StringIO``
00121     :param numpy: numpy python module
00122     """
00123     try:
00124       _x = self.nodeName
00125       length = len(_x)
00126       if python3 or type(_x) == unicode:
00127         _x = _x.encode('utf-8')
00128         length = len(_x)
00129       buff.write(struct.pack('<I%ss'%length, length, _x))
00130       _x = self.variableName
00131       length = len(_x)
00132       if python3 or type(_x) == unicode:
00133         _x = _x.encode('utf-8')
00134         length = len(_x)
00135       buff.write(struct.pack('<I%ss'%length, length, _x))
00136       length = len(self.data)
00137       buff.write(_struct_I.pack(length))
00138       pattern = '<%sh'%length
00139       buff.write(self.data.tostring())
00140     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00141     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00142 
00143   def deserialize_numpy(self, str, numpy):
00144     """
00145     unpack serialized message in str into this message instance using numpy for array types
00146     :param str: byte array of serialized message, ``str``
00147     :param numpy: numpy python module
00148     """
00149     try:
00150       end = 0
00151       start = end
00152       end += 4
00153       (length,) = _struct_I.unpack(str[start:end])
00154       start = end
00155       end += length
00156       if python3:
00157         self.nodeName = str[start:end].decode('utf-8')
00158       else:
00159         self.nodeName = str[start:end]
00160       start = end
00161       end += 4
00162       (length,) = _struct_I.unpack(str[start:end])
00163       start = end
00164       end += length
00165       if python3:
00166         self.variableName = str[start:end].decode('utf-8')
00167       else:
00168         self.variableName = str[start:end]
00169       start = end
00170       end += 4
00171       (length,) = _struct_I.unpack(str[start:end])
00172       pattern = '<%sh'%length
00173       start = end
00174       end += struct.calcsize(pattern)
00175       self.data = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length)
00176       return self
00177     except struct.error as e:
00178       raise genpy.DeserializationError(e) #most likely buffer underfill
00179 
00180 _struct_I = genpy.struct_I
00181 """autogenerated by genpy from asebaros/SetVariableResponse.msg. Do not edit."""
00182 import sys
00183 python3 = True if sys.hexversion > 0x03000000 else False
00184 import genpy
00185 import struct
00186 
00187 
00188 class SetVariableResponse(genpy.Message):
00189   _md5sum = "d41d8cd98f00b204e9800998ecf8427e"
00190   _type = "asebaros/SetVariableResponse"
00191   _has_header = False #flag to mark the presence of a Header object
00192   _full_text = """
00193 """
00194   __slots__ = []
00195   _slot_types = []
00196 
00197   def __init__(self, *args, **kwds):
00198     """
00199     Constructor. Any message fields that are implicitly/explicitly
00200     set to None will be assigned a default value. The recommend
00201     use is keyword arguments as this is more robust to future message
00202     changes.  You cannot mix in-order arguments and keyword arguments.
00203 
00204     The available fields are:
00205        
00206 
00207     :param args: complete set of field values, in .msg order
00208     :param kwds: use keyword arguments corresponding to message field names
00209     to set specific fields.
00210     """
00211     if args or kwds:
00212       super(SetVariableResponse, self).__init__(*args, **kwds)
00213 
00214   def _get_types(self):
00215     """
00216     internal API method
00217     """
00218     return self._slot_types
00219 
00220   def serialize(self, buff):
00221     """
00222     serialize message into buffer
00223     :param buff: buffer, ``StringIO``
00224     """
00225     try:
00226       pass
00227     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00228     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00229 
00230   def deserialize(self, str):
00231     """
00232     unpack serialized message in str into this message instance
00233     :param str: byte array of serialized message, ``str``
00234     """
00235     try:
00236       end = 0
00237       return self
00238     except struct.error as e:
00239       raise genpy.DeserializationError(e) #most likely buffer underfill
00240 
00241 
00242   def serialize_numpy(self, buff, numpy):
00243     """
00244     serialize message with numpy array types into buffer
00245     :param buff: buffer, ``StringIO``
00246     :param numpy: numpy python module
00247     """
00248     try:
00249       pass
00250     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00251     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00252 
00253   def deserialize_numpy(self, str, numpy):
00254     """
00255     unpack serialized message in str into this message instance using numpy for array types
00256     :param str: byte array of serialized message, ``str``
00257     :param numpy: numpy python module
00258     """
00259     try:
00260       end = 0
00261       return self
00262     except struct.error as e:
00263       raise genpy.DeserializationError(e) #most likely buffer underfill
00264 
00265 _struct_I = genpy.struct_I
00266 class SetVariable(object):
00267   _type          = 'asebaros/SetVariable'
00268   _md5sum = '44d6658323411da63b773411b762c345'
00269   _request_class  = SetVariableRequest
00270   _response_class = SetVariableResponse


asebaros
Author(s): Stéphane Magnenat
autogenerated on Sun Oct 5 2014 23:47:01