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


sharedmem_transport
Author(s): Cedric Pradalier
autogenerated on Sun Oct 5 2014 23:49:07