plugin.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
- /*
- * ===========================================================================
- * PRODUCTION $Log: plugin.cpp,v $
- * PRODUCTION Revision 1000.3 2004/06/01 20:44:13 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.14
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: plugin.cpp,v 1000.3 2004/06/01 20:44:13 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 <ncbi_pch.hpp>
- #include <corelib/ncbistd.hpp>
- #include <gui/utils/fltk_utils.hpp>
- #include <gui/core/plugin.hpp>
- #include <gui/core/plugin_exception.hpp>
- #include <gui/core/message_queue.hpp>
- #include <gui/plugin/PluginMessage.hpp>
- #include <gui/plugin/PluginInfo.hpp>
- #include <gui/plugin/PluginRequest.hpp>
- #include <gui/plugin/PluginReply.hpp>
- #include <gui/plugin/PluginCommandSet.hpp>
- BEGIN_NCBI_SCOPE
- USING_SCOPE(objects);
- // destructor
- CPluginBase::~CPluginBase(void)
- {
- }
- void CPluginBase::FinalizeArgs(CPluginMessage& msg)
- {
- }
- void CPluginBase::Execute(CPluginMessage& msg)
- {
- CFltkCursorGuard WAIT_GUARD;
- //const CPluginRequest& request = msg.GetRequest();
- RunCommand(msg);
- // meesage post-processing: making sure that
- // results go where they're supposed to.
- /**
- CRef<CPluginMessage> reply_msg(new CPluginMessage);
- CPluginReply& reply = reply_msg->SetType().SetReply();
- CPluginInfo my_info;
- GetPluginInfo(my_info);
- if ( my_info.IsSetClass_name() ) {
- reply_msg->SetSource(my_info.GetClass_name());
- }
- reply.SetRequest(const_cast<CPluginReply::TRequest&>(msg));
- // run the commands
- switch ( request.Which() ) {
- case CPluginRequest::e_Algo:
- break;
-
- case CPluginRequest::e_Data:
- RunCommand(request.GetData(), reply);
- break;
-
- case CPluginRequest::e_View:
- RunCommand(request.GetView(), reply);
- break;
- }
- // post the reply
- CPluginMessageQueue::Add(*reply_msg);
- }}
- break;
- }
- **/
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- *
- * $Log: plugin.cpp,v $
- * Revision 1000.3 2004/06/01 20:44:13 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.14
- *
- * Revision 1.14 2004/05/21 22:27:40 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.13 2004/01/15 22:50:16 jcherry
- * Added FinalizeArgs() for plugins
- *
- * Revision 1.12 2004/01/06 20:47:13 dicuccio
- * Added call to CFltkCursorGuard to invoke a wait cursor
- *
- * Revision 1.11 2003/11/04 17:17:37 dicuccio
- * Changed to match API requirements: pass CPluginMessage instead of paired command/reply
- *
- * Revision 1.10 2003/08/05 17:07:15 dicuccio
- * Changed calling semantics for the message queue - pass by reference, not
- * CConstRef<>
- *
- * Revision 1.9 2003/07/31 16:54:59 dicuccio
- * Changed name of message queue to be application agnostic
- *
- * Revision 1.8 2003/07/14 10:59:51 shomrat
- * Initial Revision
- *
- *
- * ===========================================================================
- */