Babeltrace 2 C API  2.0.0
Open-source trace manipulation framework
Simple shared object plugin definition C file

This example shows a basic Babeltrace 2 shared object plugin definition C file.

The shared object plugin's name is vestige. Therefore the input and output component classes would be identified in the babeltrace2 command-line tool as source.vestige.input and sink.vestige.output.

Assume that vestige.c contains the actual source and sink component classes's code, and that vestige.h contains its declarations.

vestige-plugin.c:

/* Component class method declarations */
#include "vestige.h"
/* Always start with this line */
/* Declare the `vestige` plugin */
BT_PLUGIN(vestige);
/* Set some optional plugin properties */
BT_PLUGIN_DESCRIPTION("Input and output for the Vestige format.");
BT_PLUGIN_AUTHOR("Denis Rondeau");
/* Add the `input` source component class */
BT_PLUGIN_SOURCE_COMPONENT_CLASS(input, vestige_in_iter_next);
/* Set the source component class's optional description */
"Read a Vestige trace file.");
/* Set some optional methods of the source component class */
vestige_in_init);
vestige_in_finalize);
input, vestige_in_iter_init);
input, vestige_in_iter_fini);
/* Add the `output` sink component class */
BT_PLUGIN_SINK_COMPONENT_CLASS(output, vestige_out_consume);
/* Set the sink component class's optional description */
"Write a Vestige trace file.");
/* Set some optional methods of the sink component class */
vestige_out_init);
vestige_out_finalize);
vestige_out_graph_is_configured);

See Compile and link a Babeltrace 2 shared object plugin to learn how you could compile and link those files as a Babeltrace 2 shared object plugin.

BT_PLUGIN_LICENSE
#define BT_PLUGIN_LICENSE(_license)
Alias of BT_PLUGIN_LICENSE_WITH_ID() with the _id parameter set to auto.
Definition: plugin-dev.h:530
BT_PLUGIN_SINK_COMPONENT_CLASS_INITIALIZE_METHOD
#define BT_PLUGIN_SINK_COMPONENT_CLASS_INITIALIZE_METHOD(_name, _method)
Alias of BT_PLUGIN_SINK_COMPONENT_CLASS_INITIALIZE_METHOD_WITH_ID() with the _plugin_id parameter set...
Definition: plugin-dev.h:2332
BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD
#define BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD(_name, _method)
Alias of BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD_WITH_ID() with the _plugin_id parameter set t...
Definition: plugin-dev.h:2194
BT_PLUGIN_SOURCE_COMPONENT_CLASS
#define BT_PLUGIN_SOURCE_COMPONENT_CLASS(_name, _message_iterator_class_next_method)
Alias of BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID() with the _plugin_id parameter set to auto,...
Definition: plugin-dev.h:774
BT_PLUGIN_SINK_COMPONENT_CLASS
#define BT_PLUGIN_SINK_COMPONENT_CLASS(_name, _consume_method)
Alias of BT_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID() with the _plugin_id parameter set to auto,...
Definition: plugin-dev.h:904
BT_PLUGIN_MODULE
#define BT_PLUGIN_MODULE()
Defines a plugin module.
Definition: plugin-dev.h:338
BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_FINALIZE_METHOD
#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_FINALIZE_METHOD(_name, _method)
Alias of BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_FINALIZE_METHOD_WITH_ID() with the _...
Definition: plugin-dev.h:1377
BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION
#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(_name, _description)
Alias of BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION_WITH_ID() with the _plugin_id parameter set to ...
Definition: plugin-dev.h:955
BT_PLUGIN_DESCRIPTION
#define BT_PLUGIN_DESCRIPTION(_description)
Alias of BT_PLUGIN_DESCRIPTION_WITH_ID() with the _id parameter set to auto.
Definition: plugin-dev.h:465
BT_PLUGIN
#define BT_PLUGIN(_name)
Alias of BT_PLUGIN_WITH_ID() with the _id parameter set to auto.
Definition: plugin-dev.h:426
BT_PLUGIN_SOURCE_COMPONENT_CLASS_FINALIZE_METHOD
#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_FINALIZE_METHOD(_name, _method)
Alias of BT_PLUGIN_SOURCE_COMPONENT_CLASS_FINALIZE_METHOD_WITH_ID() with the _plugin_id parameter set...
Definition: plugin-dev.h:1241
BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD
#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD(_name, _method)
Alias of BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_WITH_ID() with the...
Definition: plugin-dev.h:1423
BT_PLUGIN_SOURCE_COMPONENT_CLASS_INITIALIZE_METHOD
#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_INITIALIZE_METHOD(_name, _method)
Alias of BT_PLUGIN_SOURCE_COMPONENT_CLASS_INITIALIZE_METHOD_WITH_ID() with the _plugin_id parameter s...
Definition: plugin-dev.h:1332
BT_PLUGIN_AUTHOR
#define BT_PLUGIN_AUTHOR(_author)
Alias of BT_PLUGIN_AUTHOR_WITH_ID() with the _id parameter set to auto.
Definition: plugin-dev.h:498
BT_PLUGIN_SINK_COMPONENT_CLASS_GRAPH_IS_CONFIGURED_METHOD
#define BT_PLUGIN_SINK_COMPONENT_CLASS_GRAPH_IS_CONFIGURED_METHOD(_name, _method)
Alias of BT_PLUGIN_SINK_COMPONENT_CLASS_GRAPH_IS_CONFIGURED_METHOD_WITH_ID() with the _plugin_id para...
Definition: plugin-dev.h:2287
BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION
#define BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(_name, _description)
Alias of BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION_WITH_ID() with the _plugin_id parameter set to au...
Definition: plugin-dev.h:1145