Babeltrace 2 C API 2.1.0
Open-source trace manipulation framework
Loading...
Searching...
No Matches
Simple shared object plugin definition C file

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

The name of shared object plugin 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 code of the actual source and sink component classes, 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);
#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:773
#define BT_PLUGIN_MODULE()
Defines a plugin module.
Definition plugin-dev.h:335
#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:1242
#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:1425
#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:1146
#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:1379
#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:905
#define BT_PLUGIN(_name)
Alias of BT_PLUGIN_WITH_ID() with the _id parameter set to auto.
Definition plugin-dev.h:423
#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:1333
#define BT_PLUGIN_AUTHOR(_author)
Alias of BT_PLUGIN_AUTHOR_WITH_ID() with the _id parameter set to auto.
Definition plugin-dev.h:494
#define BT_PLUGIN_LICENSE(_license)
Alias of BT_PLUGIN_LICENSE_WITH_ID() with the _id parameter set to auto.
Definition plugin-dev.h:526
#define BT_PLUGIN_DESCRIPTION(_description)
Alias of BT_PLUGIN_DESCRIPTION_WITH_ID() with the _id parameter set to auto.
Definition plugin-dev.h:462
#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:2335
#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:2197
#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:956
#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:2290

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.