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