Refactor the component class and component API
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 26 Jan 2017 09:03:19 +0000 (04:03 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:37 +0000 (12:57 -0400)
This patch modifies the component class and component API so that the
user sets methods to the component class objects, not to the component
objects. This makes sense following the typical object-oriented
paradigm.

Changes:

* bt_component_class_create() is removed.

  You need to use a component class-specific function to create one,
  amongst:

  * bt_component_class_source_create()
  * bt_component_class_filter_create()
  * bt_component_class_sink_create()

  All the parameters of those functions are mandatory: they are the
  name and the mandatory _methods_ of the class, depending on the
  type.

* Component class-specific functions are declared in their own header:

  * babeltrace/component/component-class-source.h
  * babeltrace/component/component-class-filter.h
  * babeltrace/component/component-class-sink.h

  babeltrace/component/component-class.h only contains functions which
  you can use on any component class, whatever the type.

* enum bt_component_type and BT_COMPONENT_TYPE_* are renamed to
  enum bt_component_class_type and BT_COMPONENT_CLASS_TYPE_* since
  the type is a property of the component class.

* Once a component class is created, you can use functions to set
  optional methods:

  * bt_component_class_filter_set_add_iterator_method()
  * bt_component_class_sink_set_add_iterator_method()

  The component initialization and destroy methods are now both
  optional:

  * bt_component_class_set_init_method()
  * bt_component_class_set_destroy_method()

  You can also set the optional description with a function:

  * bt_component_class_set_description()

* New public utility function: bt_component_get_class_type(): returns
  the type of a component's class.

* Component functions which are specific to a class type are moved to
  their respective header in babeltrace/component
  (source.h, filter.h, sink.h).

* Plugin development interface (babeltrace/plugin/plugin-dev.h) is
  updated to follow the API changes. Component class descriptor macros
  contain the component class type in their name, for example:

      BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION()
      BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD()
      BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD()

* Existing plugins, tests, and the command-line converter are updated to
  follow the API changes.

* Other very minor fixes.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>

No differences found
This page took 0.025919 seconds and 4 git commands to generate.