_WebEvent.py
Go to the documentation of this file.
1 """autogenerated by genpy from web_msgs/WebEvent.msg. Do not edit."""
2 import sys
3 python3 = True if sys.hexversion > 0x03000000 else False
4 import genpy
5 import struct
6 
7 
8 class WebEvent(genpy.Message):
9  _md5sum = "4f05e2e1608bf7d788fa5e654f805aeb"
10  _type = "web_msgs/WebEvent"
11  _has_header = False #flag to mark the presence of a Header object
12  _full_text = """string source # who or what triggered the event
13 string type # type of event (e.g. login, logout)
14 string data # any data about the event
15 """
16  __slots__ = ['source','type','data']
17  _slot_types = ['string','string','string']
18 
19  def __init__(self, *args, **kwds):
20  """
21  Constructor. Any message fields that are implicitly/explicitly
22  set to None will be assigned a default value. The recommend
23  use is keyword arguments as this is more robust to future message
24  changes. You cannot mix in-order arguments and keyword arguments.
25 
26  The available fields are:
27  source,type,data
28 
29  :param args: complete set of field values, in .msg order
30  :param kwds: use keyword arguments corresponding to message field names
31  to set specific fields.
32  """
33  if args or kwds:
34  super(WebEvent, self).__init__(*args, **kwds)
35  #message fields cannot be None, assign default values for those that are
36  if self.source is None:
37  self.source = ''
38  if self.type is None:
39  self.type = ''
40  if self.data is None:
41  self.data = ''
42  else:
43  self.source = ''
44  self.type = ''
45  self.data = ''
46 
47  def _get_types(self):
48  """
49  internal API method
50  """
51  return self._slot_types
52 
53  def serialize(self, buff):
54  """
55  serialize message into buffer
56  :param buff: buffer, ``StringIO``
57  """
58  try:
59  _x = self.source
60  length = len(_x)
61  if python3 or type(_x) == unicode:
62  _x = _x.encode('utf-8')
63  length = len(_x)
64  buff.write(struct.pack('<I%ss'%length, length, _x))
65  _x = self.type
66  length = len(_x)
67  if python3 or type(_x) == unicode:
68  _x = _x.encode('utf-8')
69  length = len(_x)
70  buff.write(struct.pack('<I%ss'%length, length, _x))
71  _x = self.data
72  length = len(_x)
73  if python3 or type(_x) == unicode:
74  _x = _x.encode('utf-8')
75  length = len(_x)
76  buff.write(struct.pack('<I%ss'%length, length, _x))
77  except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
78  except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
79 
80  def deserialize(self, str):
81  """
82  unpack serialized message in str into this message instance
83  :param str: byte array of serialized message, ``str``
84  """
85  try:
86  end = 0
87  start = end
88  end += 4
89  (length,) = _struct_I.unpack(str[start:end])
90  start = end
91  end += length
92  if python3:
93  self.source = str[start:end].decode('utf-8')
94  else:
95  self.source = str[start:end]
96  start = end
97  end += 4
98  (length,) = _struct_I.unpack(str[start:end])
99  start = end
100  end += length
101  if python3:
102  self.type = str[start:end].decode('utf-8')
103  else:
104  self.type = str[start:end]
105  start = end
106  end += 4
107  (length,) = _struct_I.unpack(str[start:end])
108  start = end
109  end += length
110  if python3:
111  self.data = str[start:end].decode('utf-8')
112  else:
113  self.data = str[start:end]
114  return self
115  except struct.error as e:
116  raise genpy.DeserializationError(e) #most likely buffer underfill
117 
118 
119  def serialize_numpy(self, buff, numpy):
120  """
121  serialize message with numpy array types into buffer
122  :param buff: buffer, ``StringIO``
123  :param numpy: numpy python module
124  """
125  try:
126  _x = self.source
127  length = len(_x)
128  if python3 or type(_x) == unicode:
129  _x = _x.encode('utf-8')
130  length = len(_x)
131  buff.write(struct.pack('<I%ss'%length, length, _x))
132  _x = self.type
133  length = len(_x)
134  if python3 or type(_x) == unicode:
135  _x = _x.encode('utf-8')
136  length = len(_x)
137  buff.write(struct.pack('<I%ss'%length, length, _x))
138  _x = self.data
139  length = len(_x)
140  if python3 or type(_x) == unicode:
141  _x = _x.encode('utf-8')
142  length = len(_x)
143  buff.write(struct.pack('<I%ss'%length, length, _x))
144  except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
145  except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
146 
147  def deserialize_numpy(self, str, numpy):
148  """
149  unpack serialized message in str into this message instance using numpy for array types
150  :param str: byte array of serialized message, ``str``
151  :param numpy: numpy python module
152  """
153  try:
154  end = 0
155  start = end
156  end += 4
157  (length,) = _struct_I.unpack(str[start:end])
158  start = end
159  end += length
160  if python3:
161  self.source = str[start:end].decode('utf-8')
162  else:
163  self.source = str[start:end]
164  start = end
165  end += 4
166  (length,) = _struct_I.unpack(str[start:end])
167  start = end
168  end += length
169  if python3:
170  self.type = str[start:end].decode('utf-8')
171  else:
172  self.type = str[start:end]
173  start = end
174  end += 4
175  (length,) = _struct_I.unpack(str[start:end])
176  start = end
177  end += length
178  if python3:
179  self.data = str[start:end].decode('utf-8')
180  else:
181  self.data = str[start:end]
182  return self
183  except struct.error as e:
184  raise genpy.DeserializationError(e) #most likely buffer underfill
185 
186 _struct_I = genpy.struct_I
def deserialize_numpy(self, str, numpy)
Definition: _WebEvent.py:147
def __init__(self, args, kwds)
Definition: _WebEvent.py:19
def serialize_numpy(self, buff, numpy)
Definition: _WebEvent.py:119


web_msgs
Author(s): Devon Ash
autogenerated on Mon Jun 10 2019 15:51:22