From 26393bbec7a6255ce1dadb70dfedc00a9838c026 Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <manu@manu-eeepc.(none)> Date: Sun, 25 Jan 2009 12:36:53 -0500 Subject: [PATCH] Build template architecture for the plugin manager --- autogen.sh | 2 +- configure.ac | 7 +++--- src/Makefile.am | 2 +- src/plug-in/Makefile.am | 5 +++++ src/plug-in/plugin.cpp | 26 ++++++++++++++++++++++ src/plug-in/plugin.h | 41 +++++++++++++++++++++++++++++++++++ src/plug-in/pluginmanager.cpp | 6 +++++ src/plug-in/pluginmanager.h | 33 ++++++++++++++++++++++++++++ 8 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 src/plug-in/Makefile.am create mode 100644 src/plug-in/plugin.cpp create mode 100644 src/plug-in/plugin.h create mode 100644 src/plug-in/pluginmanager.cpp create mode 100644 src/plug-in/pluginmanager.h diff --git a/autogen.sh b/autogen.sh index 06b6a97c95..ac85bd137c 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,6 +4,6 @@ aclocal -I m4 libtoolize --force autoheader -autoconf -f +autoconf -v -f automake -a ./configure $@ diff --git a/configure.ac b/configure.ac index d9b4ed6dd9..3cb974e0f6 100644 --- a/configure.ac +++ b/configure.ac @@ -2,8 +2,8 @@ dnl SFLPhone - configure.ac for automake 1.9 and autoconf 2.59 dnl dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([SFLPhone],[0.7],[sflphoneteam@savoirfairelinux.com],[sflphone]) -AC_COPYRIGHT([[Copyright (c) Savoir-Faire Linux 2004-2008]]) +AC_INIT([SFLPhone],[0.9.2-7],[sflphoneteam@savoirfairelinux.com],[sflphone]) +AC_COPYRIGHT([[Copyright (c) Savoir-Faire Linux 2004-2009]]) AC_REVISION([$Revision$]) dnl Compute canonical system name @@ -37,7 +37,8 @@ AC_CONFIG_FILES([src/Makefile \ src/audio/codecs/ilbc/Makefile \ src/config/Makefile \ src/dbus/Makefile \ - src/zeroconf/Makefile]) + src/zeroconf/Makefile \ + src/plug-in/Makefile]) dnl Unitary test section AC_CONFIG_FILES([test/Makefile]) diff --git a/src/Makefile.am b/src/Makefile.am index 5be031174c..f9af16aafd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,7 +23,7 @@ IAXSOURCES = IAXHEADERS = endif -SUBDIRS = audio config dbus $(ZEROCONFDIR) +SUBDIRS = audio config dbus $(ZEROCONFDIR) plug-in # Add here the cpp files to be build with sflphone sflphoned_SOURCES = \ diff --git a/src/plug-in/Makefile.am b/src/plug-in/Makefile.am new file mode 100644 index 0000000000..de286d046c --- /dev/null +++ b/src/plug-in/Makefile.am @@ -0,0 +1,5 @@ +noinst_LTLIBRARIES = libplugin.la + +libplugin_la_SOURCES = \ + pluginmanager.cpp + plugin.cpp diff --git a/src/plug-in/plugin.cpp b/src/plug-in/plugin.cpp new file mode 100644 index 0000000000..bc7cf18c38 --- /dev/null +++ b/src/plug-in/plugin.cpp @@ -0,0 +1,26 @@ +#include "plugin.h" + +Plugin::Plugin( const std::string &filename ) +{ + //TODO IMPLEMENT +} + +Plugin::Plugin( const Plugin &plugin ) +{ + //TODO IMPLEMENT +} + +Plugin::~Plugin() +{ + //TODO IMPLEMENT +} + +int Plugin::getCoreVersion( void ) +{ + //TODO IMPLEMENT +} + +void Plugin::registerPlugin( PluginManager & ) +{ + //TODO IMPLEMENT +} diff --git a/src/plug-in/plugin.h b/src/plug-in/plugin.h new file mode 100644 index 0000000000..5c825f872f --- /dev/null +++ b/src/plug-in/plugin.h @@ -0,0 +1,41 @@ +#ifndef PLUGIN_H +#define PLUGIN_H + +#include <string> + +/* + * @file plugin.h + * @brief Define a plugin object + */ + +namespace sflphone { + +class PluginManager; + + class Plugin { + + public: + Plugin( const std::string &filename ); + Plugin( const Plugin &plugin ); + ~Plugin(); + + public: + /** + * Return the minimal core version required so that the plugin could work + * @return int The version required + */ + int getCoreVersion() const; + + /** + * Register the plugin to the plugin manager + */ + void registerPlugin( PluginManager & ); + + private: + Plugin &operator =(const Plugin &plugin); + + }; +} + +#endif //PLUGIN_H + diff --git a/src/plug-in/pluginmanager.cpp b/src/plug-in/pluginmanager.cpp new file mode 100644 index 0000000000..9c792dc3ff --- /dev/null +++ b/src/plug-in/pluginmanager.cpp @@ -0,0 +1,6 @@ +#include "pluginmanager.h" + +void ::sflphone::PluginManager::loadPlugins( const std::string &path ) +{ + //TODO IMPLEMENT +} diff --git a/src/plug-in/pluginmanager.h b/src/plug-in/pluginmanager.h new file mode 100644 index 0000000000..d91d115d49 --- /dev/null +++ b/src/plug-in/pluginmanager.h @@ -0,0 +1,33 @@ +#ifndef PLUGIN_MANAGER_H +#define PLUGIN_MANAGER_H + +/* + * @file pluginmanager.h + * @brief Base class of the plugin manager + */ + +#include "plugin.h" + +#include <map> +#include <string> + +namespace sflphone { + + class PluginManager { + + public: + /** + * Load all the plugins found in a specific directory + * @param path The absolute path to the directory + */ + void loadPlugins( const std::string &path ); + + private: + /* Map of plugins associated by their string name */ + typedef std::map<std::string, ::sflphone::Plugin> pluginMap; + + pluginMap _loadedPlugins; + }; +} + +#endif //PLUGIN_MANAGER_H -- GitLab