00001 """autogenerated by genmsg_py from UpdateNotification.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class UpdateNotification(roslib.message.Message):
00007 _md5sum = "9c55c20e6f692ac1b71cfd0548a7ecba"
00008 _type = "warehouse/UpdateNotification"
00009 _has_header = False
00010 _full_text = """## Represents an update to a warehouse collection
00011
00012 int8 NEW_MESSAGE=0
00013 int8 UPDATE_METADATA=1
00014
00015 # Is this a new message or an update?
00016 int8 update_type
00017
00018 # A unique id (within the db) for the new or updated message
00019 string id
00020
00021 # The fully qualified ROS name of the node that caused this change
00022 string sender
00023
00024 # Metadata of the new or updated message
00025 string metadata
00026
00027 """
00028
00029 NEW_MESSAGE = 0
00030 UPDATE_METADATA = 1
00031
00032 __slots__ = ['update_type','id','sender','metadata']
00033 _slot_types = ['int8','string','string','string']
00034
00035 def __init__(self, *args, **kwds):
00036 """
00037 Constructor. Any message fields that are implicitly/explicitly
00038 set to None will be assigned a default value. The recommend
00039 use is keyword arguments as this is more robust to future message
00040 changes. You cannot mix in-order arguments and keyword arguments.
00041
00042 The available fields are:
00043 update_type,id,sender,metadata
00044
00045 @param args: complete set of field values, in .msg order
00046 @param kwds: use keyword arguments corresponding to message field names
00047 to set specific fields.
00048 """
00049 if args or kwds:
00050 super(UpdateNotification, self).__init__(*args, **kwds)
00051
00052 if self.update_type is None:
00053 self.update_type = 0
00054 if self.id is None:
00055 self.id = ''
00056 if self.sender is None:
00057 self.sender = ''
00058 if self.metadata is None:
00059 self.metadata = ''
00060 else:
00061 self.update_type = 0
00062 self.id = ''
00063 self.sender = ''
00064 self.metadata = ''
00065
00066 def _get_types(self):
00067 """
00068 internal API method
00069 """
00070 return self._slot_types
00071
00072 def serialize(self, buff):
00073 """
00074 serialize message into buffer
00075 @param buff: buffer
00076 @type buff: StringIO
00077 """
00078 try:
00079 buff.write(_struct_b.pack(self.update_type))
00080 _x = self.id
00081 length = len(_x)
00082 buff.write(struct.pack('<I%ss'%length, length, _x))
00083 _x = self.sender
00084 length = len(_x)
00085 buff.write(struct.pack('<I%ss'%length, length, _x))
00086 _x = self.metadata
00087 length = len(_x)
00088 buff.write(struct.pack('<I%ss'%length, length, _x))
00089 except struct.error, se: self._check_types(se)
00090 except TypeError, te: self._check_types(te)
00091
00092 def deserialize(self, str):
00093 """
00094 unpack serialized message in str into this message instance
00095 @param str: byte array of serialized message
00096 @type str: str
00097 """
00098 try:
00099 end = 0
00100 start = end
00101 end += 1
00102 (self.update_type,) = _struct_b.unpack(str[start:end])
00103 start = end
00104 end += 4
00105 (length,) = _struct_I.unpack(str[start:end])
00106 start = end
00107 end += length
00108 self.id = str[start:end]
00109 start = end
00110 end += 4
00111 (length,) = _struct_I.unpack(str[start:end])
00112 start = end
00113 end += length
00114 self.sender = str[start:end]
00115 start = end
00116 end += 4
00117 (length,) = _struct_I.unpack(str[start:end])
00118 start = end
00119 end += length
00120 self.metadata = str[start:end]
00121 return self
00122 except struct.error, e:
00123 raise roslib.message.DeserializationError(e)
00124
00125
00126 def serialize_numpy(self, buff, numpy):
00127 """
00128 serialize message with numpy array types into buffer
00129 @param buff: buffer
00130 @type buff: StringIO
00131 @param numpy: numpy python module
00132 @type numpy module
00133 """
00134 try:
00135 buff.write(_struct_b.pack(self.update_type))
00136 _x = self.id
00137 length = len(_x)
00138 buff.write(struct.pack('<I%ss'%length, length, _x))
00139 _x = self.sender
00140 length = len(_x)
00141 buff.write(struct.pack('<I%ss'%length, length, _x))
00142 _x = self.metadata
00143 length = len(_x)
00144 buff.write(struct.pack('<I%ss'%length, length, _x))
00145 except struct.error, se: self._check_types(se)
00146 except TypeError, te: self._check_types(te)
00147
00148 def deserialize_numpy(self, str, numpy):
00149 """
00150 unpack serialized message in str into this message instance using numpy for array types
00151 @param str: byte array of serialized message
00152 @type str: str
00153 @param numpy: numpy python module
00154 @type numpy: module
00155 """
00156 try:
00157 end = 0
00158 start = end
00159 end += 1
00160 (self.update_type,) = _struct_b.unpack(str[start:end])
00161 start = end
00162 end += 4
00163 (length,) = _struct_I.unpack(str[start:end])
00164 start = end
00165 end += length
00166 self.id = str[start:end]
00167 start = end
00168 end += 4
00169 (length,) = _struct_I.unpack(str[start:end])
00170 start = end
00171 end += length
00172 self.sender = str[start:end]
00173 start = end
00174 end += 4
00175 (length,) = _struct_I.unpack(str[start:end])
00176 start = end
00177 end += length
00178 self.metadata = str[start:end]
00179 return self
00180 except struct.error, e:
00181 raise roslib.message.DeserializationError(e)
00182
00183 _struct_I = roslib.message.struct_I
00184 _struct_b = struct.Struct("<b")