Integrate modifications after plugin review
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 3 Jun 2015 08:39:55 +0000 (10:39 +0200)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 16:54:32 +0000 (12:54 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/Makefile.am
include/babeltrace/plugin/component-class.h [new file with mode: 0644]
include/babeltrace/plugin/component-factory.h [new file with mode: 0644]
include/babeltrace/plugin/component.h [new file with mode: 0644]
include/babeltrace/plugin/notification/event-internal.h [new file with mode: 0644]
include/babeltrace/plugin/notification/notification-internal.h [new file with mode: 0644]
include/babeltrace/plugin/plugin.h

index d839f478a55ad323b539477928805dc2bf5af71f..01273ae450bad2b11264f86040cbe76656b7929b 100644 (file)
@@ -38,6 +38,9 @@ babeltracectfirinclude_HEADERS = \
 
 babeltraceplugininclude_HEADERS = \
        babeltrace/plugin/plugin.h \
+       babeltrace/plugin/component.h \
+       babeltrace/plugin/component-class.h \
+       babeltrace/plugin/component-factory.h \
        babeltrace/plugin/source.h \
        babeltrace/plugin/sink.h \
        babeltrace/plugin/filter.h \
@@ -106,8 +109,10 @@ noinst_HEADERS = \
        babeltrace/compat/mman.h \
        babeltrace/endian.h \
        babeltrace/mmap-align.h \
-       babeltrace/plugin/plugin-internal.h \
        babeltrace/plugin/sink-internal.h \
+       babeltrace/plugin/component-internal.h \
+       babeltrace/plugin/component-class-internal.h \
+       babeltrace/plugin/component-factory-internal.h \
        babeltrace/plugin/source-internal.h \
        babeltrace/plugin/filter-internal.h \
        babeltrace/plugin/notification/event-internal.h \
diff --git a/include/babeltrace/plugin/component-class.h b/include/babeltrace/plugin/component-class.h
new file mode 100644 (file)
index 0000000..8988abc
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef BABELTRACE_PLUGIN_COMPONENT_CLASS_H
+#define BABELTRACE_PLUGIN_COMPONENT_CLASS_H
+
+/*
+ * Babeltrace - Plugin Component Class Interface.
+ *
+ * Copyright 2015 EfficiOS Inc.
+ * Copyright 2015 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+#include <babeltrace/plugin/factory.h>
+
+#ifdef __cplusplus
+extern "C" {
+       #endif
+
+#define BT_PLUGIN_NAME(_x)     const char *__bt_plugin_name = (_x)
+#define BT_PLUGIN_AUTHOR(_x)   const char *__bt_plugin_author = (_x)
+#define BT_PLUGIN_LICENSE(_x)  const char *__bt_plugin_license = (_x)
+#define BT_PLUGIN_INIT(_x)     void *__bt_plugin_init = (_x)
+#define BT_PLUGIN_EXIT(_x)     void *__bt_plugin_exit = (_x)
+
+#define BT_PLUGIN_COMPONENT_CLASSES_BEGIN\
+       enum bt_status __bt_plugin_register_component_classes(\
+               struct bt_component_factory *factory)\
+       {
+
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_ENTRY(_name, _init, _fini, _it_cr) \
+       bt_component_factory_register_source_component_class(factory, \
+               _name, _init, _fini, _it_cr);
+
+#define BT_PLUGIN_SINK_COMPONENT_CLASS_ENTRY(_name, _init, _fini, _hd_notif) \
+       bt_component_factory_register_sink_component_class(factory, \
+               _name, _init, _fini, _hd_notif);
+
+#define BT_PLUGIN_COMPONENT_CLASSES_END\
+       \
+       return BT_STATUS_OK;\
+}\
+       \
+       BT_PLUGIN_INIT(__bt_plugin_register_component_classes);\
+       BT_PLUGIN_EXIT(NULL);
+
+       #ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_COMPONENT_CLASS_H */
diff --git a/include/babeltrace/plugin/component-factory.h b/include/babeltrace/plugin/component-factory.h
new file mode 100644 (file)
index 0000000..379e6c0
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef BABELTRACE_PLUGIN_COMPONENT_CLASS_H
+#define BABELTRACE_PLUGIN_COMPONENT_CLASS_H
+
+/*
+ * Babeltrace - Plugin Component Class Interface.
+ *
+ * Copyright 2015 EfficiOS Inc.
+ * Copyright 2015 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+#include <babeltrace/plugin/factory.h>
+
+#ifdef __cplusplus
+extern "C" {
+       #endif
+
+#define BT_PLUGIN_NAME(_x)     const char *__bt_plugin_name = (_x)
+#define BT_PLUGIN_AUTHOR(_x)   const char *__bt_plugin_author = (_x)
+#define BT_PLUGIN_LICENSE(_x)  const char *__bt_plugin_license = (_x)
+#define BT_PLUGIN_INIT(_x)     void *__bt_plugin_init = (_x)
+#define BT_PLUGIN_EXIT(_x)     void *__bt_plugin_exit = (_x)
+
+#define BT_PLUGIN_COMPONENT_CLASSES_BEGIN\
+       enum bt_status __bt_plugin_register_component_classes(\
+               struct bt_component_factory *factory)\
+       {
+
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_ENTRY(_name, _init, _fini, _it_cr) \
+       bt_component_factory_register_source_component_class(factory, \
+               _name, _init, _fini, _it_cr);
+
+#define BT_PLUGIN_SINK_COMPONENT_CLASS_ENTRY(_name, _init, _fini, _hd_notif) \
+       bt_component_factory_register_sink_component_class(factory, \
+               _name, _init, _fini, _hd_notif);
+
+#define BT_PLUGIN_COMPONENT_CLASSES_END\
+       \
+       return BT_STATUS_OK;\
+}\
+       \
+       BT_PLUGIN_INIT(__bt_plugin_register_component_classes);\
+       BT_PLUGIN_EXIT(NULL);
+
+       #ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_H */
diff --git a/include/babeltrace/plugin/component.h b/include/babeltrace/plugin/component.h
new file mode 100644 (file)
index 0000000..1a17ed7
--- /dev/null
@@ -0,0 +1,136 @@
+#ifndef BABELTRACE_PLUGIN_COMPONENT_H
+#define BABELTRACE_PLUGIN_COMPONENT_H
+
+/*
+ * BabelTrace - Babeltrace Plug-in Component Interface
+ *
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Component type.
+ */
+enum bt_component_type {
+       BT_COMPONENT_TYPE_UNKNOWN =     -1,
+
+       /** A source component is a notification generator. */
+       BT_COMPONENT_TYPE_SOURCE =      0,
+
+       /** A sink component handles incoming notifications. */
+       BT_COMPONENT_TYPE_SINK =        1,
+
+       /** A filter component implements both Source and Sink interfaces. */
+       BT_COMPONENT_TYPE_FILTER =      2,
+};
+
+/**
+ * Status code. Errors are always negative.
+ */
+enum bt_component_status {
+       /** Memory allocation failure. */
+       /* -12 for compatibility with -ENOMEM */
+       BT_COMPONENT_STATUS_NOMEM =             -12,
+
+       /** Invalid arguments. */
+       /* -22 for compatibility with -EINVAL */
+       BT_COMPONENT_STATUS_INVAL =             -22,
+
+       /** Unsupported component feature. */
+       BT_COMPONENT_STATUS_UNSUPPORTED =       -2,
+
+       /** General error. */
+       BT_COMPONENT_STATUS_ERROR =             -1,
+
+       /** No error, okay. */
+       BT_COMPONENT_STATUS_OK =                0,
+};
+
+struct bt_component;
+
+/**
+ * Get component's name.
+ *
+ * @param component    Component instance of which to get the name
+ * @returns            Returns a pointer to the plug-in's name
+ */
+extern const char *bt_component_get_name(struct bt_component *component);
+
+/**
+ * Set component's name.
+ *
+ * @param component    Component instance of which to set the name
+ * @param name         New plug-in name (will be copied)
+ * @returns            One of #bt_component_status values
+ */
+extern enum bt_component_status bt_component_set_name(
+               struct bt_component *component, const char *name);
+
+/**
+ * Get component instance type.
+ *
+ * @param component    Component instance of which to get the type
+ * @returns            One of #bt_component_type values
+ */
+extern enum bt_component_type bt_component_get_type(
+               struct bt_component *component);
+
+/**
+ * Set a component instance's error stream.
+ *
+ * @param component    Component instance
+ * @param error_stream Error stream
+ * @returns            One of #bt_component_status values
+ */
+extern enum bt_component_status bt_component_set_error_stream(
+               struct bt_component *component, FILE *error_stream);
+
+/**
+ * Increments the reference count of \p component.
+ *
+ * @param component    Component of which to increment the reference count
+ *
+ * @see bt_component_put()
+ */
+extern void bt_component_get(struct bt_component *component);
+
+/**
+ * Decrements the reference count of \p component, destroying it when this
+ * count reaches 0.
+ *
+ * @param component    Component of which to decrement the reference count
+ *
+ * @see bt_component_get()
+ */
+extern void bt_component_put(struct bt_component *component);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_COMPONENT_H */
diff --git a/include/babeltrace/plugin/notification/event-internal.h b/include/babeltrace/plugin/notification/event-internal.h
new file mode 100644 (file)
index 0000000..442f604
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef BABELTRACE_PLUGIN_NOTIFICATION_EVENT_INTERNAL_H
+#define BABELTRACE_PLUGIN_NOTIFICATION_EVENT_INTERNAL_H
+
+/*
+ * BabelTrace - Plug-in Event Notification internal
+ *
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/plugin/notification/notification-internal.h>
+#include <babeltrace/ctf-writer/ref-internal.h>
+#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/ctf-ir/trace.h>
+#include <babeltrace/ctf-ir/stream.h>
+#include <babeltrace/ctf-ir/event.h>
+#include <glib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_plugin_notification_event {
+       struct bt_plugin_notification parent;
+       struct bt_ctf_trace *trace;
+       struct bt_ctf_stream *stream;
+       struct bt_ctf_event *event;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_NOTIFICATION_EVENT_INTERNAL_H */
diff --git a/include/babeltrace/plugin/notification/notification-internal.h b/include/babeltrace/plugin/notification/notification-internal.h
new file mode 100644 (file)
index 0000000..92cea15
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef BABELTRACE_PLUGIN_NOTIFICATION_INTERNAL_H
+#define BABELTRACE_PLUGIN_NOTIFICATION_INTERNAL_H
+
+/*
+ * BabelTrace - Plug-in Notification internal
+ *
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/ctf-writer/ref-internal.h>
+#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/plugin/notification/notification.h>
+#include <glib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_plugin_notification {
+       struct bt_ctf_ref ref_count;
+       enum bt_plugin_notification_type type;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_NOTIFICATION_INTERNAL_H */
index d0816261e90ebcdf93f4ac4abca279ab36a8c90a..60a1a21a7b48ade9fdb9aedcf1fe1db36a8a36e5 100644 (file)
  * SOFTWARE.
  */
 
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Plug-in type.
- */
-enum bt_plugin_type {
-       BT_PLUGIN_TYPE_UNKNOWN =        -1,
-
-       /** A source plug-in is a notification generator. */
-       BT_PLUGIN_TYPE_SOURCE =         0,
-
-       /** A sink plug-in handles incoming notifications. */
-       BT_PLUGIN_TYPE_SINK =           1,
-
-       /** A filter plug-in implements both Source and Sink interfaces. */
-       BT_PLUGIN_TYPE_FILTER =         2,
-};
-
-/**
- * Status code. Errors are always negative.
- */
-enum bt_plugin_status {
-       /** Memory allocation failure. */
-       /* -12 for compatibility with -ENOMEM */
-       BT_PLUGIN_STATUS_NOMEM =        -12,
-
-       /** Invalid arguments. */
-       /* -22 for compatibility with -EINVAL */
-       BT_PLUGIN_STATUS_INVAL =        -22,
-
-       /** Unsupported plug-in feature. */
-       BT_PLUGIN_STATUS_UNSUPPORTED =  -2,
-
-       /** General error. */
-       BT_PLUGIN_STATUS_ERROR =        -1,
-
-       /** No error, okay. */
-       BT_PLUGIN_STATUS_OK =           0,
-};
-
-struct bt_plugin;
-
-/**
- * Get plug-in instance name.
- *
- * @param plugin       Plug-in instance of which to get the name
- * @returns            Returns a pointer to the plug-in's name
- */
-extern const char *bt_plugin_get_name(struct bt_plugin *plugin);
-
-/**
- * Set plug-in instance name.
- *
- * @param plugin       Plug-in instance of which to set the name
- * @param name         New plug-in name (will be copied)
- * @returns            One of #bt_plugin_status values
- */
-extern enum bt_plugin_status bt_plugin_set_name(
-               struct bt_plugin *plugin, const char *name);
-
-/**
- * Get plug-in instance type.
- *
- * @param plugin       Plug-in instance of which to get the type
- * @returns            One of #bt_plugin_type values
- */
-extern enum bt_plugin_type bt_plugin_get_type(struct bt_plugin *plugin);
-
-/**
- * Set a plug-in instance's error stream.
- *
- * @param plugin       Plug-in instance
- * @param error_stream Error stream
- * @returns            One of #bt_plugin_status values
- */
-extern enum bt_plugin_status bt_plugin_set_error_stream(
-               struct bt_plugin *plugin, FILE *error_stream);
-
-/**
- * Increments the reference count of \p plugin.
- *
- * @param plugin       Plug-in of which to increment the reference count
- *
- * @see bt_plugin_put()
- */
-extern void bt_plugin_get(struct bt_plugin *plugin);
-
-/**
- * Decrements the reference count of \p plugin, destroying it when this
- * count reaches 0.
- *
- * @param plugin       Plug-in of which to decrement the reference count
- *
- * @see bt_plugin_get()
- */
-extern void bt_plugin_put(struct bt_plugin *plugin);
-
-#ifdef __cplusplus
-}
-#endif
+#include <babeltrace/plugin/component.h>
+#include <babeltrace/plugin/component-class.h>
+#include <babeltrace/plugin/source.h>
+#include <babeltrace/plugin/sink.h>
+#include <babeltrace/plugin/filter.h>
 
 #endif /* BABELTRACE_PLUGIN_H */
This page took 0.030798 seconds and 4 git commands to generate.