📄 doc_loader.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: doc_loader.hpp,v $ * PRODUCTION Revision 1000.4 2004/04/12 18:12:12 gouriano * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.18 * PRODUCTION * =========================================================================== */#ifndef GUI_CORE___DATA_LOADER__HPP#define GUI_CORE___DATA_LOADER__HPP/* $Id: doc_loader.hpp,v 1000.4 2004/04/12 18:12:12 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: * Base class for all data loader plugins for GBENCH framework. */#include <gui/plugin/PluginCommand.hpp>#include <gui/plugin/PluginRequest.hpp>#include <gui/plugin/PluginReply.hpp>#include <gui/core/plugin.hpp>#include <gui/core/plugin_exception.hpp>#include <gui/core/doc_manager.hpp>BEGIN_NCBI_SCOPE//// Base class for all data loaders//template<typename LoaderType>class CDocLoader : public CPlugin<LoaderType>{public: // virtual destructor for proper inheritance virtual ~CDocLoader() { } virtual void RunCommand(objects::CPluginMessage& msg); // Load() is a virtual hook; this is called from the framework // when a document read is requested. virtual void Load(objects::CPluginMessage& msg) { NCBI_THROW(CPluginException, eNotSupported, "This plugin does not support the 'load' command"); } // Import() is a virtual hook; this is called from the // framework when a document read is requested. virtual void Import(objects::CPluginMessage& msg) { NCBI_THROW(CPluginException, eNotSupported, "This plugin does not support the 'import' command"); } // Save() is a virtual hook; this is called from the framework // when a document write is requested. virtual void Save(objects::CPluginMessage& msg) { NCBI_THROW(CPluginException, eNotSupported, "This plugin does not support the 'save' command"); } // Search() is a virtual hook; this is called from the // framework when a search is requested virtual void Search(objects::CPluginMessage& msg) { NCBI_THROW(CPluginException, eNotSupported, "This plugin does not support the 'search' command"); } // Manage() is a virtual hook; this is called from the // framework when a management interface is requested virtual void Manage(objects::CPluginMessage& msg) { NCBI_THROW(CPluginException, eNotSupported, "This plugin does not support the 'manage' command"); }};// template functions implementationstemplate<typename LoaderType>void CDocLoader<LoaderType>::RunCommand(objects::CPluginMessage& msg){ const objects::CPluginCommand& cmd = msg.GetRequest().GetCommand(); if ( !cmd.IsSetCommand() ) { NCBI_THROW(CPluginException, eInvalidCommand, "Command not set"); } switch ( cmd.GetCommand() ) { case objects::eDataCommand_load: Load(msg); CDocManager::UpdateAllViews(fDocumentCreated); break; case objects::eDataCommand_save: Save(msg); break; case objects::eDataCommand_import: Import(msg); CDocManager::UpdateAllViews(fDocumentCreated); break; case objects::eDataCommand_search: Search(msg); break; case objects::eDataCommand_manage: Manage(msg); break; default: break; }}END_NCBI_SCOPE/* * =========================================================================== * $Log: doc_loader.hpp,v $ * Revision 1000.4 2004/04/12 18:12:12 gouriano * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.18 * * Revision 1.18 2004/04/07 12:32:54 dicuccio * Code clean-up. Made all APIs public * * Revision 1.17 2003/12/22 19:11:09 dicuccio * Don't include the message queue (not needed) * * Revision 1.16 2003/11/18 17:35:08 dicuccio * Removed unnecessary scoping. * * Revision 1.15 2003/11/06 19:53:12 dicuccio * Added objects:: where needed * * Revision 1.14 2003/11/04 21:06:32 ucko * Properly qualify CPluginCommand with objects::. * * Revision 1.13 2003/11/04 17:09:04 dicuccio * Changed API to take a CPluginMessage instead of a paired command/reply * * Revision 1.12 2003/10/10 17:10:03 dicuccio * Cleaned up comments. Added new interface function for Import() command * (separated from Load()) * * Revision 1.11 2003/08/22 15:54:48 dicuccio * General clean-up: Removed unneeded export specifiers from templates; removed * 'USING_SCOPE(objects)' * * Revision 1.10 2003/07/31 16:40:43 dicuccio * Changed functions from pure virtual to virtual with default implementation that * throws an exception * * Revision 1.9 2003/07/14 10:57:27 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/05/19 13:32:43 dicuccio * Moved gui/core/plugin --> gui/plugin/ * * Revision 1.6 2003/02/24 13:00:17 dicuccio * Renamed classes in plugin spec: * CArgSeg --> CPluginArgSet * CArgument --> CPluginArg * CPluginArgs --> objects::CPluginCommand * CPluginCommands --> CPluginCommandSet * * Revision 1.5 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. * * Revision 1.4 2003/01/13 13:11:41 dicuccio * Namespace clean-up. Retired namespace gui -> converted to namespace ncbi. * Moved all FLUID-generated code into namespace ncbi. * * Revision 1.3 2002/12/30 17:48:27 dicuccio * Added mechanism for data loader plugins to announce supported modes of * operation (load, import, save currently) * * Revision 1.2 2002/12/19 18:13:02 dicuccio * Added export specifiers for Win32. * * Revision 1.1 2002/11/25 19:26:28 dicuccio * Initial revision. * * =========================================================================== */#endif // GUI_CORE___DATA_LOADER__HPP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -