$search
00001 """autogenerated by genmsg_py from SharedMemBlock.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class SharedMemBlock(roslib.message.Message): 00007 _md5sum = "56cdbb4565401cc80f0d826e209bbbe5" 00008 _type = "sharedmem_transport/SharedMemBlock" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """uint32 handle 00011 uint32 size 00012 uint32 allocated 00013 string name 00014 00015 """ 00016 __slots__ = ['handle','size','allocated','name'] 00017 _slot_types = ['uint32','uint32','uint32','string'] 00018 00019 def __init__(self, *args, **kwds): 00020 """ 00021 Constructor. Any message fields that are implicitly/explicitly 00022 set to None will be assigned a default value. The recommend 00023 use is keyword arguments as this is more robust to future message 00024 changes. You cannot mix in-order arguments and keyword arguments. 00025 00026 The available fields are: 00027 handle,size,allocated,name 00028 00029 @param args: complete set of field values, in .msg order 00030 @param kwds: use keyword arguments corresponding to message field names 00031 to set specific fields. 00032 """ 00033 if args or kwds: 00034 super(SharedMemBlock, self).__init__(*args, **kwds) 00035 #message fields cannot be None, assign default values for those that are 00036 if self.handle is None: 00037 self.handle = 0 00038 if self.size is None: 00039 self.size = 0 00040 if self.allocated is None: 00041 self.allocated = 0 00042 if self.name is None: 00043 self.name = '' 00044 else: 00045 self.handle = 0 00046 self.size = 0 00047 self.allocated = 0 00048 self.name = '' 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 00060 @type buff: StringIO 00061 """ 00062 try: 00063 _x = self 00064 buff.write(_struct_3I.pack(_x.handle, _x.size, _x.allocated)) 00065 _x = self.name 00066 length = len(_x) 00067 buff.write(struct.pack('<I%ss'%length, length, _x)) 00068 except struct.error as se: self._check_types(se) 00069 except TypeError as te: self._check_types(te) 00070 00071 def deserialize(self, str): 00072 """ 00073 unpack serialized message in str into this message instance 00074 @param str: byte array of serialized message 00075 @type str: str 00076 """ 00077 try: 00078 end = 0 00079 _x = self 00080 start = end 00081 end += 12 00082 (_x.handle, _x.size, _x.allocated,) = _struct_3I.unpack(str[start:end]) 00083 start = end 00084 end += 4 00085 (length,) = _struct_I.unpack(str[start:end]) 00086 start = end 00087 end += length 00088 self.name = str[start:end] 00089 return self 00090 except struct.error as e: 00091 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00092 00093 00094 def serialize_numpy(self, buff, numpy): 00095 """ 00096 serialize message with numpy array types into buffer 00097 @param buff: buffer 00098 @type buff: StringIO 00099 @param numpy: numpy python module 00100 @type numpy module 00101 """ 00102 try: 00103 _x = self 00104 buff.write(_struct_3I.pack(_x.handle, _x.size, _x.allocated)) 00105 _x = self.name 00106 length = len(_x) 00107 buff.write(struct.pack('<I%ss'%length, length, _x)) 00108 except struct.error as se: self._check_types(se) 00109 except TypeError as te: self._check_types(te) 00110 00111 def deserialize_numpy(self, str, numpy): 00112 """ 00113 unpack serialized message in str into this message instance using numpy for array types 00114 @param str: byte array of serialized message 00115 @type str: str 00116 @param numpy: numpy python module 00117 @type numpy: module 00118 """ 00119 try: 00120 end = 0 00121 _x = self 00122 start = end 00123 end += 12 00124 (_x.handle, _x.size, _x.allocated,) = _struct_3I.unpack(str[start:end]) 00125 start = end 00126 end += 4 00127 (length,) = _struct_I.unpack(str[start:end]) 00128 start = end 00129 end += length 00130 self.name = str[start:end] 00131 return self 00132 except struct.error as e: 00133 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00134 00135 _struct_I = roslib.message.struct_I 00136 _struct_3I = struct.Struct("<3I")