diff options
Diffstat (limited to 'ufo')
-rw-r--r-- | ufo/CMakeLists.txt | 4 | ||||
-rw-r--r-- | ufo/Makefile.am | 4 | ||||
-rw-r--r-- | ufo/ufo-base-scheduler.h | 1 | ||||
-rw-r--r-- | ufo/ufo-config.c | 231 | ||||
-rw-r--r-- | ufo/ufo-config.h | 73 | ||||
-rw-r--r-- | ufo/ufo-configurable.c | 53 | ||||
-rw-r--r-- | ufo/ufo-configurable.h | 50 | ||||
-rw-r--r-- | ufo/ufo-daemon.c | 14 | ||||
-rw-r--r-- | ufo/ufo-daemon.h | 2 | ||||
-rw-r--r-- | ufo/ufo-fixed-scheduler.c | 7 | ||||
-rw-r--r-- | ufo/ufo-fixed-scheduler.h | 3 | ||||
-rw-r--r-- | ufo/ufo-group-scheduler.c | 10 | ||||
-rw-r--r-- | ufo/ufo-group-scheduler.h | 3 | ||||
-rw-r--r-- | ufo/ufo-local-scheduler.c | 10 | ||||
-rw-r--r-- | ufo/ufo-local-scheduler.h | 3 | ||||
-rw-r--r-- | ufo/ufo-plugin-manager.c | 115 | ||||
-rw-r--r-- | ufo/ufo-plugin-manager.h | 23 | ||||
-rw-r--r-- | ufo/ufo-scheduler.h | 1 | ||||
-rw-r--r-- | ufo/ufo.h | 2 |
19 files changed, 49 insertions, 560 deletions
diff --git a/ufo/CMakeLists.txt b/ufo/CMakeLists.txt index a6dbcc1..42df49b 100644 --- a/ufo/CMakeLists.txt +++ b/ufo/CMakeLists.txt @@ -8,8 +8,6 @@ set(ufocore_SRCS ufo-base-scheduler.c ufo-copy-task.c ufo-buffer.c - ufo-configurable.c - ufo-config.c ufo-copyable-iface.c ufo-cpu-node.c ufo-daemon.c @@ -48,8 +46,6 @@ set(ufocore_HDRS ufo-base-scheduler.h ufo-copy-task.h ufo-buffer.h - ufo-configurable.h - ufo-config.h ufo-copyable-iface.h ufo-cpu-node.h ufo-daemon.h diff --git a/ufo/Makefile.am b/ufo/Makefile.am index 1d69486..17b14a6 100644 --- a/ufo/Makefile.am +++ b/ufo/Makefile.am @@ -14,8 +14,6 @@ ufo_sources = \ ufo-arch-graph.c \ ufo-base-scheduler.c \ ufo-buffer.c \ - ufo-configurable.c \ - ufo-config.c \ ufo-copyable-iface.c \ ufo-copy-task.c \ ufo-cpu-node.c \ @@ -51,8 +49,6 @@ ufo_headers = \ ufo-arch-graph.h \ ufo-base-scheduler.h \ ufo-buffer.h \ - ufo-configurable.h \ - ufo-config.h \ ufo-copyable-iface.h \ ufo-copy-task.h \ ufo-cpu-node.h \ diff --git a/ufo/ufo-base-scheduler.h b/ufo/ufo-base-scheduler.h index 03de4eb..7d53773 100644 --- a/ufo/ufo-base-scheduler.h +++ b/ufo/ufo-base-scheduler.h @@ -24,7 +24,6 @@ #error "Only <ufo/ufo.h> can be included directly." #endif -#include <ufo/ufo-config.h> #include <ufo/ufo-task-graph.h> G_BEGIN_DECLS diff --git a/ufo/ufo-config.c b/ufo/ufo-config.c deleted file mode 100644 index 1e76cb7..0000000 --- a/ufo/ufo-config.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (C) 2011-2013 Karlsruhe Institute of Technology - * - * This file is part of Ufo. - * - * This library is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "config.h" -#include <ufo/ufo-config.h> -#include <ufo/ufo-profiler.h> -#include <ufo/ufo-enums.h> - -/** - * SECTION:ufo-config - * @Short_description: Access run-time specific settings - * @Title: UfoConfig - * - * A #UfoConfig object is used to keep settings that affect the run-time - * rather than the parameters of the filter graph. Each object that implements - * the #UfoConfigurable interface can receive a #UfoConfig object and use - * the information stored in it. - */ - -G_DEFINE_TYPE(UfoConfig, ufo_config, G_TYPE_OBJECT) - -#define UFO_CONFIG_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), UFO_TYPE_CONFIG, UfoConfigPrivate)) - -static void add_path (const gchar *path, UfoConfigPrivate *priv); - -enum { - PROP_0, - PROP_PATHS, - N_PROPERTIES -}; - -struct _UfoConfigPrivate { - GValueArray *path_array; -}; - -static GParamSpec *properties[N_PROPERTIES] = { NULL, }; - -/** - * ufo_config_new: - * - * Create a config object. - * - * Return value: A new config object. - */ -UfoConfig * -ufo_config_new (void) -{ - return UFO_CONFIG (g_object_new (UFO_TYPE_CONFIG, NULL)); -} - -/** - * ufo_config_get_paths: - * @config: A #UfoConfig object - * - * Get an array of path strings. - * - * Returns: (transfer full) (element-type utf8): A list of strings containing - * file system paths. Use g_list_free() to free it. - */ -GList * -ufo_config_get_paths (UfoConfig *config) -{ - GValueArray *path_array; - GList *paths; - guint n_paths; - - g_return_val_if_fail (UFO_IS_CONFIG (config), NULL); - - path_array = config->priv->path_array; - n_paths = path_array->n_values; - paths = NULL; - - for (guint i = 0; i < n_paths; i++) { - paths = g_list_append (paths, - g_strdup (g_value_get_string (g_value_array_get_nth (path_array, i)))); - } - - return paths; -} - -/** - * ufo_config_add_paths: - * @config: A #UfoConfig object - * @paths: (element-type utf8): List of strings - * - * Add @paths to the list of search paths for plugins and OpenCL kernel files. - */ -void -ufo_config_add_paths (UfoConfig *config, - GList *paths) -{ - g_return_if_fail (UFO_IS_CONFIG (config)); - g_list_foreach (paths, (GFunc) add_path, config->priv); -} - -static void -add_path (const gchar *path, - UfoConfigPrivate *priv) -{ - GValue path_value = {0}; - - g_value_init (&path_value, G_TYPE_STRING); - g_value_set_string (&path_value, path); - g_value_array_prepend (priv->path_array, &path_value); - g_value_unset (&path_value); -} - -static void -ufo_config_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - UfoConfigPrivate *priv = UFO_CONFIG_GET_PRIVATE (object); - - switch (property_id) { - case PROP_PATHS: - { - GValueArray *more_paths; - - more_paths = g_value_get_boxed (value); - - if (more_paths != NULL) { - for (guint i = 0; i < more_paths->n_values; i++) { - g_value_array_append (priv->path_array, - g_value_array_get_nth (more_paths, i)); - } - } - } - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -ufo_config_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - UfoConfigPrivate *priv = UFO_CONFIG_GET_PRIVATE (object); - - switch (property_id) { - case PROP_PATHS: - g_value_set_boxed (value, priv->path_array); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -ufo_config_dispose (GObject *object) -{ - G_OBJECT_CLASS (ufo_config_parent_class)->finalize (object); -} - -static void -ufo_config_finalize (GObject *object) -{ - g_value_array_free (UFO_CONFIG_GET_PRIVATE (object)->path_array); - G_OBJECT_CLASS (ufo_config_parent_class)->finalize (object); -} - -static void -ufo_config_class_init (UfoConfigClass *klass) -{ - GObjectClass *oclass = G_OBJECT_CLASS (klass); - oclass->set_property = ufo_config_set_property; - oclass->get_property = ufo_config_get_property; - oclass->dispose = ufo_config_dispose; - oclass->finalize = ufo_config_finalize; - - /** - * UfoConfig:paths: - * - * An array of strings with paths pointing to possible filter and kernel - * file locations. - */ - properties[PROP_PATHS] = - g_param_spec_value_array ("paths", - "Array with paths", - "Array with paths", - g_param_spec_string ("path", - "A path", - "A path pointing to a filter or kernel", - ".", - G_PARAM_READWRITE), - G_PARAM_READWRITE); - - g_object_class_install_property (oclass, PROP_PATHS, - properties[PROP_PATHS]); - - g_type_class_add_private(klass, sizeof (UfoConfigPrivate)); -} - -static void -ufo_config_init (UfoConfig *config) -{ - UfoConfigPrivate *priv; - - config->priv = priv = UFO_CONFIG_GET_PRIVATE (config); - priv->path_array = g_value_array_new (0); - - add_path ("/usr/local/lib64/ufo", priv); - add_path ("/usr/local/lib/ufo", priv); - add_path ("/usr/lib64/ufo", priv); - add_path ("/usr/lib/ufo", priv); - add_path (UFO_PLUGIN_DIR, priv); -} diff --git a/ufo/ufo-config.h b/ufo/ufo-config.h deleted file mode 100644 index 40ac92b..0000000 --- a/ufo/ufo-config.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2011-2013 Karlsruhe Institute of Technology - * - * This file is part of Ufo. - * - * This library is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __UFO_CONFIG_H -#define __UFO_CONFIG_H - -#if !defined (__UFO_H_INSIDE__) && !defined (UFO_COMPILATION) -#error "Only <ufo/ufo.h> can be included directly." -#endif - -#include <glib-object.h> - -G_BEGIN_DECLS - -#define UFO_TYPE_CONFIG (ufo_config_get_type()) -#define UFO_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), UFO_TYPE_CONFIG, UfoConfig)) -#define UFO_IS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), UFO_TYPE_CONFIG)) -#define UFO_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), UFO_TYPE_CONFIG, UfoConfigClass)) -#define UFO_IS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), UFO_TYPE_CONFIG)) -#define UFO_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), UFO_TYPE_CONFIG, UfoConfigClass)) - -typedef struct _UfoConfig UfoConfig; -typedef struct _UfoConfigClass UfoConfigClass; -typedef struct _UfoConfigPrivate UfoConfigPrivate; - -/** - * UfoConfig: - * - * A #UfoConfig provides access to run-time specific settings. - */ -struct _UfoConfig { - /*< private >*/ - GObject parent_instance; - - UfoConfigPrivate *priv; -}; - -/** - * UfoConfigClass: - * - * #UfoConfig class - */ -struct _UfoConfigClass { - /*< private >*/ - GObjectClass parent_class; -}; - - -UfoConfig * ufo_config_new (void); -void ufo_config_add_paths (UfoConfig *config, - GList *paths); -GList * ufo_config_get_paths (UfoConfig *config); -GType ufo_config_get_type (void); - -G_END_DECLS - -#endif diff --git a/ufo/ufo-configurable.c b/ufo/ufo-configurable.c deleted file mode 100644 index 7e6a260..0000000 --- a/ufo/ufo-configurable.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2011-2013 Karlsruhe Institute of Technology - * - * This file is part of Ufo. - * - * This library is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <ufo/ufo-configurable.h> -#include <ufo/ufo-config.h> - -/** - * SECTION:ufo-configurable - * @Short_description: An interface for configurable objects - * @Title: UfoConfigurable - * - * An object that implements the #UfoConfigurable interface provides the common - * #UfoConfigurable:config property. - */ - -typedef UfoConfigurableIface UfoConfigurableInterface; -G_DEFINE_INTERFACE (UfoConfigurable, ufo_configurable, G_TYPE_OBJECT) - -static void -ufo_configurable_default_init (UfoConfigurableInterface *iface) -{ - GParamSpec *config_spec; - - /** - * UfoConfigurable:configuration: - * - * The #UfoConfiguration object that can be passed to all objects that - * implement the #UfoConfigurable interface. - */ - config_spec = g_param_spec_object ("config", - "A UfoConfig object", - "A UfoConfig object", - UFO_TYPE_CONFIG, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE); - - g_object_interface_install_property (iface, config_spec); -} diff --git a/ufo/ufo-configurable.h b/ufo/ufo-configurable.h deleted file mode 100644 index 99e6adc..0000000 --- a/ufo/ufo-configurable.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2011-2013 Karlsruhe Institute of Technology - * - * This file is part of Ufo. - * - * This library is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __UFO_CONFIGURABLE_H -#define __UFO_CONFIGURABLE_H - -#if !defined (__UFO_H_INSIDE__) && !defined (UFO_COMPILATION) -#error "Only <ufo/ufo.h> can be included directly." -#endif - -#include <glib-object.h> - -G_BEGIN_DECLS - -#define UFO_TYPE_CONFIGURABLE (ufo_configurable_get_type()) -#define UFO_CONFIGURABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), UFO_TYPE_CONFIGURABLE, UfoConfigurable)) -#define UFO_CONFIGURABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), UFO_TYPE_CONFIGURABLE, UfoConfigurableIface)) -#define UFO_IS_CONFIGURABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), UFO_TYPE_CONFIGURABLE)) -#define UFO_IS_CONFIGURABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), UFO_TYPE_CONFIGURABLE)) -#define UFO_CONFIGURABLE_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), UFO_TYPE_CONFIGURABLE, UfoConfigurableIface)) - -typedef struct _UfoConfigurable UfoConfigurable; -typedef struct _UfoConfigurableIface UfoConfigurableIface; - -struct _UfoConfigurableIface { - /*< private >*/ - GTypeInterface parent_iface; -}; - -GType ufo_configurable_get_type (void); - -G_END_DECLS - -#endif diff --git a/ufo/ufo-daemon.c b/ufo/ufo-daemon.c index 826676f..4100389 100644 --- a/ufo/ufo-daemon.c +++ b/ufo/ufo-daemon.c @@ -31,7 +31,6 @@ #include <signal.h> #include <stdlib.h> #include <string.h> -#include <ufo/ufo-config.h> #include <ufo/ufo-daemon.h> #include <ufo/ufo-dummy-task.h> #include <ufo/ufo-input-task.h> @@ -47,7 +46,6 @@ G_DEFINE_TYPE (UfoDaemon, ufo_daemon, G_TYPE_OBJECT) #define UFO_DAEMON_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), UFO_TYPE_DAEMON, UfoDaemonPrivate)) struct _UfoDaemonPrivate { - UfoConfig *config; UfoPluginManager *manager; UfoTaskGraph *task_graph; UfoBaseScheduler *scheduler; @@ -72,19 +70,17 @@ struct _UfoDaemonPrivate { static gpointer run_scheduler (UfoDaemon *daemon); UfoDaemon * -ufo_daemon_new (UfoConfig *config, gchar *listen_address) +ufo_daemon_new (const gchar *listen_address) { UfoDaemon *daemon; g_return_val_if_fail (listen_address != NULL, NULL); - g_return_val_if_fail (config != NULL, NULL); daemon = UFO_DAEMON (g_object_new (UFO_TYPE_DAEMON, NULL)); UfoDaemonPrivate *priv = UFO_DAEMON_GET_PRIVATE (daemon); - priv->config = config; - priv->listen_address = listen_address; - priv->manager = ufo_plugin_manager_new (priv->config); + priv->listen_address = g_strdup (listen_address); + priv->manager = ufo_plugin_manager_new (); priv->scheduler = ufo_scheduler_new (); #ifdef MPI priv->msger = UFO_MESSENGER (ufo_mpi_messenger_new ()); @@ -555,9 +551,6 @@ ufo_daemon_dispose (GObject *object) if (priv->task_graph) g_object_unref (priv->task_graph); - if (priv->config != NULL) - g_object_unref (priv->config); - if (priv->msger != NULL) g_object_unref (priv->msger); @@ -576,6 +569,7 @@ ufo_daemon_finalize (GObject *object) UfoDaemonPrivate *priv = UFO_DAEMON_GET_PRIVATE (object); g_mutex_free (priv->startstop_lock); g_cond_free (priv->started_cond); + g_free (priv->listen_address); G_OBJECT_CLASS (ufo_daemon_parent_class)->finalize (object); } diff --git a/ufo/ufo-daemon.h b/ufo/ufo-daemon.h index 3610310..5dc4035 100644 --- a/ufo/ufo-daemon.h +++ b/ufo/ufo-daemon.h @@ -61,7 +61,7 @@ struct _UfoDaemonClass { GObjectClass parent_class; }; -UfoDaemon * ufo_daemon_new (UfoConfig *config, gchar *listen_addr); +UfoDaemon * ufo_daemon_new (const gchar *listen_addr); void ufo_daemon_start (UfoDaemon *daemon); void ufo_daemon_stop (UfoDaemon *daemon); void ufo_daemon_wait_finish (UfoDaemon *daemon); diff --git a/ufo/ufo-fixed-scheduler.c b/ufo/ufo-fixed-scheduler.c index 5250024..f790639 100644 --- a/ufo/ufo-fixed-scheduler.c +++ b/ufo/ufo-fixed-scheduler.c @@ -32,8 +32,6 @@ #include <string.h> #include <ufo/ufo-buffer.h> -#include <ufo/ufo-config.h> -#include <ufo/ufo-configurable.h> #include <ufo/ufo-fixed-scheduler.h> #include <ufo/ufo-resources.h> #include <ufo/ufo-task-node.h> @@ -89,16 +87,15 @@ ufo_fixed_scheduler_error_quark (void) /** * ufo_fixed_scheduler_new: - * @config: A #UfoConfig or %NULL * * Creates a new #UfoFixedScheduler. * * Return value: A new #UfoFixedScheduler */ UfoBaseScheduler * -ufo_fixed_scheduler_new (UfoConfig *config) +ufo_fixed_scheduler_new (void) { - return UFO_BASE_SCHEDULER (g_object_new (UFO_TYPE_FIXED_SCHEDULER, "config", config, NULL)); + return UFO_BASE_SCHEDULER (g_object_new (UFO_TYPE_FIXED_SCHEDULER, NULL)); } static gboolean diff --git a/ufo/ufo-fixed-scheduler.h b/ufo/ufo-fixed-scheduler.h index 10c1f49..13ab6c2 100644 --- a/ufo/ufo-fixed-scheduler.h +++ b/ufo/ufo-fixed-scheduler.h @@ -24,7 +24,6 @@ #error "Only <ufo/ufo.h> can be included directly." #endif -#include <ufo/ufo-config.h> #include <ufo/ufo-task-graph.h> #include <ufo/ufo-base-scheduler.h> @@ -71,7 +70,7 @@ struct _UfoFixedSchedulerClass { UfoBaseSchedulerClass parent_class; }; -UfoBaseScheduler *ufo_fixed_scheduler_new (UfoConfig *config); +UfoBaseScheduler *ufo_fixed_scheduler_new (void); GType ufo_fixed_scheduler_get_type (void); GQuark ufo_fixed_scheduler_error_quark (void); diff --git a/ufo/ufo-group-scheduler.c b/ufo/ufo-group-scheduler.c index 816dbf3..ba6dced 100644 --- a/ufo/ufo-group-scheduler.c +++ b/ufo/ufo-group-scheduler.c @@ -32,8 +32,6 @@ #include <string.h> #include <ufo/ufo-buffer.h> -#include <ufo/ufo-config.h> -#include <ufo/ufo-configurable.h> #include <ufo/ufo-resources.h> #include <ufo/ufo-group-scheduler.h> #include <ufo/ufo-task-node.h> @@ -51,8 +49,7 @@ * on CPU and GPU hardware. */ -G_DEFINE_TYPE_WITH_CODE (UfoGroupScheduler, ufo_group_scheduler, UFO_TYPE_BASE_SCHEDULER, - G_IMPLEMENT_INTERFACE (UFO_TYPE_CONFIGURABLE, NULL)) +G_DEFINE_TYPE (UfoGroupScheduler, ufo_group_scheduler, UFO_TYPE_BASE_SCHEDULER) #define UFO_GROUP_SCHEDULER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), UFO_TYPE_GROUP_SCHEDULER, UfoGroupSchedulerPrivate)) @@ -91,16 +88,15 @@ ufo_group_scheduler_error_quark (void) /** * ufo_group_scheduler_new: - * @config: A #UfoConfig or %NULL * * Creates a new #UfoGroupScheduler. * * Return value: A new #UfoGroupScheduler */ UfoBaseScheduler * -ufo_group_scheduler_new (UfoConfig *config) +ufo_group_scheduler_new (void) { - return UFO_BASE_SCHEDULER (g_object_new (UFO_TYPE_GROUP_SCHEDULER, "config", config, NULL)); + return UFO_BASE_SCHEDULER (g_object_new (UFO_TYPE_GROUP_SCHEDULER, NULL)); } static gboolean diff --git a/ufo/ufo-group-scheduler.h b/ufo/ufo-group-scheduler.h index 50c1728..347b060 100644 --- a/ufo/ufo-group-scheduler.h +++ b/ufo/ufo-group-scheduler.h @@ -24,7 +24,6 @@ #error "Only <ufo/ufo.h> can be included directly." #endif -#include <ufo/ufo-config.h> #include <ufo/ufo-task-graph.h> #include <ufo/ufo-base-scheduler.h> @@ -71,7 +70,7 @@ struct _UfoGroupSchedulerClass { UfoBaseSchedulerClass parent_class; }; -UfoBaseScheduler *ufo_group_scheduler_new (UfoConfig *config); +UfoBaseScheduler *ufo_group_scheduler_new (void); GType ufo_group_scheduler_get_type (void); GQuark ufo_group_scheduler_error_quark (void); diff --git a/ufo/ufo-local-scheduler.c b/ufo/ufo-local-scheduler.c index 9017ee6..a37bb8d 100644 --- a/ufo/ufo-local-scheduler.c +++ b/ufo/ufo-local-scheduler.c @@ -32,8 +32,6 @@ #include <string.h> #include <ufo/ufo-buffer.h> -#include <ufo/ufo-config.h> -#include <ufo/ufo-configurable.h> #include <ufo/ufo-resources.h> #include <ufo/ufo-local-scheduler.h> #include <ufo/ufo-task-node.h> @@ -51,8 +49,7 @@ * on CPU and GPU hardware. */ -G_DEFINE_TYPE_WITH_CODE (UfoLocalScheduler, ufo_local_scheduler, UFO_TYPE_BASE_SCHEDULER, - G_IMPLEMENT_INTERFACE (UFO_TYPE_CONFIGURABLE, NULL)) +G_DEFINE_TYPE (UfoLocalScheduler, ufo_local_scheduler, UFO_TYPE_BASE_SCHEDULER) #define UFO_LOCAL_SCHEDULER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), UFO_TYPE_LOCAL_SCHEDULER, UfoLocalSchedulerPrivate)) @@ -127,16 +124,15 @@ ufo_pp_next (ProcessorPool *pp) /** * ufo_local_scheduler_new: - * @config: A #UfoConfig or %NULL * * Creates a new #UfoLocalScheduler. * * Return value: A new #UfoLocalScheduler */ UfoBaseScheduler * -ufo_local_scheduler_new (UfoConfig *config) +ufo_local_scheduler_new (void) { - return UFO_BASE_SCHEDULER (g_object_new (UFO_TYPE_LOCAL_SCHEDULER, "config", config, NULL)); + return UFO_BASE_SCHEDULER (g_object_new (UFO_TYPE_LOCAL_SCHEDULER, NULL)); } static gboolean diff --git a/ufo/ufo-local-scheduler.h b/ufo/ufo-local-scheduler.h index f31acef..1b56cee 100644 --- a/ufo/ufo-local-scheduler.h +++ b/ufo/ufo-local-scheduler.h @@ -24,7 +24,6 @@ #error "Only <ufo/ufo.h> can be included directly." #endif -#include <ufo/ufo-config.h> #include <ufo/ufo-task-graph.h> #include <ufo/ufo-base-scheduler.h> @@ -71,7 +70,7 @@ struct _UfoLocalSchedulerClass { UfoBaseSchedulerClass parent_class; }; -UfoBaseScheduler *ufo_local_scheduler_new (UfoConfig *config); +UfoBaseScheduler *ufo_local_scheduler_new (void); GType ufo_local_scheduler_get_type (void); GQuark ufo_local_scheduler_error_quark (void); diff --git a/ufo/ufo-plugin-manager.c b/ufo/ufo-plugin-manager.c index 3f5d03f..508344a 100644 --- a/ufo/ufo-plugin-manager.c +++ b/ufo/ufo-plugin-manager.c @@ -21,7 +21,6 @@ #include <gmodule.h> #include <glob.h> #include <ufo/ufo-plugin-manager.h> -#include <ufo/ufo-configurable.h> #include <ufo/ufo-task-node.h> #include <ufo/ufo-dummy-task.h> #include <ufo/ufo-json-routines.h> @@ -43,22 +42,20 @@ * UFO_PLUGIN_PATH environment variable. */ -G_DEFINE_TYPE_WITH_CODE (UfoPluginManager, ufo_plugin_manager, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (UFO_TYPE_CONFIGURABLE, NULL)) +G_DEFINE_TYPE (UfoPluginManager, ufo_plugin_manager, G_TYPE_OBJECT) #define UFO_PLUGIN_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), UFO_TYPE_PLUGIN_MANAGER, UfoPluginManagerPrivate)) typedef UfoNode* (* NewFunc) (void); struct _UfoPluginManagerPrivate { - GList *search_paths; + GList *paths; GSList *modules; GHashTable *new_funcs; /* maps from gchar* to NewFunc* */ }; enum { PROP_0, - PROP_CONFIG, N_PROPERTIES }; @@ -91,7 +88,7 @@ plugin_manager_get_path (UfoPluginManagerPrivate *priv, const gchar *name) } /* If it is not a path, search in all known paths */ - g_list_for (priv->search_paths, it) { + g_list_for (priv->paths, it) { gchar *path = g_build_filename ((gchar *) it->data, name, NULL); if (g_file_test (path, G_FILE_TEST_EXISTS)) @@ -103,35 +100,19 @@ plugin_manager_get_path (UfoPluginManagerPrivate *priv, const gchar *name) return NULL; } -static void -copy_config_paths (UfoPluginManagerPrivate *priv, UfoConfig *config) -{ - priv->search_paths = g_list_concat (priv->search_paths, ufo_config_get_paths (config)); -} - /** * ufo_plugin_manager_new: - * @config: (allow-none): A #UfoConfig object or %NULL. * - * Create a plugin manager object to instantiate filter objects. When a config - * object is passed to the constructor, its search-path property is added to the - * internal search paths. + * Create a plugin manager object to instantiate filter objects. * - * Return value: A new plugin manager object. + * Return value: A new #UfoPluginManager object. */ UfoPluginManager * -ufo_plugin_manager_new (UfoConfig *config) +ufo_plugin_manager_new (void) { - UfoPluginManager *manager; - - manager = UFO_PLUGIN_MANAGER (g_object_new (UFO_TYPE_PLUGIN_MANAGER, - "config", config, - NULL)); - - return manager; + return UFO_PLUGIN_MANAGER (g_object_new (UFO_TYPE_PLUGIN_MANAGER, NULL)); } - /** * ufo_plugin_manager_get_plugin: * @manager: A #UfoPluginManager @@ -144,7 +125,7 @@ ufo_plugin_manager_new (UfoConfig *config) * Returns: (transfer full): (allow-none): #gpointer or %NULL if module cannot be found */ gpointer -ufo_plugin_manager_get_plugin (UfoPluginManager *manager, +ufo_plugin_manager_get_plugin (UfoPluginManager *manager, const gchar *func_name, const gchar *module_name, GError **error) @@ -229,7 +210,7 @@ ufo_plugin_get_all_plugin_names (UfoPluginManager *manager, g_return_val_if_fail (UFO_IS_PLUGIN_MANAGER (manager), NULL); priv = manager->priv; - g_list_for (priv->search_paths, it) { + g_list_for (priv->paths, it) { glob_t glob_vector; gchar *pattern; @@ -255,52 +236,6 @@ ufo_plugin_get_all_plugin_names (UfoPluginManager *manager, } static void -ufo_plugin_manager_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) -{ - switch (property_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -ufo_plugin_manager_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) -{ - switch (property_id) { - case PROP_CONFIG: - { - GObject *value_object; - - value_object = g_value_get_object (value); - - if (value_object != NULL) { - UfoConfig *config; - - config = UFO_CONFIG (value_object); - copy_config_paths (UFO_PLUGIN_MANAGER_GET_PRIVATE (object), config); - } - } - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -ufo_plugin_manager_constructed (GObject *object) -{ - UfoPluginManagerPrivate *priv = UFO_PLUGIN_MANAGER_GET_PRIVATE (object); - - /* Always add default directories at end of search path */ - UfoConfig *config = ufo_config_new (); - copy_config_paths (priv, config); - g_object_unref (config); -} - -static void ufo_plugin_manager_finalize (GObject *gobject) { UfoPluginManager *manager = UFO_PLUGIN_MANAGER (gobject); @@ -313,11 +248,8 @@ ufo_plugin_manager_finalize (GObject *gobject) * manager is destroy before the graph which in turn would unref invalid * objects. So, we just don't close the modules and hope for the best. */ - /* g_slist_foreach (priv->modules, (GFunc) g_module_close, NULL); */ - /* g_slist_free (priv->modules); */ - g_list_foreach (priv->search_paths, (GFunc) g_free, NULL); - g_list_free (priv->search_paths); + g_list_free_full (priv->paths, g_free); g_hash_table_destroy (priv->new_funcs); G_OBJECT_CLASS (ufo_plugin_manager_parent_class)->finalize (gobject); @@ -326,28 +258,30 @@ ufo_plugin_manager_finalize (GObject *gobject) static void ufo_plugin_manager_class_init (UfoPluginManagerClass *klass) { - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - gobject_class->get_property = ufo_plugin_manager_get_property; - gobject_class->set_property = ufo_plugin_manager_set_property; - gobject_class->constructed = ufo_plugin_manager_constructed; - gobject_class->finalize = ufo_plugin_manager_finalize; + GObjectClass *oclass; - g_object_class_override_property (gobject_class, PROP_CONFIG, "config"); + oclass = G_OBJECT_CLASS (klass); + oclass->finalize = ufo_plugin_manager_finalize; g_type_class_add_private (klass, sizeof (UfoPluginManagerPrivate)); } static void -add_environment_paths(UfoPluginManagerPrivate *priv, const gchar *env) +add_environment_paths (UfoPluginManagerPrivate *priv, const gchar *env) { - if (!env) + gchar **paths; + + if (env == NULL) return; - gchar **paths = g_strsplit(env, ":", -1); + + paths = g_strsplit(env, ":", -1); + for (unsigned idx = 0; paths[idx]; ++idx) { /* Ignore empty paths */ if (*paths[idx]) - priv->search_paths = g_list_append (priv->search_paths, paths[idx]); + priv->paths = g_list_append (priv->paths, paths[idx]); } + g_free(paths); } @@ -359,9 +293,8 @@ ufo_plugin_manager_init (UfoPluginManager *manager) manager->priv = priv = UFO_PLUGIN_MANAGER_GET_PRIVATE (manager); priv->modules = NULL; - priv->search_paths = NULL; - priv->new_funcs = g_hash_table_new_full (g_str_hash, g_str_equal, - g_free, g_free); + priv->new_funcs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + priv->paths = g_list_append (priv->paths, g_strdup (UFO_PLUGIN_DIR)); add_environment_paths (priv, g_getenv (PATH_VAR)); } diff --git a/ufo/ufo-plugin-manager.h b/ufo/ufo-plugin-manager.h index e28c9bd..30be258 100644 --- a/ufo/ufo-plugin-manager.h +++ b/ufo/ufo-plugin-manager.h @@ -24,8 +24,6 @@ #error "Only <ufo/ufo.h> can be included directly." #endif -#include <ufo/ufo-configurable.h> -#include <ufo/ufo-config.h> #include <ufo/ufo-task-node.h> G_BEGIN_DECLS @@ -74,22 +72,19 @@ struct _UfoPluginManagerClass { GObjectClass parent_class; }; -UfoPluginManager * ufo_plugin_manager_new (UfoConfig *config); -gpointer ufo_plugin_manager_get_plugin (UfoPluginManager *manager, - const gchar *func_name, - const gchar *module_name, - GError **error); -GList * ufo_plugin_get_all_plugin_names (UfoPluginManager *manager, - const GRegex *filename_regex, - const gchar *filename_pattern); -GType ufo_plugin_manager_get_type (void); - - - +UfoPluginManager * ufo_plugin_manager_new (void); +gpointer ufo_plugin_manager_get_plugin (UfoPluginManager *manager, + const gchar *func_name, + const gchar *module_name, + GError **error); +GList * ufo_plugin_get_all_plugin_names (UfoPluginManager *manager, + const GRegex *filename_regex, + const gchar *filename_pattern); UfoTaskNode * ufo_plugin_manager_get_task (UfoPluginManager *manager, const gchar *name, GError **error); GList * ufo_plugin_manager_get_all_task_names (UfoPluginManager *manager); +GType ufo_plugin_manager_get_type (void); G_END_DECLS diff --git a/ufo/ufo-scheduler.h b/ufo/ufo-scheduler.h index 726a770..18813b2 100644 --- a/ufo/ufo-scheduler.h +++ b/ufo/ufo-scheduler.h @@ -25,7 +25,6 @@ #endif #include <ufo/ufo-base-scheduler.h> -#include <ufo/ufo-config.h> G_BEGIN_DECLS @@ -24,8 +24,6 @@ #include <ufo/ufo-arch-graph.h> #include <ufo/ufo-buffer.h> -#include <ufo/ufo-config.h> -#include <ufo/ufo-configurable.h> #include <ufo/ufo-copy-task.h> #include <ufo/ufo-cpu-node.h> #include <ufo/ufo-dummy-task.h> |