_StringArray.py
Go to the documentation of this file.
00001 """autogenerated by genpy from hrl_lib/StringArray.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 std_msgs.msg
00008 
00009 class StringArray(genpy.Message):
00010   _md5sum = "17b6e4aa81015d95bcd2b08039bd6bda"
00011   _type = "hrl_lib/StringArray"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """Header header
00014 string[] data
00015 
00016 ================================================================================
00017 MSG: std_msgs/Header
00018 # Standard metadata for higher-level stamped data types.
00019 # This is generally used to communicate timestamped data 
00020 # in a particular coordinate frame.
00021 # 
00022 # sequence ID: consecutively increasing ID 
00023 uint32 seq
00024 #Two-integer timestamp that is expressed as:
00025 # * stamp.secs: seconds (stamp_secs) since epoch
00026 # * stamp.nsecs: nanoseconds since stamp_secs
00027 # time-handling sugar is provided by the client library
00028 time stamp
00029 #Frame this data is associated with
00030 # 0: no frame
00031 # 1: global frame
00032 string frame_id
00033 
00034 """
00035   __slots__ = ['header','data']
00036   _slot_types = ['std_msgs/Header','string[]']
00037 
00038   def __init__(self, *args, **kwds):
00039     """
00040     Constructor. Any message fields that are implicitly/explicitly
00041     set to None will be assigned a default value. The recommend
00042     use is keyword arguments as this is more robust to future message
00043     changes.  You cannot mix in-order arguments and keyword arguments.
00044 
00045     The available fields are:
00046        header,data
00047 
00048     :param args: complete set of field values, in .msg order
00049     :param kwds: use keyword arguments corresponding to message field names
00050     to set specific fields.
00051     """
00052     if args or kwds:
00053       super(StringArray, self).__init__(*args, **kwds)
00054       #message fields cannot be None, assign default values for those that are
00055       if self.header is None:
00056         self.header = std_msgs.msg.Header()
00057       if self.data is None:
00058         self.data = []
00059     else:
00060       self.header = std_msgs.msg.Header()
00061       self.data = []
00062 
00063   def _get_types(self):
00064     """
00065     internal API method
00066     """
00067     return self._slot_types
00068 
00069   def serialize(self, buff):
00070     """
00071     serialize message into buffer
00072     :param buff: buffer, ``StringIO``
00073     """
00074     try:
00075       _x = self
00076       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00077       _x = self.header.frame_id
00078       length = len(_x)
00079       if python3 or type(_x) == unicode:
00080         _x = _x.encode('utf-8')
00081         length = len(_x)
00082       buff.write(struct.pack('<I%ss'%length, length, _x))
00083       length = len(self.data)
00084       buff.write(_struct_I.pack(length))
00085       for val1 in self.data:
00086         length = len(val1)
00087         if python3 or type(val1) == unicode:
00088           val1 = val1.encode('utf-8')
00089           length = len(val1)
00090         buff.write(struct.pack('<I%ss'%length, length, val1))
00091     except struct.error as se: self._check_types(se)
00092     except TypeError as te: self._check_types(te)
00093 
00094   def deserialize(self, str):
00095     """
00096     unpack serialized message in str into this message instance
00097     :param str: byte array of serialized message, ``str``
00098     """
00099     try:
00100       if self.header is None:
00101         self.header = std_msgs.msg.Header()
00102       end = 0
00103       _x = self
00104       start = end
00105       end += 12
00106       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00107       start = end
00108       end += 4
00109       (length,) = _struct_I.unpack(str[start:end])
00110       start = end
00111       end += length
00112       if python3:
00113         self.header.frame_id = str[start:end].decode('utf-8')
00114       else:
00115         self.header.frame_id = str[start:end]
00116       start = end
00117       end += 4
00118       (length,) = _struct_I.unpack(str[start:end])
00119       self.data = []
00120       for i in range(0, length):
00121         start = end
00122         end += 4
00123         (length,) = _struct_I.unpack(str[start:end])
00124         start = end
00125         end += length
00126         if python3:
00127           val1 = str[start:end].decode('utf-8')
00128         else:
00129           val1 = str[start:end]
00130         self.data.append(val1)
00131       return self
00132     except struct.error as e:
00133       raise genpy.DeserializationError(e) #most likely buffer underfill
00134 
00135 
00136   def serialize_numpy(self, buff, numpy):
00137     """
00138     serialize message with numpy array types into buffer
00139     :param buff: buffer, ``StringIO``
00140     :param numpy: numpy python module
00141     """
00142     try:
00143       _x = self
00144       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00145       _x = self.header.frame_id
00146       length = len(_x)
00147       if python3 or type(_x) == unicode:
00148         _x = _x.encode('utf-8')
00149         length = len(_x)
00150       buff.write(struct.pack('<I%ss'%length, length, _x))
00151       length = len(self.data)
00152       buff.write(_struct_I.pack(length))
00153       for val1 in self.data:
00154         length = len(val1)
00155         if python3 or type(val1) == unicode:
00156           val1 = val1.encode('utf-8')
00157           length = len(val1)
00158         buff.write(struct.pack('<I%ss'%length, length, val1))
00159     except struct.error as se: self._check_types(se)
00160     except TypeError as te: self._check_types(te)
00161 
00162   def deserialize_numpy(self, str, numpy):
00163     """
00164     unpack serialized message in str into this message instance using numpy for array types
00165     :param str: byte array of serialized message, ``str``
00166     :param numpy: numpy python module
00167     """
00168     try:
00169       if self.header is None:
00170         self.header = std_msgs.msg.Header()
00171       end = 0
00172       _x = self
00173       start = end
00174       end += 12
00175       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00176       start = end
00177       end += 4
00178       (length,) = _struct_I.unpack(str[start:end])
00179       start = end
00180       end += length
00181       if python3:
00182         self.header.frame_id = str[start:end].decode('utf-8')
00183       else:
00184         self.header.frame_id = str[start:end]
00185       start = end
00186       end += 4
00187       (length,) = _struct_I.unpack(str[start:end])
00188       self.data = []
00189       for i in range(0, length):
00190         start = end
00191         end += 4
00192         (length,) = _struct_I.unpack(str[start:end])
00193         start = end
00194         end += length
00195         if python3:
00196           val1 = str[start:end].decode('utf-8')
00197         else:
00198           val1 = str[start:end]
00199         self.data.append(val1)
00200       return self
00201     except struct.error as e:
00202       raise genpy.DeserializationError(e) #most likely buffer underfill
00203 
00204 _struct_I = genpy.struct_I
00205 _struct_3I = struct.Struct("<3I")


hrl_lib
Author(s): Cressel Anderson, Travis Deyle, Advait Jain, Hai Nguyen, Advisor: Prof. Charlie Kemp, Lab: Healthcare Robotics Lab at Georgia Tech
autogenerated on Wed Nov 27 2013 11:34:06