- /*
- * ===========================================================================
- * PRODUCTION $Log: plugin_factory.hpp,v $
- * PRODUCTION Revision 1000.1 2003/11/18 15:43:56 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [ORIGINAL] Dev-tree R1.10
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_CORE___PLUGIN_FACTORY__HPP
- #define GUI_CORE___PLUGIN_FACTORY__HPP
- /* $Id: plugin_factory.hpp,v 1000.1 2003/11/18 15:43:56 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Mike DiCuccio
- *
- * File Description:
- * CPluginFactory -- abstract base class for plugin factories
- */
- #include <gui/core/plugin.hpp>
- #include <gui/plugin/PluginCommand.hpp>
- #include <gui/plugin/PluginCommandSet.hpp>
- #include <gui/plugin/PluginInfo.hpp>
- #include <gui/plugin/PluginReply.hpp>
- #include <gui/plugin/PluginRequest.hpp>
- BEGIN_NCBI_SCOPE
- //
- // class CPluginFactory defines the interface required of all plugin factories.
- //
- // This class is responsible for the creation of a plugin instance.
- // It serves as the entry point class for a given plugin library.
- //
- class NCBI_GUICORE_EXPORT CPluginFactoryBase
- {
- public:
- // this is a typedef for the main DLL entry point for a plugin
- typedef void (*FPluginEntryPoint)(list<CPluginFactoryBase*>&);
- // virtual destructor
- virtual ~CPluginFactoryBase();
- // GetInfo() is the hook for a derived plugin factory to fill in the
- // appropriate and required information. This is pure virtual as all
- // plugin factories must implement this function.
- virtual void GetInfo(objects::CPluginInfo& info) const = 0;
- virtual CPluginBase* GetPlugin(void) = 0;
- };
- //
- // templatized base class for all factory types
- //
- template <class PluginType>
- class CPluginFactory : public CPluginFactoryBase
- {
- public:
- // overloaded GetInfo() - we call a static function in our derived plugin
- // type. This static function is a requirement of all plugin
- // implementations.
- virtual void GetInfo(objects::CPluginInfo& info) const
- {
- PluginType::GetInfo(info);
- }
- virtual CPluginBase* GetPlugin(void) = 0;
- };
- //
- // macros to assist in setting up plugin entry points
- //
- #ifdef NCBI_OS_MSWIN
- # define NCBI_PLUGINENTRYPOINT_EXPORT __declspec(dllexport)
- #else
- # define NCBI_PLUGINENTRYPOINT_EXPORT
- #endif
- #define BEGIN_PLUGIN_REGISTRATION
- extern "C" {
- NCBI_PLUGINENTRYPOINT_EXPORT
- void NCBIGBenchGetPlugins(list<CPluginFactoryBase*>& plugins) {
- #define END_PLUGIN_REGISTRATION } }
- END_NCBI_SCOPE
- #endif // GUI_CORE___PLUGIN_FACTORY__HPP
- /*
- * ===========================================================================
- * $Log: plugin_factory.hpp,v $
- * Revision 1000.1 2003/11/18 15:43:56 gouriano
- * PRODUCTION: UPGRADED [ORIGINAL] Dev-tree R1.10
- *
- * Revision 1.10 2003/11/06 19:53:41 dicuccio
- * Removed USING_SCOPE(objects)
- *
- * Revision 1.9 2003/07/14 10:57:45 shomrat
- * Plugin messageing system related changes
- *
- * Revision 1.8 2003/06/25 16:59:41 dicuccio
- * Changed CPluginHandle into a pointer-to-implementation (the previous
- * implementation is now the pointer held). Lots of #include file clean-ups.
- *
- * Revision 1.7 2003/06/20 14:44:36 dicuccio
- * Revamped handling of plugin registration. All plugin factories now derive
- * from CPluginFactoryBase; CPluginFactory is a template. There is a new
- * requirement for derived plugin handlers of all types (each must implement a
- * static function of the form 'static void GetInfo(CPluginInfo&)')
- *
- * Revision 1.6 2003/05/19 13:32:43 dicuccio
- * Moved gui/core/plugin --> gui/plugin/
- *
- * Revision 1.5 2003/03/25 14:20:47 dicuccio
- * Changed export specifier from XGBPLUGIN to GUICORE
- *
- * Revision 1.4 2003/03/13 18:07:58 dicuccio
- * Added standard mechanism for processing plugin reply (view action is currently
- * the only handled action)
- *
- * Revision 1.3 2003/02/24 13:00:17 dicuccio
- * Renamed classes in plugin spec:
- * CArgSeg --> CPluginArgSet
- * CArgument --> CPluginArg
- * CPluginArgs --> CPluginCommand
- * CPluginCommands --> CPluginCommandSet
- *
- * Revision 1.2 2003/02/21 16:44:13 dicuccio
- * Added Win32 export specifiers for new plugin library. Fixed compilation
- * issues for Win32.
- *
- * Revision 1.1 2003/02/20 19:44:06 dicuccio
- * Created new plugin architecture, mediated via an ASN.1 spec. Moved GBENCH
- * framework over to use new plugin architecture.
- *
- * ===========================================================================
- */