/**
 * @file
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is part of The iWear Framework.
 *
 * The iWear Framework 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 as in version 2 of the License.

 * 
 * The iWear Framework 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
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __IWEAR_MODULEHANDLE_H
#define __IWEAR_MODULEHANDLE_H

#ifndef __IWEAR_PLUGINHANDLE_H
#include <iwear/pluginhandle.h>
#endif

namespace iwear
{
class Module;
class BaseModuleManager;
class ModuleHandle : public PluginHandle
{
public:
   /**
    * This call creates a module object which does not contain manager
    * pointers, so it must be passed to special manager functions.
    * @warning Due to various reasons you <b>MUST</b> pass the pointer to this
    * module to the destroy_module() function, otherwise you will mess up the
    * memory management. The most likely reason to call a usual delete on this
    * object is that ou will cause a segfault.
    */
    Module* create_module( BaseModuleManager* bmm );

   /**
    * This destroys the Module with the proper functions from the dynamic
    * library. Since these may differ from the functions within execution
    * context, all the Modules must be destroyed through the ModuleHandle they
    * were created from.
    */
    void destroy_module( Module* );

    const char * get_module_name( void );
    const char * get_module_version( void );

    ModuleHandle();
    ~ModuleHandle();
protected:
    
private:
    Module* (*c_m)(void);
    void (*d_m)( Module* );
    const char * (*m_n)( void );
    const char * (*m_v)( void );
};
}

#endif

