typedef bt_component_class_init_method_status
(*bt_component_class_filter_init_method)(
bt_self_component_filter *self_component,
+ bt_self_component_filter_configuration *config,
const bt_value *params, void *init_method_data);
typedef void (*bt_component_class_filter_finalize_method)(
typedef bt_component_class_init_method_status
(*bt_component_class_sink_init_method)(
bt_self_component_sink *self_component,
+ bt_self_component_sink_configuration *config,
const bt_value *params, void *init_method_data);
typedef void (*bt_component_class_sink_finalize_method)(
typedef bt_component_class_init_method_status
(*bt_component_class_source_init_method)(
bt_self_component_source *self_component,
+ bt_self_component_source_configuration *config,
const bt_value *params, void *init_method_data);
typedef void (*bt_component_class_source_finalize_method)(
typedef struct bt_self_component_class_sink bt_self_component_class_sink;
typedef struct bt_self_component_class_source bt_self_component_class_source;
typedef struct bt_self_component_filter bt_self_component_filter;
+typedef struct bt_self_component_filter_configuration bt_self_component_filter_configuration;
typedef struct bt_self_component_port bt_self_component_port;
typedef struct bt_self_component_port_input bt_self_component_port_input;
typedef struct bt_self_component_port_input_message_iterator bt_self_component_port_input_message_iterator;
typedef struct bt_self_component_port_output bt_self_component_port_output;
typedef struct bt_self_component_sink bt_self_component_sink;
+typedef struct bt_self_component_sink_configuration bt_self_component_sink_configuration;
typedef struct bt_self_component_source bt_self_component_source;
+typedef struct bt_self_component_source_configuration bt_self_component_source_configuration;
typedef struct bt_self_message_iterator bt_self_message_iterator;
typedef struct bt_self_plugin bt_self_plugin;
typedef struct bt_stream bt_stream;
# create instance, not user-initialized yet
self = cls.__new__(cls)
+ # config object
+ config = cls._config_pycls()
+
# pointer to native self component object (weak/borrowed)
self._bt_ptr = comp_ptr
else:
params = None
- self.__init__(params, obj)
+ self.__init__(config, params, obj)
return self
def __call__(cls, *args, **kwargs):
native_bt.bt2_unregister_cc_ptr_to_py_cls(cc_ptr)
+# Configuration objects for components.
+#
+# These are passed in __init__ to allow components to change some configuration
+# parameters during initialization and not after. As you can see, they are not
+# used at the moment, but are there in case we want to add such parameters.
+
+
+class _UserComponentConfiguration:
+ pass
+
+
+class _UserSourceComponentConfiguration(_UserComponentConfiguration):
+ pass
+
+
+class _UserFilterComponentConfiguration(_UserComponentConfiguration):
+ pass
+
+
+class _UserSinkComponentConfiguration(_UserComponentConfiguration):
+ pass
+
+
# Subclasses must provide these methods or property:
#
# - _bt_as_not_self_specific_component_ptr: static method, must return the passed
ptr = self._bt_as_self_component_ptr(self._bt_ptr)
return native_bt.self_component_get_graph_mip_version(ptr)
- def __init__(self, params=None, obj=None):
+ def __init__(self, config, params, obj):
pass
def _user_finalize(self):
_bt_as_self_component_ptr = staticmethod(
native_bt.self_component_source_as_self_component
)
+ _config_pycls = _UserSourceComponentConfiguration
@property
def _output_ports(self):
_bt_as_self_component_ptr = staticmethod(
native_bt.self_component_filter_as_self_component
)
+ _config_pycls = _UserFilterComponentConfiguration
@property
def _output_ports(self):
_bt_as_self_component_ptr = staticmethod(
native_bt.self_component_sink_as_self_component
)
+ _config_pycls = _UserSinkComponentConfiguration
def _bt_graph_is_configured_from_native(self):
self._user_graph_is_configured()
static
bt_component_class_init_method_status component_class_source_init(
bt_self_component_source *self_component_source,
+ bt_self_component_source_configuration *config,
const bt_value *params, void *init_method_data)
{
bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
static
bt_component_class_init_method_status component_class_filter_init(
bt_self_component_filter *self_component_filter,
+ bt_self_component_filter_configuration *config,
const bt_value *params, void *init_method_data)
{
bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
static
bt_component_class_init_method_status component_class_sink_init(
bt_self_component_sink *self_component_sink,
+ bt_self_component_sink_configuration *config,
const bt_value *params, void *init_method_data)
{
bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
class _TraceCollectionMessageIteratorProxySink(bt2_component._UserSinkComponent):
- def __init__(self, params, msg_list):
+ def __init__(self, config, params, msg_list):
assert type(msg_list) is list
self._msg_list = msg_list
self._add_input_port('in')
static
enum bt_component_class_init_method_status simple_sink_init(
- struct bt_self_component_sink *self_comp,
+ bt_self_component_sink *self_comp,
+ bt_self_component_sink_configuration *config,
const struct bt_value *params, void *init_method_data)
{
int status = BT_FUNC_STATUS_OK;
const void *, void *);
typedef enum bt_component_class_init_method_status
-(*comp_init_method_t)(const void *, const void *, void *);
+(*comp_init_method_t)(const void *, void *, const void *, void *);
struct bt_graph_listener {
bt_graph_listener_removed_func removed;
bt_value_freeze(params);
if (init_method) {
+ /*
+ * There is no use for config objects right now, so just pass
+ * NULL.
+ */
BT_LOGD_STR("Calling user's initialization method.");
- init_status = init_method(component, params, init_method_data);
+ init_status = init_method(component, NULL, params, init_method_data);
BT_LOGD("User method returned: status=%s",
bt_common_func_status_string(init_status));
if (init_status != BT_FUNC_STATUS_OK) {
BT_HIDDEN
bt_component_class_init_method_status ctf_fs_sink_init(
- bt_self_component_sink *self_comp_sink, const bt_value *params,
+ bt_self_component_sink *self_comp_sink,
+ bt_self_component_sink_configuration *config,
+ const bt_value *params,
void *init_method_data)
{
bt_component_class_init_method_status status =
BT_HIDDEN
bt_component_class_init_method_status ctf_fs_sink_init(
bt_self_component_sink *component,
+ bt_self_component_sink_configuration *config,
const bt_value *params,
void *init_method_data);
BT_HIDDEN
bt_component_class_init_method_status ctf_fs_init(
bt_self_component_source *self_comp_src,
+ bt_self_component_source_configuration *config,
const bt_value *params, __attribute__((unused)) void *init_method_data)
{
struct ctf_fs_component *ctf_fs;
BT_HIDDEN
bt_component_class_init_method_status ctf_fs_init(
bt_self_component_source *source,
+ bt_self_component_source_configuration *config,
const bt_value *params, void *init_method_data);
BT_HIDDEN
BT_HIDDEN
bt_component_class_init_method_status lttng_live_component_init(
bt_self_component_source *self_comp_src,
- const bt_value *params, __attribute__((unused)) void *init_method_data)
+ bt_self_component_source_configuration *config,
+ const bt_value *params,
+ __attribute__((unused)) void *init_method_data)
{
struct lttng_live_component *lttng_live;
bt_component_class_init_method_status ret =
bt_component_class_init_method_status lttng_live_component_init(
bt_self_component_source *self_comp,
+ bt_self_component_source_configuration *config,
const bt_value *params, void *init_method_data);
bt_component_class_query_method_status lttng_live_query(
BT_HIDDEN
bt_component_class_init_method_status debug_info_comp_init(
bt_self_component_filter *self_comp_flt,
+ bt_self_component_filter_configuration *config,
const bt_value *params, __attribute__((unused)) void *init_method_data)
{
int ret;
BT_HIDDEN
bt_component_class_init_method_status debug_info_comp_init(
bt_self_component_filter *self_comp,
+ bt_self_component_filter_configuration *config,
const bt_value *params, void *init_method_data);
BT_HIDDEN
}
BT_HIDDEN
-bt_component_class_init_method_status details_init(bt_self_component_sink *comp,
+bt_component_class_init_method_status details_init(
+ bt_self_component_sink *comp,
+ bt_self_component_sink_configuration *config,
const bt_value *params,
__attribute__((unused)) void *init_method_data)
{
BT_HIDDEN
bt_component_class_init_method_status details_init(
bt_self_component_sink *component,
+ bt_self_component_sink_configuration *config,
const bt_value *params, void *init_method_data);
BT_HIDDEN
BT_HIDDEN
bt_component_class_init_method_status dmesg_init(
bt_self_component_source *self_comp_src,
+ bt_self_component_source_configuration *config,
bt_value *params, void *init_method_data)
{
int ret = 0;
BT_HIDDEN
bt_component_class_init_method_status dmesg_init(
bt_self_component_source *self_comp,
+ bt_self_component_source_configuration *config,
const bt_value *params, void *init_method_data);
BT_HIDDEN
BT_HIDDEN
bt_component_class_init_method_status pretty_init(
- bt_self_component_sink *comp, const bt_value *params,
+ bt_self_component_sink *comp,
+ bt_self_component_sink_configuration *config,
+ const bt_value *params,
__attribute__((unused)) void *init_method_data)
{
bt_component_class_init_method_status ret =
BT_HIDDEN
bt_component_class_init_method_status pretty_init(
- bt_self_component_sink *component, const bt_value *params,
+ bt_self_component_sink *component,
+ bt_self_component_sink_configuration *config,
+ const bt_value *params,
void *init_method_data);
BT_HIDDEN
BT_HIDDEN
bt_component_class_init_method_status counter_init(
bt_self_component_sink *component,
+ bt_self_component_sink_configuration *config,
const bt_value *params,
__attribute__((unused)) void *init_method_data)
{
BT_HIDDEN
bt_component_class_init_method_status counter_init(
bt_self_component_sink *component,
+ bt_self_component_sink_configuration *config,
const bt_value *params, void *init_method_data);
BT_HIDDEN
BT_HIDDEN
bt_component_class_init_method_status dummy_init(
bt_self_component_sink *component,
+ bt_self_component_sink_configuration *config,
const bt_value *params,
__attribute__((unused)) void *init_method_data)
{
BT_HIDDEN
bt_component_class_init_method_status dummy_init(
bt_self_component_sink *component,
+ bt_self_component_sink_configuration *config,
const bt_value *params, void *init_method_data);
BT_HIDDEN
BT_HIDDEN
bt_component_class_init_method_status muxer_init(
bt_self_component_filter *self_comp_flt,
+ bt_self_component_filter_configuration *config,
const bt_value *params, void *init_data)
{
bt_component_class_init_method_status status =
BT_HIDDEN
bt_component_class_init_method_status muxer_init(
bt_self_component_filter *self_comp,
+ bt_self_component_filter_configuration *config,
const bt_value *params, void *init_data);
BT_HIDDEN
bt_component_class_init_method_status trimmer_init(
bt_self_component_filter *self_comp_flt,
+ bt_self_component_filter_configuration *config,
const bt_value *params, void *init_data)
{
int ret;
void trimmer_finalize(bt_self_component_filter *self_comp);
BT_HIDDEN
-bt_component_class_init_method_status trimmer_init(bt_self_component_filter *self_comp,
+bt_component_class_init_method_status trimmer_init(
+ bt_self_component_filter *self_comp,
+ bt_self_component_filter_configuration *config,
const bt_value *params, void *init_data);
BT_HIDDEN
return notif
class MySrc(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
self._graph = bt2.Graph()
import unittest
import bt2
+from bt2 import component as bt2_component
class UserComponentTestCase(unittest.TestCase):
def test_name(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
self.assertEqual(comp_self.name, 'yaes')
def _user_consume(self):
def test_logging_level(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
self.assertEqual(comp_self.logging_level, bt2.LoggingLevel.INFO)
def _user_consume(self):
def test_graph_mip_version(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
self.assertEqual(comp_self._graph_mip_version, 0)
def _user_consume(self):
def test_class(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
self.assertEqual(comp_self.cls, MySink)
def _user_consume(self):
def test_addr(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
self.assertIsInstance(comp_self.addr, int)
self.assertNotEqual(comp_self.addr, 0)
del comp
self.assertTrue(finalized)
+ def test_source_component_config(self):
+ class MySource(
+ bt2._UserSourceComponent, message_iterator_class=bt2._UserMessageIterator
+ ):
+ def __init__(comp_self, config, params, obj):
+ nonlocal cfg_type
+ cfg_type = type(config)
+
+ cfg_type = None
+ self._create_comp(MySource)
+ self.assertIs(cfg_type, bt2_component._UserSourceComponentConfiguration)
+
+ def test_filter_component_config(self):
+ class MyFilter(
+ bt2._UserFilterComponent, message_iterator_class=bt2._UserMessageIterator
+ ):
+ def __init__(comp_self, config, params, obj):
+ nonlocal cfg_type
+ cfg_type = type(config)
+
+ cfg_type = None
+ self._create_comp(MyFilter)
+ self.assertIs(cfg_type, bt2_component._UserFilterComponentConfiguration)
+
+ def test_sink_component_config(self):
+ class MySink(bt2._UserSinkComponent):
+ def __init__(comp_self, config, params, obj):
+ nonlocal cfg_type
+ cfg_type = type(config)
+
+ def _user_consume(self):
+ pass
+
+ cfg_type = None
+ self._create_comp(MySink)
+ self.assertIs(cfg_type, bt2_component._UserSinkComponentConfiguration)
+
class GenericComponentTestCase(unittest.TestCase):
@staticmethod
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_consume(self):
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_consume(self):
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_consume(self):
class SourceWithFailingIter(
bt2._UserSourceComponent, message_iterator_class=FailingIter
):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class SourceWithFailingInit(
bt2._UserSourceComponent, message_iterator_class=FailingIter
):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
raise ValueError('Source is failing')
class WorkingSink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._in = self._add_input_port('in')
def _user_graph_is_configured(self):
class SinkWithExceptionChaining(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._in = self._add_input_port('in')
def _user_graph_is_configured(self):
return msg
class MySrc(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
tc = self._create_trace_class()
return self._msgs.pop(0)
class MySrc(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out', params)
graph = bt2.Graph()
return self._msgs.pop(0)
class MySrc(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out', params)
graph = bt2.Graph()
return self._msgs.pop(0)
class MySrc(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out', params)
graph = bt2.Graph()
comp_params = None
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
nonlocal comp_params
comp_params = params
comp_obj = None
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
nonlocal comp_obj
comp_obj = obj
comp_obj = None
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
nonlocal comp_obj
comp_obj = obj
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_consume(self):
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_consume(self):
raise TypeError
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_consume(self):
return self._create_stream_beginning_message(self._stream)
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_consume(self):
return msg
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._input_port = self._add_input_port('in')
self._at = 0
pass
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._input_port = self._add_input_port('in')
def _user_consume(comp_self):
pass
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._input_port = self._add_input_port('in')
def _user_consume(comp_self):
return msg
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._input_port = self._add_input_port('in')
self._at = 0
return msg
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._input_port = self._add_input_port('in')
self._at = 0
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
self._add_output_port('zero')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_consume(self):
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
self._add_output_port('zero')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_consume(self):
def test_raise_in_component_init(self):
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
raise ValueError('oops!')
def _user_consume(self):
def test_raise_in_port_added_listener(self):
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_consume(self):
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_consume(self):
return msg
class MySrc(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out', params)
with_cc = bool(params['with_cc'])
# Straightforward sink that creates one input port (`in`) and consumes from
# it.
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_consume(self):
the_output_port_from_iter = self_port_output
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
nonlocal the_output_port_from_source
the_output_port_from_source = self._add_output_port('out', 'user data')
src_iter_initialized = True
class MySource(bt2._UserSourceComponent, message_iterator_class=MySourceIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MyFilterIter(bt2._UserMessageIterator):
return next(self._up_iter)
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyFilterIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
self._add_output_port('out')
raise ValueError('Very bad error')
class MySource(bt2._UserSourceComponent, message_iterator_class=MySourceIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MyFilterIter(bt2._UserMessageIterator):
)
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyFilterIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
self._add_output_port('out')
finalized = True
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
finalized = False
salut = self._component._salut
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
self._salut = 23
self.assertEqual(self_port_output.addr, port.addr)
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
called = False
addr = self.addr
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
addr = None
return self._msgs.pop(0)
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
tc = self._create_trace_class()
sc = tc.create_stream_class(supports_packets=True)
ec = sc.create_event_class()
raise bt2.TryAgain
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_output_port('out')
class MyFilterIter(bt2._UserMessageIterator):
return self._upstream_iter.can_seek_beginning()
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyFilterIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
input_port = self._add_input_port('in')
self._add_output_port('out', input_port)
MySourceIter._user_can_seek_ns_from_origin = user_can_seek_ns_from_origin
class MySource(bt2._UserSourceComponent, message_iterator_class=MySourceIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
tc = self._create_trace_class()
sc = tc.create_stream_class(supports_packets=True)
ec = sc.create_event_class()
self._upstream_iter.seek_ns_from_origin(ns_from_origin)
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyFilterIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
self._add_output_port('out')
class UserMessageIteratorSeekBeginningTestCase(unittest.TestCase):
def test_can_seek_beginning(self):
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
# Test an iterator without a _user_can_seek_beginning method, but with
# a _user_seek_beginning method.
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
# Test an iterator without a _user_can_seek_beginning method, without
# a _user_seek_beginning method.
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
def test_can_seek_beginning_user_error(self):
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
def test_can_seek_beginning_wrong_return_value(self):
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
def test_seek_beginning(self):
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
def test_seek_beginning_user_error(self):
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
class UserMessageIteratorSeekNsFromOriginTestCase(unittest.TestCase):
def test_can_seek_ns_from_origin(self):
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
# Test an iterator without a _user_can_seek_ns_from_origin method, but
# with a _user_seek_ns_from_origin method.
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
# Test an iterator without a _user_can_seek_ns_from_origin method, but
# with a _user_seek_beginning method.
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
# Test an iterator without a _user_can_seek_ns_from_origin method
# and no other related method.
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
def test_can_seek_ns_from_origin_user_error(self):
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
def test_can_seek_ns_from_origin_wrong_return_value(self):
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
def test_seek_ns_from_origin(self):
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port = comp_self._add_output_port('out')
self.assertEqual(port.name, 'out')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port = comp_self._add_output_port('out')
self.assertEqual(port.name, 'out')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port = comp_self._add_input_port('in')
self.assertEqual(port.name, 'in')
def test_sink_add_input_port(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port = comp_self._add_input_port('in')
self.assertEqual(port.name, 'in')
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port1 = comp_self._add_output_port('clear')
port2 = comp_self._add_output_port('print')
port3 = comp_self._add_output_port('insert')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port1 = comp_self._add_output_port('clear')
port2 = comp_self._add_output_port('print')
port3 = comp_self._add_output_port('insert')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port1 = comp_self._add_input_port('clear')
port2 = comp_self._add_input_port('print')
port3 = comp_self._add_input_port('insert')
def test_user_sink_input_ports_getitem(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port1 = comp_self._add_input_port('clear')
port2 = comp_self._add_input_port('print')
port3 = comp_self._add_input_port('insert')
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_output_port('clear')
comp_self._add_output_port('print')
comp_self._add_output_port('insert')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_output_port('clear')
comp_self._add_output_port('print')
comp_self._add_output_port('insert')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_input_port('clear')
comp_self._add_input_port('print')
comp_self._add_input_port('insert')
def test_user_sink_input_ports_getitem_invalid_key(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_input_port('clear')
comp_self._add_input_port('print')
comp_self._add_input_port('insert')
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_output_port('clear')
comp_self._add_output_port('print')
comp_self._add_output_port('insert')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_output_port('clear')
comp_self._add_output_port('print')
comp_self._add_output_port('insert')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_input_port('clear')
comp_self._add_input_port('print')
comp_self._add_input_port('insert')
def test_user_sink_input_ports_len(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_input_port('clear')
comp_self._add_input_port('print')
comp_self._add_input_port('insert')
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port1 = comp_self._add_output_port('clear')
port2 = comp_self._add_output_port('print')
port3 = comp_self._add_output_port('insert')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port1 = comp_self._add_output_port('clear')
port2 = comp_self._add_output_port('print')
port3 = comp_self._add_output_port('insert')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port1 = comp_self._add_input_port('clear')
port2 = comp_self._add_input_port('print')
port3 = comp_self._add_input_port('insert')
def test_user_sink_input_ports_iter(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port1 = comp_self._add_input_port('clear')
port2 = comp_self._add_input_port('print')
port3 = comp_self._add_input_port('insert')
port3 = None
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
nonlocal port1, port2, port3
port1 = comp_self._add_output_port('clear')
port2 = comp_self._add_output_port('print')
port3 = None
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
nonlocal port1, port2, port3
port1 = comp_self._add_output_port('clear')
port2 = comp_self._add_output_port('print')
port3 = None
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
nonlocal port1, port2, port3
port1 = comp_self._add_input_port('clear')
port2 = comp_self._add_input_port('print')
port3 = None
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
nonlocal port1, port2, port3
port1 = comp_self._add_input_port('clear')
port2 = comp_self._add_input_port('print')
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_output_port('clear')
comp_self._add_output_port('print')
comp_self._add_output_port('insert')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_output_port('clear')
comp_self._add_output_port('print')
comp_self._add_output_port('insert')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_input_port('clear')
comp_self._add_input_port('print')
comp_self._add_input_port('insert')
def test_gen_sink_input_ports_getitem_invalid_key(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_input_port('clear')
comp_self._add_input_port('print')
comp_self._add_input_port('insert')
raise bt2.Stop
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_output_port('clear')
comp_self._add_output_port('print')
comp_self._add_output_port('insert')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_output_port('clear')
comp_self._add_output_port('print')
comp_self._add_output_port('insert')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_input_port('clear')
comp_self._add_input_port('print')
comp_self._add_input_port('insert')
def test_gen_sink_input_ports_len(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_input_port('clear')
comp_self._add_input_port('print')
comp_self._add_input_port('insert')
port3 = None
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
nonlocal port1, port2, port3
port1 = comp_self._add_output_port('clear')
port2 = comp_self._add_output_port('print')
port3 = None
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
nonlocal port1, port2, port3
port1 = comp_self._add_output_port('clear')
port2 = comp_self._add_output_port('print')
port3 = None
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
nonlocal port1, port2, port3
port1 = comp_self._add_input_port('clear')
port2 = comp_self._add_input_port('print')
port3 = None
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
nonlocal port1, port2, port3
port1 = comp_self._add_input_port('clear')
port2 = comp_self._add_input_port('print')
def test_name(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_input_port('clear')
def _user_consume(self):
def test_connection_none(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_input_port('clear')
def _user_consume(self):
def test_is_connected_false(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
comp_self._add_input_port('clear')
def _user_consume(self):
def test_self_name(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port = comp_self._add_input_port('clear')
self.assertEqual(port.name, 'clear')
def test_self_connection_none(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port = comp_self._add_input_port('clear')
self.assertIsNone(port.connection)
def test_self_is_connected_false(self):
class MySink(bt2._UserSinkComponent):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
port = comp_self._add_input_port('clear')
self.assertFalse(port.is_connected)
raise bt2.Stop
class MySource(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
nonlocal user_datas
p = comp_self._add_output_port('port1')
raise bt2.Stop
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
nonlocal user_datas
p = comp_self._add_output_port('port1')
raise bt2.Stop
class MySink(bt2._UserFilterComponent, message_iterator_class=MyIter):
- def __init__(comp_self, params, obj):
+ def __init__(comp_self, config, params, obj):
nonlocal user_datas
p = comp_self._add_input_port('port1')
# The value returned by the callable is returned by run_in_component_init.
def run_in_component_init(func):
class MySink(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
nonlocal res_bound
res_bound = func(self)
return msg
class MySrc(bt2._UserSourceComponent, message_iterator_class=MyIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
tc = self._create_trace_class()
clock_class = self._create_clock_class(frequency=1000)
# from this port, it puts the returned message in the initialization
# list as the first item.
class TestProxySink(bt2._UserSinkComponent):
- def __init__(self, params, msg_list):
+ def __init__(self, config, params, msg_list):
assert msg_list is not None
self._msg_list = msg_list
self._add_input_port('in')
files are not grouped.
"""
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
super().__init__(params)
@staticmethod
directory "some-dir" won't be found by TestSourceExt, because we won't
recurse in "some-dir"."""
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
super().__init__(params)
@staticmethod
class TestSourceABCDE(Base, bt2._UserSourceComponent, message_iterator_class=TestIter):
"""A source that recognizes the arbitrary string input "ABCDE"."""
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
super().__init__(params)
@staticmethod
@bt2.plugin_component_class
class TestSourceA(Base, bt2._UserSourceComponent, message_iterator_class=TestIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
super().__init__(params, obj)
@staticmethod
@bt2.plugin_component_class
class TestSourceB(Base, bt2._UserSourceComponent, message_iterator_class=TestIter):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
super().__init__(params, obj)
@staticmethod
@bt2.plugin_component_class
class SinkThatPrintsParams(bt2._UserSinkComponent):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
self._add_input_port('in')
print(to_string(params))
class TheSourceOfConfusion(
bt2._UserSourceComponent, message_iterator_class=TheIteratorOfConfusion
):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
test_name = str(params['test-name'])
TEST_CASES[test_name].source_setup(self, test_name)
class TheSourceOfAllEvil(
bt2._UserSourceComponent, message_iterator_class=TheIteratorOfAllEvil
):
- def __init__(self, params, obj):
+ def __init__(self, config, params, obj):
tc = self._create_trace_class()
# Use a clock class with an offset, so we can test with --begin or --end
static
bt_component_class_init_method_status src_init(
bt_self_component_source *self_comp,
+ bt_self_component_source_configuration *config,
const bt_value *params, void *init_method_data)
{
int ret;
static
bt_component_class_init_method_status sink_init(
bt_self_component_sink *self_comp,
+ bt_self_component_sink_configuration *config,
const bt_value *params, void *init_method_data)
{
int ret;
static
bt_component_class_init_method_status src_init(
bt_self_component_source *self_comp,
+ bt_self_component_source_configuration *config,
const bt_value *params, void *init_method_data)
{
bt_self_component_add_port_status status;
static
bt_component_class_init_method_status src_init(
bt_self_component_source *self_comp,
+ bt_self_component_source_configuration *config,
const bt_value *params, void *init_method_data)
{
test_example_scenario(self_comp);