- return bt2.fields._create_from_ptr(field_ptr)
-
- @context_field.setter
- def context_field(self, context_field):
- context_field_ptr = None
-
- if context_field is not None:
- utils._check_type(context_field, bt2.fields._Field)
- context_field_ptr = context_field._ptr
-
- ret = native_bt.ctf_packet_set_context(self._ptr, context_field_ptr)
- utils._handle_ret(ret, "cannot set packet object's context field")
-
- def __eq__(self, other):
- if type(other) is not type(self):
- return False
-
- if self.addr == other.addr:
- return True
-
- self_props = (
- self.header_field,
- self.context_field,
- )
- other_props = (
- other.header_field,
- other.context_field,
- )
- return self_props == other_props
-
- def _copy(self, copy_func):
- cpy = self.stream.create_packet()
- cpy.header_field = copy_func(self.header_field)
- cpy.context_field = copy_func(self.context_field)
- return cpy
-
- def __copy__(self):
- return self._copy(copy.copy)
-
- def __deepcopy__(self, memo):
- cpy = self._copy(copy.deepcopy)
- memo[id(self)] = cpy
- return cpy