class QueryExecutor(object._SharedObject):
+ _get_ref = native_bt.query_executor_get_ref
+ _put_ref = native_bt.query_executor_put_ref
+
def _handle_status(self, status, gen_error_msg):
- if status == native_bt.QUERY_STATUS_AGAIN:
+ if status == native_bt.QUERY_EXECUTOR_STATUS_AGAIN:
raise bt2.TryAgain
- elif status == native_bt.QUERY_STATUS_EXECUTOR_CANCELED:
+ elif status == native_bt.QUERY_EXECUTOR_STATUS_CANCELED:
raise bt2.QueryExecutorCanceled
- elif status == native_bt.QUERY_STATUS_INVALID_OBJECT:
+ elif status == native_bt.QUERY_EXECUTOR_STATUS_INVALID_OBJECT:
raise bt2.InvalidQueryObject
- elif status == native_bt.QUERY_STATUS_INVALID_PARAMS:
+ elif status == native_bt.QUERY_EXECUTOR_STATUS_INVALID_PARAMS:
raise bt2.InvalidQueryParams
elif status < 0:
raise bt2.Error(gen_error_msg)
params = bt2.create_value(params)
params_ptr = params._ptr
- if isinstance(component_class, bt2.component._GenericComponentClass):
- cc_ptr = component_class._ptr
- else:
- cc_ptr = component_class._cc_ptr
+ cc_ptr = component_class._component_class_ptr()
status, result_ptr = native_bt.query_executor_query(self._ptr, cc_ptr,
object, params_ptr)