00001 """autogenerated by genmsg_py from VariableLengthArrayOfExternal.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import std_msgs.msg
00006 import rosgraph_msgs.msg
00007
00008 class VariableLengthArrayOfExternal(roslib.message.Message):
00009 _md5sum = "cc431047757f431ecd2754e03aa592f8"
00010 _type = "test_roscpp_serialization/VariableLengthArrayOfExternal"
00011 _has_header = False
00012 _full_text = """# This comment has "quotes" in it
00013 rosgraph_msgs/Log[] a
00014 ================================================================================
00015 MSG: rosgraph_msgs/Log
00016 ##
00017 ## Severity level constants
00018 ##
00019 byte DEBUG=1 #debug level
00020 byte INFO=2 #general level
00021 byte WARN=4 #warning level
00022 byte ERROR=8 #error level
00023 byte FATAL=16 #fatal/critical level
00024 ##
00025 ## Fields
00026 ##
00027 Header header
00028 byte level
00029 string name # name of the node
00030 string msg # message
00031 string file # file the message came from
00032 string function # function the message came from
00033 uint32 line # line the message came from
00034 string[] topics # topic names that the node publishes
00035
00036 ================================================================================
00037 MSG: std_msgs/Header
00038 # Standard metadata for higher-level stamped data types.
00039 # This is generally used to communicate timestamped data
00040 # in a particular coordinate frame.
00041 #
00042 # sequence ID: consecutively increasing ID
00043 uint32 seq
00044 #Two-integer timestamp that is expressed as:
00045 # * stamp.secs: seconds (stamp_secs) since epoch
00046 # * stamp.nsecs: nanoseconds since stamp_secs
00047 # time-handling sugar is provided by the client library
00048 time stamp
00049 #Frame this data is associated with
00050 # 0: no frame
00051 # 1: global frame
00052 string frame_id
00053
00054 """
00055 __slots__ = ['a']
00056 _slot_types = ['rosgraph_msgs/Log[]']
00057
00058 def __init__(self, *args, **kwds):
00059 """
00060 Constructor. Any message fields that are implicitly/explicitly
00061 set to None will be assigned a default value. The recommend
00062 use is keyword arguments as this is more robust to future message
00063 changes. You cannot mix in-order arguments and keyword arguments.
00064
00065 The available fields are:
00066 a
00067
00068 @param args: complete set of field values, in .msg order
00069 @param kwds: use keyword arguments corresponding to message field names
00070 to set specific fields.
00071 """
00072 if args or kwds:
00073 super(VariableLengthArrayOfExternal, self).__init__(*args, **kwds)
00074
00075 if self.a is None:
00076 self.a = []
00077 else:
00078 self.a = []
00079
00080 def _get_types(self):
00081 """
00082 internal API method
00083 """
00084 return self._slot_types
00085
00086 def serialize(self, buff):
00087 """
00088 serialize message into buffer
00089 @param buff: buffer
00090 @type buff: StringIO
00091 """
00092 try:
00093 length = len(self.a)
00094 buff.write(_struct_I.pack(length))
00095 for val1 in self.a:
00096 _v1 = val1.header
00097 buff.write(_struct_I.pack(_v1.seq))
00098 _v2 = _v1.stamp
00099 _x = _v2
00100 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00101 _x = _v1.frame_id
00102 length = len(_x)
00103 buff.write(struct.pack('<I%ss'%length, length, _x))
00104 buff.write(_struct_b.pack(val1.level))
00105 _x = val1.name
00106 length = len(_x)
00107 buff.write(struct.pack('<I%ss'%length, length, _x))
00108 _x = val1.msg
00109 length = len(_x)
00110 buff.write(struct.pack('<I%ss'%length, length, _x))
00111 _x = val1.file
00112 length = len(_x)
00113 buff.write(struct.pack('<I%ss'%length, length, _x))
00114 _x = val1.function
00115 length = len(_x)
00116 buff.write(struct.pack('<I%ss'%length, length, _x))
00117 buff.write(_struct_I.pack(val1.line))
00118 length = len(val1.topics)
00119 buff.write(_struct_I.pack(length))
00120 for val2 in val1.topics:
00121 length = len(val2)
00122 buff.write(struct.pack('<I%ss'%length, length, val2))
00123 except struct.error, se: self._check_types(se)
00124 except TypeError, te: self._check_types(te)
00125
00126 def deserialize(self, str):
00127 """
00128 unpack serialized message in str into this message instance
00129 @param str: byte array of serialized message
00130 @type str: str
00131 """
00132 try:
00133 end = 0
00134 start = end
00135 end += 4
00136 (length,) = _struct_I.unpack(str[start:end])
00137 self.a = []
00138 for i in xrange(0, length):
00139 val1 = rosgraph_msgs.msg.Log()
00140 _v3 = val1.header
00141 start = end
00142 end += 4
00143 (_v3.seq,) = _struct_I.unpack(str[start:end])
00144 _v4 = _v3.stamp
00145 _x = _v4
00146 start = end
00147 end += 8
00148 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00149 start = end
00150 end += 4
00151 (length,) = _struct_I.unpack(str[start:end])
00152 start = end
00153 end += length
00154 _v3.frame_id = str[start:end]
00155 start = end
00156 end += 1
00157 (val1.level,) = _struct_b.unpack(str[start:end])
00158 start = end
00159 end += 4
00160 (length,) = _struct_I.unpack(str[start:end])
00161 start = end
00162 end += length
00163 val1.name = str[start:end]
00164 start = end
00165 end += 4
00166 (length,) = _struct_I.unpack(str[start:end])
00167 start = end
00168 end += length
00169 val1.msg = str[start:end]
00170 start = end
00171 end += 4
00172 (length,) = _struct_I.unpack(str[start:end])
00173 start = end
00174 end += length
00175 val1.file = str[start:end]
00176 start = end
00177 end += 4
00178 (length,) = _struct_I.unpack(str[start:end])
00179 start = end
00180 end += length
00181 val1.function = str[start:end]
00182 start = end
00183 end += 4
00184 (val1.line,) = _struct_I.unpack(str[start:end])
00185 start = end
00186 end += 4
00187 (length,) = _struct_I.unpack(str[start:end])
00188 val1.topics = []
00189 for i in xrange(0, length):
00190 start = end
00191 end += 4
00192 (length,) = _struct_I.unpack(str[start:end])
00193 start = end
00194 end += length
00195 val2 = str[start:end]
00196 val1.topics.append(val2)
00197 self.a.append(val1)
00198 return self
00199 except struct.error, e:
00200 raise roslib.message.DeserializationError(e)
00201
00202
00203 def serialize_numpy(self, buff, numpy):
00204 """
00205 serialize message with numpy array types into buffer
00206 @param buff: buffer
00207 @type buff: StringIO
00208 @param numpy: numpy python module
00209 @type numpy module
00210 """
00211 try:
00212 length = len(self.a)
00213 buff.write(_struct_I.pack(length))
00214 for val1 in self.a:
00215 _v5 = val1.header
00216 buff.write(_struct_I.pack(_v5.seq))
00217 _v6 = _v5.stamp
00218 _x = _v6
00219 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00220 _x = _v5.frame_id
00221 length = len(_x)
00222 buff.write(struct.pack('<I%ss'%length, length, _x))
00223 buff.write(_struct_b.pack(val1.level))
00224 _x = val1.name
00225 length = len(_x)
00226 buff.write(struct.pack('<I%ss'%length, length, _x))
00227 _x = val1.msg
00228 length = len(_x)
00229 buff.write(struct.pack('<I%ss'%length, length, _x))
00230 _x = val1.file
00231 length = len(_x)
00232 buff.write(struct.pack('<I%ss'%length, length, _x))
00233 _x = val1.function
00234 length = len(_x)
00235 buff.write(struct.pack('<I%ss'%length, length, _x))
00236 buff.write(_struct_I.pack(val1.line))
00237 length = len(val1.topics)
00238 buff.write(_struct_I.pack(length))
00239 for val2 in val1.topics:
00240 length = len(val2)
00241 buff.write(struct.pack('<I%ss'%length, length, val2))
00242 except struct.error, se: self._check_types(se)
00243 except TypeError, te: self._check_types(te)
00244
00245 def deserialize_numpy(self, str, numpy):
00246 """
00247 unpack serialized message in str into this message instance using numpy for array types
00248 @param str: byte array of serialized message
00249 @type str: str
00250 @param numpy: numpy python module
00251 @type numpy: module
00252 """
00253 try:
00254 end = 0
00255 start = end
00256 end += 4
00257 (length,) = _struct_I.unpack(str[start:end])
00258 self.a = []
00259 for i in xrange(0, length):
00260 val1 = rosgraph_msgs.msg.Log()
00261 _v7 = val1.header
00262 start = end
00263 end += 4
00264 (_v7.seq,) = _struct_I.unpack(str[start:end])
00265 _v8 = _v7.stamp
00266 _x = _v8
00267 start = end
00268 end += 8
00269 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00270 start = end
00271 end += 4
00272 (length,) = _struct_I.unpack(str[start:end])
00273 start = end
00274 end += length
00275 _v7.frame_id = str[start:end]
00276 start = end
00277 end += 1
00278 (val1.level,) = _struct_b.unpack(str[start:end])
00279 start = end
00280 end += 4
00281 (length,) = _struct_I.unpack(str[start:end])
00282 start = end
00283 end += length
00284 val1.name = str[start:end]
00285 start = end
00286 end += 4
00287 (length,) = _struct_I.unpack(str[start:end])
00288 start = end
00289 end += length
00290 val1.msg = str[start:end]
00291 start = end
00292 end += 4
00293 (length,) = _struct_I.unpack(str[start:end])
00294 start = end
00295 end += length
00296 val1.file = str[start:end]
00297 start = end
00298 end += 4
00299 (length,) = _struct_I.unpack(str[start:end])
00300 start = end
00301 end += length
00302 val1.function = str[start:end]
00303 start = end
00304 end += 4
00305 (val1.line,) = _struct_I.unpack(str[start:end])
00306 start = end
00307 end += 4
00308 (length,) = _struct_I.unpack(str[start:end])
00309 val1.topics = []
00310 for i in xrange(0, length):
00311 start = end
00312 end += 4
00313 (length,) = _struct_I.unpack(str[start:end])
00314 start = end
00315 end += length
00316 val2 = str[start:end]
00317 val1.topics.append(val2)
00318 self.a.append(val1)
00319 return self
00320 except struct.error, e:
00321 raise roslib.message.DeserializationError(e)
00322
00323 _struct_I = roslib.message.struct_I
00324 _struct_b = struct.Struct("<b")
00325 _struct_2I = struct.Struct("<2I")