00001 """autogenerated by genpy from srs_msgs/SRS_Action.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import srs_msgs.msg
00008
00009 class SRS_Action(genpy.Message):
00010 _md5sum = "78f876cadd0a50a227e671e96dc7e09b"
00011 _type = "srs_msgs/SRS_Action"
00012 _has_header = False
00013 _full_text = """# this message contains information to define a SRS action
00014
00015 uint32 objectID #targeted object
00016
00017 string objectName #object name for easy reading
00018
00019 uint32 actionID #action to be applied
00020
00021 string actionName #action name for easy reading
00022
00023 bool component_is_required #a component is required or not
00024
00025 srs_msgs/Component[] components #components required
00026
00027 bool symbolic_is_required #a component is required or not
00028
00029 uint32 symbolicID # ID of the symbolic
00030
00031 string symbolicName #name of the symbolic
00032
00033 string description #a short description on the current action set to null if no description
00034 ================================================================================
00035 MSG: srs_msgs/Component
00036 # this message contains information to define a list of required components for an action
00037 uint32 componentID #ID
00038 string componentName #Name
00039
00040 """
00041 __slots__ = ['objectID','objectName','actionID','actionName','component_is_required','components','symbolic_is_required','symbolicID','symbolicName','description']
00042 _slot_types = ['uint32','string','uint32','string','bool','srs_msgs/Component[]','bool','uint32','string','string']
00043
00044 def __init__(self, *args, **kwds):
00045 """
00046 Constructor. Any message fields that are implicitly/explicitly
00047 set to None will be assigned a default value. The recommend
00048 use is keyword arguments as this is more robust to future message
00049 changes. You cannot mix in-order arguments and keyword arguments.
00050
00051 The available fields are:
00052 objectID,objectName,actionID,actionName,component_is_required,components,symbolic_is_required,symbolicID,symbolicName,description
00053
00054 :param args: complete set of field values, in .msg order
00055 :param kwds: use keyword arguments corresponding to message field names
00056 to set specific fields.
00057 """
00058 if args or kwds:
00059 super(SRS_Action, self).__init__(*args, **kwds)
00060
00061 if self.objectID is None:
00062 self.objectID = 0
00063 if self.objectName is None:
00064 self.objectName = ''
00065 if self.actionID is None:
00066 self.actionID = 0
00067 if self.actionName is None:
00068 self.actionName = ''
00069 if self.component_is_required is None:
00070 self.component_is_required = False
00071 if self.components is None:
00072 self.components = []
00073 if self.symbolic_is_required is None:
00074 self.symbolic_is_required = False
00075 if self.symbolicID is None:
00076 self.symbolicID = 0
00077 if self.symbolicName is None:
00078 self.symbolicName = ''
00079 if self.description is None:
00080 self.description = ''
00081 else:
00082 self.objectID = 0
00083 self.objectName = ''
00084 self.actionID = 0
00085 self.actionName = ''
00086 self.component_is_required = False
00087 self.components = []
00088 self.symbolic_is_required = False
00089 self.symbolicID = 0
00090 self.symbolicName = ''
00091 self.description = ''
00092
00093 def _get_types(self):
00094 """
00095 internal API method
00096 """
00097 return self._slot_types
00098
00099 def serialize(self, buff):
00100 """
00101 serialize message into buffer
00102 :param buff: buffer, ``StringIO``
00103 """
00104 try:
00105 buff.write(_struct_I.pack(self.objectID))
00106 _x = self.objectName
00107 length = len(_x)
00108 if python3 or type(_x) == unicode:
00109 _x = _x.encode('utf-8')
00110 length = len(_x)
00111 buff.write(struct.pack('<I%ss'%length, length, _x))
00112 buff.write(_struct_I.pack(self.actionID))
00113 _x = self.actionName
00114 length = len(_x)
00115 if python3 or type(_x) == unicode:
00116 _x = _x.encode('utf-8')
00117 length = len(_x)
00118 buff.write(struct.pack('<I%ss'%length, length, _x))
00119 buff.write(_struct_B.pack(self.component_is_required))
00120 length = len(self.components)
00121 buff.write(_struct_I.pack(length))
00122 for val1 in self.components:
00123 buff.write(_struct_I.pack(val1.componentID))
00124 _x = val1.componentName
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
00131 buff.write(_struct_BI.pack(_x.symbolic_is_required, _x.symbolicID))
00132 _x = self.symbolicName
00133 length = len(_x)
00134 if python3 or type(_x) == unicode:
00135 _x = _x.encode('utf-8')
00136 length = len(_x)
00137 buff.write(struct.pack('<I%ss'%length, length, _x))
00138 _x = self.description
00139 length = len(_x)
00140 if python3 or type(_x) == unicode:
00141 _x = _x.encode('utf-8')
00142 length = len(_x)
00143 buff.write(struct.pack('<I%ss'%length, length, _x))
00144 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00145 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00146
00147 def deserialize(self, str):
00148 """
00149 unpack serialized message in str into this message instance
00150 :param str: byte array of serialized message, ``str``
00151 """
00152 try:
00153 if self.components is None:
00154 self.components = None
00155 end = 0
00156 start = end
00157 end += 4
00158 (self.objectID,) = _struct_I.unpack(str[start:end])
00159 start = end
00160 end += 4
00161 (length,) = _struct_I.unpack(str[start:end])
00162 start = end
00163 end += length
00164 if python3:
00165 self.objectName = str[start:end].decode('utf-8')
00166 else:
00167 self.objectName = str[start:end]
00168 start = end
00169 end += 4
00170 (self.actionID,) = _struct_I.unpack(str[start:end])
00171 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 start = end
00175 end += length
00176 if python3:
00177 self.actionName = str[start:end].decode('utf-8')
00178 else:
00179 self.actionName = str[start:end]
00180 start = end
00181 end += 1
00182 (self.component_is_required,) = _struct_B.unpack(str[start:end])
00183 self.component_is_required = bool(self.component_is_required)
00184 start = end
00185 end += 4
00186 (length,) = _struct_I.unpack(str[start:end])
00187 self.components = []
00188 for i in range(0, length):
00189 val1 = srs_msgs.msg.Component()
00190 start = end
00191 end += 4
00192 (val1.componentID,) = _struct_I.unpack(str[start:end])
00193 start = end
00194 end += 4
00195 (length,) = _struct_I.unpack(str[start:end])
00196 start = end
00197 end += length
00198 if python3:
00199 val1.componentName = str[start:end].decode('utf-8')
00200 else:
00201 val1.componentName = str[start:end]
00202 self.components.append(val1)
00203 _x = self
00204 start = end
00205 end += 5
00206 (_x.symbolic_is_required, _x.symbolicID,) = _struct_BI.unpack(str[start:end])
00207 self.symbolic_is_required = bool(self.symbolic_is_required)
00208 start = end
00209 end += 4
00210 (length,) = _struct_I.unpack(str[start:end])
00211 start = end
00212 end += length
00213 if python3:
00214 self.symbolicName = str[start:end].decode('utf-8')
00215 else:
00216 self.symbolicName = str[start:end]
00217 start = end
00218 end += 4
00219 (length,) = _struct_I.unpack(str[start:end])
00220 start = end
00221 end += length
00222 if python3:
00223 self.description = str[start:end].decode('utf-8')
00224 else:
00225 self.description = str[start:end]
00226 return self
00227 except struct.error as e:
00228 raise genpy.DeserializationError(e)
00229
00230
00231 def serialize_numpy(self, buff, numpy):
00232 """
00233 serialize message with numpy array types into buffer
00234 :param buff: buffer, ``StringIO``
00235 :param numpy: numpy python module
00236 """
00237 try:
00238 buff.write(_struct_I.pack(self.objectID))
00239 _x = self.objectName
00240 length = len(_x)
00241 if python3 or type(_x) == unicode:
00242 _x = _x.encode('utf-8')
00243 length = len(_x)
00244 buff.write(struct.pack('<I%ss'%length, length, _x))
00245 buff.write(_struct_I.pack(self.actionID))
00246 _x = self.actionName
00247 length = len(_x)
00248 if python3 or type(_x) == unicode:
00249 _x = _x.encode('utf-8')
00250 length = len(_x)
00251 buff.write(struct.pack('<I%ss'%length, length, _x))
00252 buff.write(_struct_B.pack(self.component_is_required))
00253 length = len(self.components)
00254 buff.write(_struct_I.pack(length))
00255 for val1 in self.components:
00256 buff.write(_struct_I.pack(val1.componentID))
00257 _x = val1.componentName
00258 length = len(_x)
00259 if python3 or type(_x) == unicode:
00260 _x = _x.encode('utf-8')
00261 length = len(_x)
00262 buff.write(struct.pack('<I%ss'%length, length, _x))
00263 _x = self
00264 buff.write(_struct_BI.pack(_x.symbolic_is_required, _x.symbolicID))
00265 _x = self.symbolicName
00266 length = len(_x)
00267 if python3 or type(_x) == unicode:
00268 _x = _x.encode('utf-8')
00269 length = len(_x)
00270 buff.write(struct.pack('<I%ss'%length, length, _x))
00271 _x = self.description
00272 length = len(_x)
00273 if python3 or type(_x) == unicode:
00274 _x = _x.encode('utf-8')
00275 length = len(_x)
00276 buff.write(struct.pack('<I%ss'%length, length, _x))
00277 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00278 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00279
00280 def deserialize_numpy(self, str, numpy):
00281 """
00282 unpack serialized message in str into this message instance using numpy for array types
00283 :param str: byte array of serialized message, ``str``
00284 :param numpy: numpy python module
00285 """
00286 try:
00287 if self.components is None:
00288 self.components = None
00289 end = 0
00290 start = end
00291 end += 4
00292 (self.objectID,) = _struct_I.unpack(str[start:end])
00293 start = end
00294 end += 4
00295 (length,) = _struct_I.unpack(str[start:end])
00296 start = end
00297 end += length
00298 if python3:
00299 self.objectName = str[start:end].decode('utf-8')
00300 else:
00301 self.objectName = str[start:end]
00302 start = end
00303 end += 4
00304 (self.actionID,) = _struct_I.unpack(str[start:end])
00305 start = end
00306 end += 4
00307 (length,) = _struct_I.unpack(str[start:end])
00308 start = end
00309 end += length
00310 if python3:
00311 self.actionName = str[start:end].decode('utf-8')
00312 else:
00313 self.actionName = str[start:end]
00314 start = end
00315 end += 1
00316 (self.component_is_required,) = _struct_B.unpack(str[start:end])
00317 self.component_is_required = bool(self.component_is_required)
00318 start = end
00319 end += 4
00320 (length,) = _struct_I.unpack(str[start:end])
00321 self.components = []
00322 for i in range(0, length):
00323 val1 = srs_msgs.msg.Component()
00324 start = end
00325 end += 4
00326 (val1.componentID,) = _struct_I.unpack(str[start:end])
00327 start = end
00328 end += 4
00329 (length,) = _struct_I.unpack(str[start:end])
00330 start = end
00331 end += length
00332 if python3:
00333 val1.componentName = str[start:end].decode('utf-8')
00334 else:
00335 val1.componentName = str[start:end]
00336 self.components.append(val1)
00337 _x = self
00338 start = end
00339 end += 5
00340 (_x.symbolic_is_required, _x.symbolicID,) = _struct_BI.unpack(str[start:end])
00341 self.symbolic_is_required = bool(self.symbolic_is_required)
00342 start = end
00343 end += 4
00344 (length,) = _struct_I.unpack(str[start:end])
00345 start = end
00346 end += length
00347 if python3:
00348 self.symbolicName = str[start:end].decode('utf-8')
00349 else:
00350 self.symbolicName = str[start:end]
00351 start = end
00352 end += 4
00353 (length,) = _struct_I.unpack(str[start:end])
00354 start = end
00355 end += length
00356 if python3:
00357 self.description = str[start:end].decode('utf-8')
00358 else:
00359 self.description = str[start:end]
00360 return self
00361 except struct.error as e:
00362 raise genpy.DeserializationError(e)
00363
00364 _struct_I = genpy.struct_I
00365 _struct_B = struct.Struct("<B")
00366 _struct_BI = struct.Struct("<BI")