_time_srv.py
Go to the documentation of this file.
00001 """autogenerated by genpy from time_server/time_srvRequest.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 genpy
00008 
00009 class time_srvRequest(genpy.Message):
00010   _md5sum = "db8caddc76616a835ffc8fba07846605"
00011   _type = "time_server/time_srvRequest"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """
00014 time target
00015 
00016 """
00017   __slots__ = ['target']
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        target
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(time_srvRequest, self).__init__(*args, **kwds)
00036       #message fields cannot be None, assign default values for those that are
00037       if self.target is None:
00038         self.target = genpy.Time()
00039     else:
00040       self.target = genpy.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, ``StringIO``
00052     """
00053     try:
00054       _x = self
00055       buff.write(_struct_2I.pack(_x.target.secs, _x.target.nsecs))
00056     except struct.error as se: self._check_types(se)
00057     except TypeError as te: self._check_types(te)
00058 
00059   def deserialize(self, str):
00060     """
00061     unpack serialized message in str into this message instance
00062     :param str: byte array of serialized message, ``str``
00063     """
00064     try:
00065       if self.target is None:
00066         self.target = genpy.Time()
00067       end = 0
00068       _x = self
00069       start = end
00070       end += 8
00071       (_x.target.secs, _x.target.nsecs,) = _struct_2I.unpack(str[start:end])
00072       self.target.canon()
00073       return self
00074     except struct.error as e:
00075       raise genpy.DeserializationError(e) #most likely buffer underfill
00076 
00077 
00078   def serialize_numpy(self, buff, numpy):
00079     """
00080     serialize message with numpy array types into buffer
00081     :param buff: buffer, ``StringIO``
00082     :param numpy: numpy python module
00083     """
00084     try:
00085       _x = self
00086       buff.write(_struct_2I.pack(_x.target.secs, _x.target.nsecs))
00087     except struct.error as se: self._check_types(se)
00088     except TypeError as te: self._check_types(te)
00089 
00090   def deserialize_numpy(self, str, numpy):
00091     """
00092     unpack serialized message in str into this message instance using numpy for array types
00093     :param str: byte array of serialized message, ``str``
00094     :param numpy: numpy python module
00095     """
00096     try:
00097       if self.target is None:
00098         self.target = genpy.Time()
00099       end = 0
00100       _x = self
00101       start = end
00102       end += 8
00103       (_x.target.secs, _x.target.nsecs,) = _struct_2I.unpack(str[start:end])
00104       self.target.canon()
00105       return self
00106     except struct.error as e:
00107       raise genpy.DeserializationError(e) #most likely buffer underfill
00108 
00109 _struct_I = genpy.struct_I
00110 _struct_2I = struct.Struct("<2I")
00111 """autogenerated by genpy from time_server/time_srvResponse.msg. Do not edit."""
00112 import sys
00113 python3 = True if sys.hexversion > 0x03000000 else False
00114 import genpy
00115 import struct
00116 
00117 import genpy
00118 
00119 class time_srvResponse(genpy.Message):
00120   _md5sum = "795c9cfc64532fd454a7bf03ae978496"
00121   _type = "time_server/time_srvResponse"
00122   _has_header = False #flag to mark the presence of a Header object
00123   _full_text = """time actual
00124 duration delta
00125 
00126 """
00127   __slots__ = ['actual','delta']
00128   _slot_types = ['time','duration']
00129 
00130   def __init__(self, *args, **kwds):
00131     """
00132     Constructor. Any message fields that are implicitly/explicitly
00133     set to None will be assigned a default value. The recommend
00134     use is keyword arguments as this is more robust to future message
00135     changes.  You cannot mix in-order arguments and keyword arguments.
00136 
00137     The available fields are:
00138        actual,delta
00139 
00140     :param args: complete set of field values, in .msg order
00141     :param kwds: use keyword arguments corresponding to message field names
00142     to set specific fields.
00143     """
00144     if args or kwds:
00145       super(time_srvResponse, self).__init__(*args, **kwds)
00146       #message fields cannot be None, assign default values for those that are
00147       if self.actual is None:
00148         self.actual = genpy.Time()
00149       if self.delta is None:
00150         self.delta = genpy.Duration()
00151     else:
00152       self.actual = genpy.Time()
00153       self.delta = genpy.Duration()
00154 
00155   def _get_types(self):
00156     """
00157     internal API method
00158     """
00159     return self._slot_types
00160 
00161   def serialize(self, buff):
00162     """
00163     serialize message into buffer
00164     :param buff: buffer, ``StringIO``
00165     """
00166     try:
00167       _x = self
00168       buff.write(_struct_2I2i.pack(_x.actual.secs, _x.actual.nsecs, _x.delta.secs, _x.delta.nsecs))
00169     except struct.error as se: self._check_types(se)
00170     except TypeError as te: self._check_types(te)
00171 
00172   def deserialize(self, str):
00173     """
00174     unpack serialized message in str into this message instance
00175     :param str: byte array of serialized message, ``str``
00176     """
00177     try:
00178       if self.actual is None:
00179         self.actual = genpy.Time()
00180       if self.delta is None:
00181         self.delta = genpy.Duration()
00182       end = 0
00183       _x = self
00184       start = end
00185       end += 16
00186       (_x.actual.secs, _x.actual.nsecs, _x.delta.secs, _x.delta.nsecs,) = _struct_2I2i.unpack(str[start:end])
00187       self.actual.canon()
00188       self.delta.canon()
00189       return self
00190     except struct.error as e:
00191       raise genpy.DeserializationError(e) #most likely buffer underfill
00192 
00193 
00194   def serialize_numpy(self, buff, numpy):
00195     """
00196     serialize message with numpy array types into buffer
00197     :param buff: buffer, ``StringIO``
00198     :param numpy: numpy python module
00199     """
00200     try:
00201       _x = self
00202       buff.write(_struct_2I2i.pack(_x.actual.secs, _x.actual.nsecs, _x.delta.secs, _x.delta.nsecs))
00203     except struct.error as se: self._check_types(se)
00204     except TypeError as te: self._check_types(te)
00205 
00206   def deserialize_numpy(self, str, numpy):
00207     """
00208     unpack serialized message in str into this message instance using numpy for array types
00209     :param str: byte array of serialized message, ``str``
00210     :param numpy: numpy python module
00211     """
00212     try:
00213       if self.actual is None:
00214         self.actual = genpy.Time()
00215       if self.delta is None:
00216         self.delta = genpy.Duration()
00217       end = 0
00218       _x = self
00219       start = end
00220       end += 16
00221       (_x.actual.secs, _x.actual.nsecs, _x.delta.secs, _x.delta.nsecs,) = _struct_2I2i.unpack(str[start:end])
00222       self.actual.canon()
00223       self.delta.canon()
00224       return self
00225     except struct.error as e:
00226       raise genpy.DeserializationError(e) #most likely buffer underfill
00227 
00228 _struct_I = genpy.struct_I
00229 _struct_2I2i = struct.Struct("<2I2i")
00230 class time_srv(object):
00231   _type          = 'time_server/time_srv'
00232   _md5sum = '538088de2280801645bd68bcaa6d0173'
00233   _request_class  = time_srvRequest
00234   _response_class = time_srvResponse


time_server
Author(s): Jonathan Hasenzahl
autogenerated on Sun Jan 5 2014 11:12:28