00001 """autogenerated by genmsg_py from FixedLengthArrayOfExternal.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 FixedLengthArrayOfExternal(roslib.message.Message):
00009 _md5sum = "cc431047757f431ecd2754e03aa592f8"
00010 _type = "test_roscpp_serialization/FixedLengthArrayOfExternal"
00011 _has_header = False
00012 _full_text = """# This comment has "quotes" in it and \slashes\
00013 rosgraph_msgs/Log[4] 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[4]']
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(FixedLengthArrayOfExternal, self).__init__(*args, **kwds)
00074
00075 if self.a is None:
00076 self.a = [rosgraph_msgs.msg.Log(),rosgraph_msgs.msg.Log(),rosgraph_msgs.msg.Log(),rosgraph_msgs.msg.Log()]
00077 else:
00078 self.a = [rosgraph_msgs.msg.Log(),rosgraph_msgs.msg.Log(),rosgraph_msgs.msg.Log(),rosgraph_msgs.msg.Log()]
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 for val1 in self.a:
00094 _v1 = val1.header
00095 buff.write(_struct_I.pack(_v1.seq))
00096 _v2 = _v1.stamp
00097 _x = _v2
00098 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00099 _x = _v1.frame_id
00100 length = len(_x)
00101 buff.write(struct.pack('<I%ss'%length, length, _x))
00102 buff.write(_struct_b.pack(val1.level))
00103 _x = val1.name
00104 length = len(_x)
00105 buff.write(struct.pack('<I%ss'%length, length, _x))
00106 _x = val1.msg
00107 length = len(_x)
00108 buff.write(struct.pack('<I%ss'%length, length, _x))
00109 _x = val1.file
00110 length = len(_x)
00111 buff.write(struct.pack('<I%ss'%length, length, _x))
00112 _x = val1.function
00113 length = len(_x)
00114 buff.write(struct.pack('<I%ss'%length, length, _x))
00115 buff.write(_struct_I.pack(val1.line))
00116 length = len(val1.topics)
00117 buff.write(_struct_I.pack(length))
00118 for val2 in val1.topics:
00119 length = len(val2)
00120 buff.write(struct.pack('<I%ss'%length, length, val2))
00121 except struct.error, se: self._check_types(se)
00122 except TypeError, te: self._check_types(te)
00123
00124 def deserialize(self, str):
00125 """
00126 unpack serialized message in str into this message instance
00127 @param str: byte array of serialized message
00128 @type str: str
00129 """
00130 try:
00131 end = 0
00132 self.a = []
00133 for i in xrange(0, 4):
00134 val1 = rosgraph_msgs.msg.Log()
00135 _v3 = val1.header
00136 start = end
00137 end += 4
00138 (_v3.seq,) = _struct_I.unpack(str[start:end])
00139 _v4 = _v3.stamp
00140 _x = _v4
00141 start = end
00142 end += 8
00143 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00144 start = end
00145 end += 4
00146 (length,) = _struct_I.unpack(str[start:end])
00147 start = end
00148 end += length
00149 _v3.frame_id = str[start:end]
00150 start = end
00151 end += 1
00152 (val1.level,) = _struct_b.unpack(str[start:end])
00153 start = end
00154 end += 4
00155 (length,) = _struct_I.unpack(str[start:end])
00156 start = end
00157 end += length
00158 val1.name = str[start:end]
00159 start = end
00160 end += 4
00161 (length,) = _struct_I.unpack(str[start:end])
00162 start = end
00163 end += length
00164 val1.msg = str[start:end]
00165 start = end
00166 end += 4
00167 (length,) = _struct_I.unpack(str[start:end])
00168 start = end
00169 end += length
00170 val1.file = str[start:end]
00171 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 start = end
00175 end += length
00176 val1.function = str[start:end]
00177 start = end
00178 end += 4
00179 (val1.line,) = _struct_I.unpack(str[start:end])
00180 start = end
00181 end += 4
00182 (length,) = _struct_I.unpack(str[start:end])
00183 val1.topics = []
00184 for i in xrange(0, length):
00185 start = end
00186 end += 4
00187 (length,) = _struct_I.unpack(str[start:end])
00188 start = end
00189 end += length
00190 val2 = str[start:end]
00191 val1.topics.append(val2)
00192 self.a.append(val1)
00193 return self
00194 except struct.error, e:
00195 raise roslib.message.DeserializationError(e)
00196
00197
00198 def serialize_numpy(self, buff, numpy):
00199 """
00200 serialize message with numpy array types into buffer
00201 @param buff: buffer
00202 @type buff: StringIO
00203 @param numpy: numpy python module
00204 @type numpy module
00205 """
00206 try:
00207 for val1 in self.a:
00208 _v5 = val1.header
00209 buff.write(_struct_I.pack(_v5.seq))
00210 _v6 = _v5.stamp
00211 _x = _v6
00212 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00213 _x = _v5.frame_id
00214 length = len(_x)
00215 buff.write(struct.pack('<I%ss'%length, length, _x))
00216 buff.write(_struct_b.pack(val1.level))
00217 _x = val1.name
00218 length = len(_x)
00219 buff.write(struct.pack('<I%ss'%length, length, _x))
00220 _x = val1.msg
00221 length = len(_x)
00222 buff.write(struct.pack('<I%ss'%length, length, _x))
00223 _x = val1.file
00224 length = len(_x)
00225 buff.write(struct.pack('<I%ss'%length, length, _x))
00226 _x = val1.function
00227 length = len(_x)
00228 buff.write(struct.pack('<I%ss'%length, length, _x))
00229 buff.write(_struct_I.pack(val1.line))
00230 length = len(val1.topics)
00231 buff.write(_struct_I.pack(length))
00232 for val2 in val1.topics:
00233 length = len(val2)
00234 buff.write(struct.pack('<I%ss'%length, length, val2))
00235 except struct.error, se: self._check_types(se)
00236 except TypeError, te: self._check_types(te)
00237
00238 def deserialize_numpy(self, str, numpy):
00239 """
00240 unpack serialized message in str into this message instance using numpy for array types
00241 @param str: byte array of serialized message
00242 @type str: str
00243 @param numpy: numpy python module
00244 @type numpy: module
00245 """
00246 try:
00247 end = 0
00248 self.a = []
00249 for i in xrange(0, 4):
00250 val1 = rosgraph_msgs.msg.Log()
00251 _v7 = val1.header
00252 start = end
00253 end += 4
00254 (_v7.seq,) = _struct_I.unpack(str[start:end])
00255 _v8 = _v7.stamp
00256 _x = _v8
00257 start = end
00258 end += 8
00259 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00260 start = end
00261 end += 4
00262 (length,) = _struct_I.unpack(str[start:end])
00263 start = end
00264 end += length
00265 _v7.frame_id = str[start:end]
00266 start = end
00267 end += 1
00268 (val1.level,) = _struct_b.unpack(str[start:end])
00269 start = end
00270 end += 4
00271 (length,) = _struct_I.unpack(str[start:end])
00272 start = end
00273 end += length
00274 val1.name = str[start:end]
00275 start = end
00276 end += 4
00277 (length,) = _struct_I.unpack(str[start:end])
00278 start = end
00279 end += length
00280 val1.msg = str[start:end]
00281 start = end
00282 end += 4
00283 (length,) = _struct_I.unpack(str[start:end])
00284 start = end
00285 end += length
00286 val1.file = str[start:end]
00287 start = end
00288 end += 4
00289 (length,) = _struct_I.unpack(str[start:end])
00290 start = end
00291 end += length
00292 val1.function = str[start:end]
00293 start = end
00294 end += 4
00295 (val1.line,) = _struct_I.unpack(str[start:end])
00296 start = end
00297 end += 4
00298 (length,) = _struct_I.unpack(str[start:end])
00299 val1.topics = []
00300 for i in xrange(0, length):
00301 start = end
00302 end += 4
00303 (length,) = _struct_I.unpack(str[start:end])
00304 start = end
00305 end += length
00306 val2 = str[start:end]
00307 val1.topics.append(val2)
00308 self.a.append(val1)
00309 return self
00310 except struct.error, e:
00311 raise roslib.message.DeserializationError(e)
00312
00313 _struct_I = roslib.message.struct_I
00314 _struct_b = struct.Struct("<b")
00315 _struct_2I = struct.Struct("<2I")