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


throttled_transport
Author(s): Cedric Pradalier
autogenerated on Sun Oct 5 2014 23:49:02