_Dependency.py
Go to the documentation of this file.
00001 """autogenerated by genpy from stanford_parser_msgs/Dependency.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class Dependency(genpy.Message):
00009   _md5sum = "cdc828bde2cbc087845b7c347e45a5ee"
00010   _type = "stanford_parser_msgs/Dependency"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string relation
00013 int32 governor_index
00014 int32 dependent_index
00015 
00016 # TODO: put all the relations here
00017 """
00018   __slots__ = ['relation','governor_index','dependent_index']
00019   _slot_types = ['string','int32','int32']
00020 
00021   def __init__(self, *args, **kwds):
00022     """
00023     Constructor. Any message fields that are implicitly/explicitly
00024     set to None will be assigned a default value. The recommend
00025     use is keyword arguments as this is more robust to future message
00026     changes.  You cannot mix in-order arguments and keyword arguments.
00027 
00028     The available fields are:
00029        relation,governor_index,dependent_index
00030 
00031     :param args: complete set of field values, in .msg order
00032     :param kwds: use keyword arguments corresponding to message field names
00033     to set specific fields.
00034     """
00035     if args or kwds:
00036       super(Dependency, self).__init__(*args, **kwds)
00037       #message fields cannot be None, assign default values for those that are
00038       if self.relation is None:
00039         self.relation = ''
00040       if self.governor_index is None:
00041         self.governor_index = 0
00042       if self.dependent_index is None:
00043         self.dependent_index = 0
00044     else:
00045       self.relation = ''
00046       self.governor_index = 0
00047       self.dependent_index = 0
00048 
00049   def _get_types(self):
00050     """
00051     internal API method
00052     """
00053     return self._slot_types
00054 
00055   def serialize(self, buff):
00056     """
00057     serialize message into buffer
00058     :param buff: buffer, ``StringIO``
00059     """
00060     try:
00061       _x = self.relation
00062       length = len(_x)
00063       if python3 or type(_x) == unicode:
00064         _x = _x.encode('utf-8')
00065         length = len(_x)
00066       buff.write(struct.pack('<I%ss'%length, length, _x))
00067       _x = self
00068       buff.write(_struct_2i.pack(_x.governor_index, _x.dependent_index))
00069     except struct.error as se: self._check_types(se)
00070     except TypeError as te: self._check_types(te)
00071 
00072   def deserialize(self, str):
00073     """
00074     unpack serialized message in str into this message instance
00075     :param str: byte array of serialized message, ``str``
00076     """
00077     try:
00078       end = 0
00079       start = end
00080       end += 4
00081       (length,) = _struct_I.unpack(str[start:end])
00082       start = end
00083       end += length
00084       if python3:
00085         self.relation = str[start:end].decode('utf-8')
00086       else:
00087         self.relation = str[start:end]
00088       _x = self
00089       start = end
00090       end += 8
00091       (_x.governor_index, _x.dependent_index,) = _struct_2i.unpack(str[start:end])
00092       return self
00093     except struct.error as e:
00094       raise genpy.DeserializationError(e) #most likely buffer underfill
00095 
00096 
00097   def serialize_numpy(self, buff, numpy):
00098     """
00099     serialize message with numpy array types into buffer
00100     :param buff: buffer, ``StringIO``
00101     :param numpy: numpy python module
00102     """
00103     try:
00104       _x = self.relation
00105       length = len(_x)
00106       if python3 or type(_x) == unicode:
00107         _x = _x.encode('utf-8')
00108         length = len(_x)
00109       buff.write(struct.pack('<I%ss'%length, length, _x))
00110       _x = self
00111       buff.write(_struct_2i.pack(_x.governor_index, _x.dependent_index))
00112     except struct.error as se: self._check_types(se)
00113     except TypeError as te: self._check_types(te)
00114 
00115   def deserialize_numpy(self, str, numpy):
00116     """
00117     unpack serialized message in str into this message instance using numpy for array types
00118     :param str: byte array of serialized message, ``str``
00119     :param numpy: numpy python module
00120     """
00121     try:
00122       end = 0
00123       start = end
00124       end += 4
00125       (length,) = _struct_I.unpack(str[start:end])
00126       start = end
00127       end += length
00128       if python3:
00129         self.relation = str[start:end].decode('utf-8')
00130       else:
00131         self.relation = str[start:end]
00132       _x = self
00133       start = end
00134       end += 8
00135       (_x.governor_index, _x.dependent_index,) = _struct_2i.unpack(str[start:end])
00136       return self
00137     except struct.error as e:
00138       raise genpy.DeserializationError(e) #most likely buffer underfill
00139 
00140 _struct_I = genpy.struct_I
00141 _struct_2i = struct.Struct("<2i")


stanford_parser_msgs
Author(s): Brian Thomas
autogenerated on Fri Dec 6 2013 20:37:07