Go to the documentation of this file.00001 """autogenerated by genpy from gateway_comms/Rule.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 Rule(genpy.Message):
00009 _md5sum = "7a98759a4c27c4925840d27b3d7bcecb"
00010 _type = "gateway_comms/Rule"
00011 _has_header = False
00012 _full_text = """# Standard gateway connection rule
00013
00014 # type of connection (from gateway_comms.msg.Connection)
00015 string type
00016
00017 # this is the topic/service name or the action base name (a regex is supported)
00018 string name
00019
00020 # (optional) an optional node name can be provided. if node name is not provided
00021 # then all nodes are matched (also supports regex)
00022 string node
00023
00024 """
00025 __slots__ = ['type','name','node']
00026 _slot_types = ['string','string','string']
00027
00028 def __init__(self, *args, **kwds):
00029 """
00030 Constructor. Any message fields that are implicitly/explicitly
00031 set to None will be assigned a default value. The recommend
00032 use is keyword arguments as this is more robust to future message
00033 changes. You cannot mix in-order arguments and keyword arguments.
00034
00035 The available fields are:
00036 type,name,node
00037
00038 :param args: complete set of field values, in .msg order
00039 :param kwds: use keyword arguments corresponding to message field names
00040 to set specific fields.
00041 """
00042 if args or kwds:
00043 super(Rule, self).__init__(*args, **kwds)
00044
00045 if self.type is None:
00046 self.type = ''
00047 if self.name is None:
00048 self.name = ''
00049 if self.node is None:
00050 self.node = ''
00051 else:
00052 self.type = ''
00053 self.name = ''
00054 self.node = ''
00055
00056 def _get_types(self):
00057 """
00058 internal API method
00059 """
00060 return self._slot_types
00061
00062 def serialize(self, buff):
00063 """
00064 serialize message into buffer
00065 :param buff: buffer, ``StringIO``
00066 """
00067 try:
00068 _x = self.type
00069 length = len(_x)
00070 if python3 or type(_x) == unicode:
00071 _x = _x.encode('utf-8')
00072 length = len(_x)
00073 buff.write(struct.pack('<I%ss'%length, length, _x))
00074 _x = self.name
00075 length = len(_x)
00076 if python3 or type(_x) == unicode:
00077 _x = _x.encode('utf-8')
00078 length = len(_x)
00079 buff.write(struct.pack('<I%ss'%length, length, _x))
00080 _x = self.node
00081 length = len(_x)
00082 if python3 or type(_x) == unicode:
00083 _x = _x.encode('utf-8')
00084 length = len(_x)
00085 buff.write(struct.pack('<I%ss'%length, length, _x))
00086 except struct.error as se: self._check_types(se)
00087 except TypeError as te: self._check_types(te)
00088
00089 def deserialize(self, str):
00090 """
00091 unpack serialized message in str into this message instance
00092 :param str: byte array of serialized message, ``str``
00093 """
00094 try:
00095 end = 0
00096 start = end
00097 end += 4
00098 (length,) = _struct_I.unpack(str[start:end])
00099 start = end
00100 end += length
00101 if python3:
00102 self.type = str[start:end].decode('utf-8')
00103 else:
00104 self.type = str[start:end]
00105 start = end
00106 end += 4
00107 (length,) = _struct_I.unpack(str[start:end])
00108 start = end
00109 end += length
00110 if python3:
00111 self.name = str[start:end].decode('utf-8')
00112 else:
00113 self.name = str[start:end]
00114 start = end
00115 end += 4
00116 (length,) = _struct_I.unpack(str[start:end])
00117 start = end
00118 end += length
00119 if python3:
00120 self.node = str[start:end].decode('utf-8')
00121 else:
00122 self.node = str[start:end]
00123 return self
00124 except struct.error as e:
00125 raise genpy.DeserializationError(e)
00126
00127
00128 def serialize_numpy(self, buff, numpy):
00129 """
00130 serialize message with numpy array types into buffer
00131 :param buff: buffer, ``StringIO``
00132 :param numpy: numpy python module
00133 """
00134 try:
00135 _x = self.type
00136 length = len(_x)
00137 if python3 or type(_x) == unicode:
00138 _x = _x.encode('utf-8')
00139 length = len(_x)
00140 buff.write(struct.pack('<I%ss'%length, length, _x))
00141 _x = self.name
00142 length = len(_x)
00143 if python3 or type(_x) == unicode:
00144 _x = _x.encode('utf-8')
00145 length = len(_x)
00146 buff.write(struct.pack('<I%ss'%length, length, _x))
00147 _x = self.node
00148 length = len(_x)
00149 if python3 or type(_x) == unicode:
00150 _x = _x.encode('utf-8')
00151 length = len(_x)
00152 buff.write(struct.pack('<I%ss'%length, length, _x))
00153 except struct.error as se: self._check_types(se)
00154 except TypeError as te: self._check_types(te)
00155
00156 def deserialize_numpy(self, str, numpy):
00157 """
00158 unpack serialized message in str into this message instance using numpy for array types
00159 :param str: byte array of serialized message, ``str``
00160 :param numpy: numpy python module
00161 """
00162 try:
00163 end = 0
00164 start = end
00165 end += 4
00166 (length,) = _struct_I.unpack(str[start:end])
00167 start = end
00168 end += length
00169 if python3:
00170 self.type = str[start:end].decode('utf-8')
00171 else:
00172 self.type = str[start:end]
00173 start = end
00174 end += 4
00175 (length,) = _struct_I.unpack(str[start:end])
00176 start = end
00177 end += length
00178 if python3:
00179 self.name = str[start:end].decode('utf-8')
00180 else:
00181 self.name = str[start:end]
00182 start = end
00183 end += 4
00184 (length,) = _struct_I.unpack(str[start:end])
00185 start = end
00186 end += length
00187 if python3:
00188 self.node = str[start:end].decode('utf-8')
00189 else:
00190 self.node = str[start:end]
00191 return self
00192 except struct.error as e:
00193 raise genpy.DeserializationError(e)
00194
00195 _struct_I = genpy.struct_I