00001 """autogenerated by genmsg_py from Clock.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import roslib.rostime
00006
00007 class Clock(roslib.message.Message):
00008 _md5sum = "a9c97c1d230cfc112e270351a944ee47"
00009 _type = "rosgraph_msgs/Clock"
00010 _has_header = False
00011 _full_text = """# roslib/Clock is used for publishing simulated time in ROS.
00012 # This message simply communicates the current time.
00013 # For more information, see http://www.ros.org/wiki/Clock
00014 time clock
00015
00016 """
00017 __slots__ = ['clock']
00018 _slot_types = ['time']
00019
00020 def __init__(self, *args, **kwds):
00021 """
00022 Constructor. Any message fields that are implicitly/explicitly
00023 set to None will be assigned a default value. The recommend
00024 use is keyword arguments as this is more robust to future message
00025 changes. You cannot mix in-order arguments and keyword arguments.
00026
00027 The available fields are:
00028 clock
00029
00030 @param args: complete set of field values, in .msg order
00031 @param kwds: use keyword arguments corresponding to message field names
00032 to set specific fields.
00033 """
00034 if args or kwds:
00035 super(Clock, self).__init__(*args, **kwds)
00036
00037 if self.clock is None:
00038 self.clock = roslib.rostime.Time()
00039 else:
00040 self.clock = roslib.rostime.Time()
00041
00042 def _get_types(self):
00043 """
00044 internal API method
00045 """
00046 return self._slot_types
00047
00048 def serialize(self, buff):
00049 """
00050 serialize message into buffer
00051 @param buff: buffer
00052 @type buff: StringIO
00053 """
00054 try:
00055 _x = self
00056 buff.write(_struct_2I.pack(_x.clock.secs, _x.clock.nsecs))
00057 except struct.error, se: self._check_types(se)
00058 except TypeError, te: self._check_types(te)
00059
00060 def deserialize(self, str):
00061 """
00062 unpack serialized message in str into this message instance
00063 @param str: byte array of serialized message
00064 @type str: str
00065 """
00066 try:
00067 if self.clock is None:
00068 self.clock = roslib.rostime.Time()
00069 end = 0
00070 _x = self
00071 start = end
00072 end += 8
00073 (_x.clock.secs, _x.clock.nsecs,) = _struct_2I.unpack(str[start:end])
00074 self.clock.canon()
00075 return self
00076 except struct.error, e:
00077 raise roslib.message.DeserializationError(e)
00078
00079
00080 def serialize_numpy(self, buff, numpy):
00081 """
00082 serialize message with numpy array types into buffer
00083 @param buff: buffer
00084 @type buff: StringIO
00085 @param numpy: numpy python module
00086 @type numpy module
00087 """
00088 try:
00089 _x = self
00090 buff.write(_struct_2I.pack(_x.clock.secs, _x.clock.nsecs))
00091 except struct.error, se: self._check_types(se)
00092 except TypeError, te: self._check_types(te)
00093
00094 def deserialize_numpy(self, str, numpy):
00095 """
00096 unpack serialized message in str into this message instance using numpy for array types
00097 @param str: byte array of serialized message
00098 @type str: str
00099 @param numpy: numpy python module
00100 @type numpy: module
00101 """
00102 try:
00103 if self.clock is None:
00104 self.clock = roslib.rostime.Time()
00105 end = 0
00106 _x = self
00107 start = end
00108 end += 8
00109 (_x.clock.secs, _x.clock.nsecs,) = _struct_2I.unpack(str[start:end])
00110 self.clock.canon()
00111 return self
00112 except struct.error, e:
00113 raise roslib.message.DeserializationError(e)
00114
00115 _struct_I = roslib.message.struct_I
00116 _struct_2I = struct.Struct("<2I")