_ShellCommandResult.py
Go to the documentation of this file.
00001 """autogenerated by genpy from shell_execution_action_server/ShellCommandResult.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 ShellCommandResult(genpy.Message):
00009   _md5sum = "ab1da367af6c5039cad88143b7611458"
00010   _type = "shell_execution_action_server/ShellCommandResult"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00013 #Result (accumulated output from start to end)
00014 string stdout
00015 string stderr
00016 uint8 exit_code
00017 
00018 """
00019   __slots__ = ['stdout','stderr','exit_code']
00020   _slot_types = ['string','string','uint8']
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        stdout,stderr,exit_code
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(ShellCommandResult, self).__init__(*args, **kwds)
00038       #message fields cannot be None, assign default values for those that are
00039       if self.stdout is None:
00040         self.stdout = ''
00041       if self.stderr is None:
00042         self.stderr = ''
00043       if self.exit_code is None:
00044         self.exit_code = 0
00045     else:
00046       self.stdout = ''
00047       self.stderr = ''
00048       self.exit_code = 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.stdout
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.stderr
00069       length = len(_x)
00070       if python3 or type(_x) == unicode:
00071         _x = _x.encode('utf-8')
00072         length = len(_x)
00073       buff.write(struct.pack('<I%ss'%length, length, _x))
00074       buff.write(_struct_B.pack(self.exit_code))
00075     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00076     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00077 
00078   def deserialize(self, str):
00079     """
00080     unpack serialized message in str into this message instance
00081     :param str: byte array of serialized message, ``str``
00082     """
00083     try:
00084       end = 0
00085       start = end
00086       end += 4
00087       (length,) = _struct_I.unpack(str[start:end])
00088       start = end
00089       end += length
00090       if python3:
00091         self.stdout = str[start:end].decode('utf-8')
00092       else:
00093         self.stdout = str[start:end]
00094       start = end
00095       end += 4
00096       (length,) = _struct_I.unpack(str[start:end])
00097       start = end
00098       end += length
00099       if python3:
00100         self.stderr = str[start:end].decode('utf-8')
00101       else:
00102         self.stderr = str[start:end]
00103       start = end
00104       end += 1
00105       (self.exit_code,) = _struct_B.unpack(str[start:end])
00106       return self
00107     except struct.error as e:
00108       raise genpy.DeserializationError(e) #most likely buffer underfill
00109 
00110 
00111   def serialize_numpy(self, buff, numpy):
00112     """
00113     serialize message with numpy array types into buffer
00114     :param buff: buffer, ``StringIO``
00115     :param numpy: numpy python module
00116     """
00117     try:
00118       _x = self.stdout
00119       length = len(_x)
00120       if python3 or type(_x) == unicode:
00121         _x = _x.encode('utf-8')
00122         length = len(_x)
00123       buff.write(struct.pack('<I%ss'%length, length, _x))
00124       _x = self.stderr
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       buff.write(_struct_B.pack(self.exit_code))
00131     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00132     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00133 
00134   def deserialize_numpy(self, str, numpy):
00135     """
00136     unpack serialized message in str into this message instance using numpy for array types
00137     :param str: byte array of serialized message, ``str``
00138     :param numpy: numpy python module
00139     """
00140     try:
00141       end = 0
00142       start = end
00143       end += 4
00144       (length,) = _struct_I.unpack(str[start:end])
00145       start = end
00146       end += length
00147       if python3:
00148         self.stdout = str[start:end].decode('utf-8')
00149       else:
00150         self.stdout = str[start:end]
00151       start = end
00152       end += 4
00153       (length,) = _struct_I.unpack(str[start:end])
00154       start = end
00155       end += length
00156       if python3:
00157         self.stderr = str[start:end].decode('utf-8')
00158       else:
00159         self.stderr = str[start:end]
00160       start = end
00161       end += 1
00162       (self.exit_code,) = _struct_B.unpack(str[start:end])
00163       return self
00164     except struct.error as e:
00165       raise genpy.DeserializationError(e) #most likely buffer underfill
00166 
00167 _struct_I = genpy.struct_I
00168 _struct_B = struct.Struct("<B")


shell_execution_action_server
Author(s): Felix Endres
autogenerated on Mon Oct 6 2014 00:07:43