/* -*- mia-c++ -*-
*
* Copyright (c) 2007 Gert Wollny <gert dot wollny at acm dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef ph_modules_hh
#define ph_modules_hh
#include <gmodule.h>
#include <mia/core/defines.hh>
#include <mia/core/plugin_base.hh>
NS_MIA_BEGIN
using namespace std;
/// definition of the Plugin interface loading function
typedef CPluginBase* (*FPluginInterface)(void);
/** \class CPluginModule
The plugin module loading class
*/
class CPluginModule {
public:
/**
Constructor that takes the path to the module, tries to open it, and will throw
an \a invalid_argument exception, if the module can not be loaded
*/
CPluginModule(const char *path);
/**
The destructor does currently nothing. It is supposed to unload the module, however,
a sophisticated ref-counting would be needed to ensure that the modules is only unloaded
when all plug-ins using code from this module are destroyed.
*/
~CPluginModule();
/**
\returns the plug-in object implemented in the module or NULL, if the module does not
proide such plug-in
*/
CPluginBase *get_interface() const;
private:
GModule* _M_module;
};
NS_MIA_END
#endif