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