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