00001 """autogenerated by genpy from re_srvs/SetObjectBinaryFileRequest.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 re_msgs.msg
00008
00009 class SetObjectBinaryFileRequest(genpy.Message):
00010 _md5sum = "2e17582e3f8e71adc56b4d42a0ddd89e"
00011 _type = "re_srvs/SetObjectBinaryFileRequest"
00012 _has_header = False
00013 _full_text = """string objectUID
00014 re_msgs/File file
00015 string apiKey
00016
00017
00018 ================================================================================
00019 MSG: re_msgs/File
00020 # This file representation is used to pass binary data to the RoboEarthDB.
00021 # As the endianess isn't stored, only files with a byte order mark (BOM) or
00022 # an implicitly specified endianess should be transferred.
00023 string name # file name
00024 int8[] data # binary data
00025
00026 """
00027 __slots__ = ['objectUID','file','apiKey']
00028 _slot_types = ['string','re_msgs/File','string']
00029
00030 def __init__(self, *args, **kwds):
00031 """
00032 Constructor. Any message fields that are implicitly/explicitly
00033 set to None will be assigned a default value. The recommend
00034 use is keyword arguments as this is more robust to future message
00035 changes. You cannot mix in-order arguments and keyword arguments.
00036
00037 The available fields are:
00038 objectUID,file,apiKey
00039
00040 :param args: complete set of field values, in .msg order
00041 :param kwds: use keyword arguments corresponding to message field names
00042 to set specific fields.
00043 """
00044 if args or kwds:
00045 super(SetObjectBinaryFileRequest, self).__init__(*args, **kwds)
00046
00047 if self.objectUID is None:
00048 self.objectUID = ''
00049 if self.file is None:
00050 self.file = re_msgs.msg.File()
00051 if self.apiKey is None:
00052 self.apiKey = ''
00053 else:
00054 self.objectUID = ''
00055 self.file = re_msgs.msg.File()
00056 self.apiKey = ''
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, ``StringIO``
00068 """
00069 try:
00070 _x = self.objectUID
00071 length = len(_x)
00072 if python3 or type(_x) == unicode:
00073 _x = _x.encode('utf-8')
00074 length = len(_x)
00075 buff.write(struct.pack('<I%ss'%length, length, _x))
00076 _x = self.file.name
00077 length = len(_x)
00078 if python3 or type(_x) == unicode:
00079 _x = _x.encode('utf-8')
00080 length = len(_x)
00081 buff.write(struct.pack('<I%ss'%length, length, _x))
00082 length = len(self.file.data)
00083 buff.write(_struct_I.pack(length))
00084 pattern = '<%sb'%length
00085 buff.write(struct.pack(pattern, *self.file.data))
00086 _x = self.apiKey
00087 length = len(_x)
00088 if python3 or type(_x) == unicode:
00089 _x = _x.encode('utf-8')
00090 length = len(_x)
00091 buff.write(struct.pack('<I%ss'%length, length, _x))
00092 except struct.error as se: self._check_types(se)
00093 except TypeError as te: self._check_types(te)
00094
00095 def deserialize(self, str):
00096 """
00097 unpack serialized message in str into this message instance
00098 :param str: byte array of serialized message, ``str``
00099 """
00100 try:
00101 if self.file is None:
00102 self.file = re_msgs.msg.File()
00103 end = 0
00104 start = end
00105 end += 4
00106 (length,) = _struct_I.unpack(str[start:end])
00107 start = end
00108 end += length
00109 if python3:
00110 self.objectUID = str[start:end].decode('utf-8')
00111 else:
00112 self.objectUID = str[start:end]
00113 start = end
00114 end += 4
00115 (length,) = _struct_I.unpack(str[start:end])
00116 start = end
00117 end += length
00118 if python3:
00119 self.file.name = str[start:end].decode('utf-8')
00120 else:
00121 self.file.name = str[start:end]
00122 start = end
00123 end += 4
00124 (length,) = _struct_I.unpack(str[start:end])
00125 pattern = '<%sb'%length
00126 start = end
00127 end += struct.calcsize(pattern)
00128 self.file.data = struct.unpack(pattern, str[start:end])
00129 start = end
00130 end += 4
00131 (length,) = _struct_I.unpack(str[start:end])
00132 start = end
00133 end += length
00134 if python3:
00135 self.apiKey = str[start:end].decode('utf-8')
00136 else:
00137 self.apiKey = str[start:end]
00138 return self
00139 except struct.error as e:
00140 raise genpy.DeserializationError(e)
00141
00142
00143 def serialize_numpy(self, buff, numpy):
00144 """
00145 serialize message with numpy array types into buffer
00146 :param buff: buffer, ``StringIO``
00147 :param numpy: numpy python module
00148 """
00149 try:
00150 _x = self.objectUID
00151 length = len(_x)
00152 if python3 or type(_x) == unicode:
00153 _x = _x.encode('utf-8')
00154 length = len(_x)
00155 buff.write(struct.pack('<I%ss'%length, length, _x))
00156 _x = self.file.name
00157 length = len(_x)
00158 if python3 or type(_x) == unicode:
00159 _x = _x.encode('utf-8')
00160 length = len(_x)
00161 buff.write(struct.pack('<I%ss'%length, length, _x))
00162 length = len(self.file.data)
00163 buff.write(_struct_I.pack(length))
00164 pattern = '<%sb'%length
00165 buff.write(self.file.data.tostring())
00166 _x = self.apiKey
00167 length = len(_x)
00168 if python3 or type(_x) == unicode:
00169 _x = _x.encode('utf-8')
00170 length = len(_x)
00171 buff.write(struct.pack('<I%ss'%length, length, _x))
00172 except struct.error as se: self._check_types(se)
00173 except TypeError as te: self._check_types(te)
00174
00175 def deserialize_numpy(self, str, numpy):
00176 """
00177 unpack serialized message in str into this message instance using numpy for array types
00178 :param str: byte array of serialized message, ``str``
00179 :param numpy: numpy python module
00180 """
00181 try:
00182 if self.file is None:
00183 self.file = re_msgs.msg.File()
00184 end = 0
00185 start = end
00186 end += 4
00187 (length,) = _struct_I.unpack(str[start:end])
00188 start = end
00189 end += length
00190 if python3:
00191 self.objectUID = str[start:end].decode('utf-8')
00192 else:
00193 self.objectUID = str[start:end]
00194 start = end
00195 end += 4
00196 (length,) = _struct_I.unpack(str[start:end])
00197 start = end
00198 end += length
00199 if python3:
00200 self.file.name = str[start:end].decode('utf-8')
00201 else:
00202 self.file.name = str[start:end]
00203 start = end
00204 end += 4
00205 (length,) = _struct_I.unpack(str[start:end])
00206 pattern = '<%sb'%length
00207 start = end
00208 end += struct.calcsize(pattern)
00209 self.file.data = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=length)
00210 start = end
00211 end += 4
00212 (length,) = _struct_I.unpack(str[start:end])
00213 start = end
00214 end += length
00215 if python3:
00216 self.apiKey = str[start:end].decode('utf-8')
00217 else:
00218 self.apiKey = str[start:end]
00219 return self
00220 except struct.error as e:
00221 raise genpy.DeserializationError(e)
00222
00223 _struct_I = genpy.struct_I
00224 """autogenerated by genpy from re_srvs/SetObjectBinaryFileResponse.msg. Do not edit."""
00225 import sys
00226 python3 = True if sys.hexversion > 0x03000000 else False
00227 import genpy
00228 import struct
00229
00230
00231 class SetObjectBinaryFileResponse(genpy.Message):
00232 _md5sum = "358e233cde0c8a8bcfea4ce193f8fc15"
00233 _type = "re_srvs/SetObjectBinaryFileResponse"
00234 _has_header = False
00235 _full_text = """bool success
00236
00237
00238 """
00239 __slots__ = ['success']
00240 _slot_types = ['bool']
00241
00242 def __init__(self, *args, **kwds):
00243 """
00244 Constructor. Any message fields that are implicitly/explicitly
00245 set to None will be assigned a default value. The recommend
00246 use is keyword arguments as this is more robust to future message
00247 changes. You cannot mix in-order arguments and keyword arguments.
00248
00249 The available fields are:
00250 success
00251
00252 :param args: complete set of field values, in .msg order
00253 :param kwds: use keyword arguments corresponding to message field names
00254 to set specific fields.
00255 """
00256 if args or kwds:
00257 super(SetObjectBinaryFileResponse, self).__init__(*args, **kwds)
00258
00259 if self.success is None:
00260 self.success = False
00261 else:
00262 self.success = False
00263
00264 def _get_types(self):
00265 """
00266 internal API method
00267 """
00268 return self._slot_types
00269
00270 def serialize(self, buff):
00271 """
00272 serialize message into buffer
00273 :param buff: buffer, ``StringIO``
00274 """
00275 try:
00276 buff.write(_struct_B.pack(self.success))
00277 except struct.error as se: self._check_types(se)
00278 except TypeError as te: self._check_types(te)
00279
00280 def deserialize(self, str):
00281 """
00282 unpack serialized message in str into this message instance
00283 :param str: byte array of serialized message, ``str``
00284 """
00285 try:
00286 end = 0
00287 start = end
00288 end += 1
00289 (self.success,) = _struct_B.unpack(str[start:end])
00290 self.success = bool(self.success)
00291 return self
00292 except struct.error as e:
00293 raise genpy.DeserializationError(e)
00294
00295
00296 def serialize_numpy(self, buff, numpy):
00297 """
00298 serialize message with numpy array types into buffer
00299 :param buff: buffer, ``StringIO``
00300 :param numpy: numpy python module
00301 """
00302 try:
00303 buff.write(_struct_B.pack(self.success))
00304 except struct.error as se: self._check_types(se)
00305 except TypeError as te: self._check_types(te)
00306
00307 def deserialize_numpy(self, str, numpy):
00308 """
00309 unpack serialized message in str into this message instance using numpy for array types
00310 :param str: byte array of serialized message, ``str``
00311 :param numpy: numpy python module
00312 """
00313 try:
00314 end = 0
00315 start = end
00316 end += 1
00317 (self.success,) = _struct_B.unpack(str[start:end])
00318 self.success = bool(self.success)
00319 return self
00320 except struct.error as e:
00321 raise genpy.DeserializationError(e)
00322
00323 _struct_I = genpy.struct_I
00324 _struct_B = struct.Struct("<B")
00325 class SetObjectBinaryFile(object):
00326 _type = 're_srvs/SetObjectBinaryFile'
00327 _md5sum = '7808c6e49a19c0dc4fd0244bedf75931'
00328 _request_class = SetObjectBinaryFileRequest
00329 _response_class = SetObjectBinaryFileResponse