00001 """autogenerated by genmsg_py from Condition.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class Condition(roslib.message.Message):
00007 _md5sum = "44691f2aeb7a218e22c96feb085564c8"
00008 _type = "warehouse/Condition"
00009 _has_header = False
00010 _full_text = """# Represents an individual condition on a field in a query
00011
00012 # Field name, which can be nested. E.g., "pose.position.x"
00013 string field_name
00014
00015 # Predicate, which must be of one the types below
00016 uint8 predicate
00017
00018 # Predicate arguments, which are parsed from strings, in a predicate-dependent manner
00019 string[] args
00020
00021
00022 ## Predicate types
00023
00024 # numerical field must be less than args[0]
00025 uint8 LESS_THAN=0
00026
00027 # numerical field must be greater than args[0]
00028 uint8 GREATER_THAN=1
00029
00030 # field must equal args[0]
00031 uint8 EQUALS=2
00032 """
00033
00034 LESS_THAN = 0
00035 GREATER_THAN = 1
00036 EQUALS = 2
00037
00038 __slots__ = ['field_name','predicate','args']
00039 _slot_types = ['string','uint8','string[]']
00040
00041 def __init__(self, *args, **kwds):
00042 """
00043 Constructor. Any message fields that are implicitly/explicitly
00044 set to None will be assigned a default value. The recommend
00045 use is keyword arguments as this is more robust to future message
00046 changes. You cannot mix in-order arguments and keyword arguments.
00047
00048 The available fields are:
00049 field_name,predicate,args
00050
00051 @param args: complete set of field values, in .msg order
00052 @param kwds: use keyword arguments corresponding to message field names
00053 to set specific fields.
00054 """
00055 if args or kwds:
00056 super(Condition, self).__init__(*args, **kwds)
00057
00058 if self.field_name is None:
00059 self.field_name = ''
00060 if self.predicate is None:
00061 self.predicate = 0
00062 if self.args is None:
00063 self.args = []
00064 else:
00065 self.field_name = ''
00066 self.predicate = 0
00067 self.args = []
00068
00069 def _get_types(self):
00070 """
00071 internal API method
00072 """
00073 return self._slot_types
00074
00075 def serialize(self, buff):
00076 """
00077 serialize message into buffer
00078 @param buff: buffer
00079 @type buff: StringIO
00080 """
00081 try:
00082 _x = self.field_name
00083 length = len(_x)
00084 buff.write(struct.pack('<I%ss'%length, length, _x))
00085 buff.write(_struct_B.pack(self.predicate))
00086 length = len(self.args)
00087 buff.write(_struct_I.pack(length))
00088 for val1 in self.args:
00089 length = len(val1)
00090 buff.write(struct.pack('<I%ss'%length, length, val1))
00091 except struct.error, se: self._check_types(se)
00092 except TypeError, 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
00098 @type str: str
00099 """
00100 try:
00101 end = 0
00102 start = end
00103 end += 4
00104 (length,) = _struct_I.unpack(str[start:end])
00105 start = end
00106 end += length
00107 self.field_name = str[start:end]
00108 start = end
00109 end += 1
00110 (self.predicate,) = _struct_B.unpack(str[start:end])
00111 start = end
00112 end += 4
00113 (length,) = _struct_I.unpack(str[start:end])
00114 self.args = []
00115 for i in xrange(0, length):
00116 start = end
00117 end += 4
00118 (length,) = _struct_I.unpack(str[start:end])
00119 start = end
00120 end += length
00121 val1 = str[start:end]
00122 self.args.append(val1)
00123 return self
00124 except struct.error, e:
00125 raise roslib.message.DeserializationError(e)
00126
00127
00128 def serialize_numpy(self, buff, numpy):
00129 """
00130 serialize message with numpy array types into buffer
00131 @param buff: buffer
00132 @type buff: StringIO
00133 @param numpy: numpy python module
00134 @type numpy module
00135 """
00136 try:
00137 _x = self.field_name
00138 length = len(_x)
00139 buff.write(struct.pack('<I%ss'%length, length, _x))
00140 buff.write(_struct_B.pack(self.predicate))
00141 length = len(self.args)
00142 buff.write(_struct_I.pack(length))
00143 for val1 in self.args:
00144 length = len(val1)
00145 buff.write(struct.pack('<I%ss'%length, length, val1))
00146 except struct.error, se: self._check_types(se)
00147 except TypeError, te: self._check_types(te)
00148
00149 def deserialize_numpy(self, str, numpy):
00150 """
00151 unpack serialized message in str into this message instance using numpy for array types
00152 @param str: byte array of serialized message
00153 @type str: str
00154 @param numpy: numpy python module
00155 @type numpy: module
00156 """
00157 try:
00158 end = 0
00159 start = end
00160 end += 4
00161 (length,) = _struct_I.unpack(str[start:end])
00162 start = end
00163 end += length
00164 self.field_name = str[start:end]
00165 start = end
00166 end += 1
00167 (self.predicate,) = _struct_B.unpack(str[start:end])
00168 start = end
00169 end += 4
00170 (length,) = _struct_I.unpack(str[start:end])
00171 self.args = []
00172 for i in xrange(0, length):
00173 start = end
00174 end += 4
00175 (length,) = _struct_I.unpack(str[start:end])
00176 start = end
00177 end += length
00178 val1 = str[start:end]
00179 self.args.append(val1)
00180 return self
00181 except struct.error, e:
00182 raise roslib.message.DeserializationError(e)
00183
00184 _struct_I = roslib.message.struct_I
00185 _struct_B = struct.Struct("<B")