- /*
- * ===========================================================================
- * PRODUCTION $Log: plugin.hpp,v $
- * PRODUCTION Revision 1000.2 2004/04/12 18:12:39 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.16
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_PLUGIN_PLUGIN_HPP
- #define GUI_PLUGIN_PLUGIN_HPP
- /* $Id: plugin.hpp,v 1000.2 2004/04/12 18:12:39 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: Mati Shomrat
- *
- * File Description:
- * CPlugin - defines a base interface for all plugins
- */
- #include <corelib/ncbistd.hpp>
- #include <gui/utils/reporter.hpp>
- #include <gui/plugin/PluginMessage.hpp>
- BEGIN_NCBI_SCOPE
- BEGIN_SCOPE(objects)
- class CPluginMessage;
- class CPluginInfo;
- END_SCOPE(objects)
- class NCBI_GUICORE_EXPORT CPluginBase : public CObject
- {
- public:
- // pass a message to the plugin
- // This function will perform validation on the message and delegate
- // actual handling to user overiden methods.
- void Execute(objects::CPluginMessage& msg);
- // get the plugin's info
- virtual void GetPluginInfo(objects::CPluginInfo& info) const = 0;
- // Finalize the arguments (gets called just before argument dialog).
- // Version defined here does nothing; subclasses should override
- // if they want to do something.
- virtual void FinalizeArgs(objects::CPluginMessage& msg);
- // destructor
- virtual ~CPluginBase(void);
- protected:
- // Handles commands to the plugins.
- virtual void RunCommand(objects::CPluginMessage& msg) = 0;
- };
- template<typename PluginType>
- class CPlugin : public CPluginBase
- {
- 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 GetPluginInfo(objects::CPluginInfo& info) const
- {
- PluginType::GetInfo(info);
- }
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- *
- * $Log: plugin.hpp,v $
- * Revision 1000.2 2004/04/12 18:12:39 gouriano
- * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.16
- *
- * Revision 1.16 2004/04/07 12:34:15 dicuccio
- * +ireporter.hpp
- *
- * Revision 1.15 2004/01/15 22:50:18 jcherry
- * Added FinalizeArgs() for plugins
- *
- * Revision 1.14 2003/11/04 17:11:51 dicuccio
- * Code clean-up. Changed API to take a CPluginMessage directly.
- *
- * Revision 1.13 2003/08/22 15:54:48 dicuccio
- * General clean-up: Removed unneeded export specifiers from templates; removed
- * 'USING_SCOPE(objects)'
- *
- * Revision 1.12 2003/08/05 16:58:39 dicuccio
- * Changed calling conventions for plugin message queue - pass by reference, not
- * CConstRef<>
- *
- * Revision 1.11 2003/07/14 10:52:25 shomrat
- * Initial Revision
- *
- *
- * ===========================================================================
- */
- #endif // GUI_PLUGIN_PLUGIN_HPP