📄 plugin_utils.hpp
字号:
//// GetArgValue() offers simple, one-step conversion to a given argument type.// The default template assumes that the converted type derives from// CSerialObject.//template <class T>inlinevoid GetArgValue(const objects::CPluginArg& arg, list< pair< CConstRef<IDocument>, CConstRef<T> > >& objs){ CTypeConstIterator<objects::CPluginValue> iter(arg); for ( ; iter; ++iter) { CConstRef<IDocument> doc(iter->GetDocument()); CConstRef<CObject> obj(iter->GetObject()); if ( !doc || !obj ) { continue; } CObjectConverter::TObjList obj_list; CObjectConverter::Convert(doc->GetScope(), *obj, T::GetTypeInfo(), obj_list); ITERATE (CObjectConverter::TObjList, obj_iter, obj_list) { CConstRef<T> ref(dynamic_cast<const T*> (obj_iter->GetPointer())); if (ref) { objs.push_back(make_pair(doc, ref)); } } }}//// Specialization of GetArgValue for document types//template <>inlinevoid GetArgValue(const objects::CPluginArg& arg, list< pair< CConstRef<IDocument>, CConstRef<IDocument> > >& objs){ CTypeConstIterator<objects::CPluginValue> iter(arg); for ( ; iter; ++iter) { CConstRef<IDocument> doc(iter->GetDocument()); CConstRef<CObject> obj(iter->GetObject()); if ( !doc || !obj ) { continue; } CObjectConverter::TObjList obj_list; CObjectConverter::Convert(doc->GetScope(), *obj, "IDocument", obj_list); ITERATE (CObjectConverter::TObjList, obj_iter, obj_list) { CConstRef<IDocument> ref(dynamic_cast<const IDocument*> (obj_iter->GetPointer())); if (ref) { objs.push_back(make_pair(doc, ref)); } } }}//// Specialization of GetArgValue for generic CObject types//template <>inlinevoid GetArgValue(const objects::CPluginArg& arg, list< pair< CConstRef<IDocument>, CConstRef<CObject> > >& objs){ CTypeConstIterator<objects::CPluginValue> iter(arg); for ( ; iter; ++iter) { CConstRef<IDocument> doc(iter->GetDocument()); CConstRef<CObject> obj(iter->GetObject()); if ( !doc || !obj ) { continue; } objs.push_back(make_pair(doc, obj)); }}END_NCBI_SCOPE/* * =========================================================================== * $Log: plugin_utils.hpp,v $ * Revision 1000.4 2004/04/12 18:12:51 gouriano * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.44 * * Revision 1.44 2004/04/07 12:36:02 dicuccio * Dropped CSelectionBuffer::TSelList in favor of TConstScopedObjects. Altered * CallPlugin API - added default IReporter*. Removed unneeded #includes * * Revision 1.43 2004/01/27 18:27:59 dicuccio * Code clean-up. Removed unneeded headers. Added new typedefs for alignment, * annotation lists * * Revision 1.42 2004/01/21 12:38:17 dicuccio * redesigned CObjectCOnverter API to eliminate temporary object creation * * Revision 1.41 2004/01/07 15:46:16 dicuccio * Renamed GetObjectLabel() to GetLabel(). Changed calling semantics to more * closely follow other label extraction functions * * Revision 1.40 2003/12/22 19:13:00 dicuccio * Don't include the message queue - not needed * * Revision 1.39 2003/11/18 17:36:47 dicuccio * Cleaned up some comments. Added new FitArgs() API to take a set of * CPluginValues * * Revision 1.38 2003/11/06 19:57:57 dicuccio * Removed USING_SCOPE(objects). Changed API for CallPlugin() - added optiona * context parameter * * Revision 1.37 2003/11/04 17:13:14 dicuccio * Added new default parameter to force calling of plugins immediately or use * dispatch mechanism. Removed templates from header - moved to private * implementation * * Revision 1.36 2003/10/15 18:30:58 dicuccio * Added optional conversion cache argument to CheckConstraints() * * Revision 1.35 2003/10/10 17:12:25 dicuccio * Added optional arg to CanFitArgs() for object conversion cache * * Revision 1.34 2003/10/07 13:33:01 dicuccio * Changed CPluginURL* to CPluginValue*. Code clean-up; moved validation code out * of xgbplugin and into plugin_utils.cpp * * Revision 1.33 2003/09/16 14:04:06 dicuccio * Made private constraint checking function public * * Revision 1.32 2003/09/04 14:00:26 dicuccio * Introduce IDocument and IView as abstract base classes. Use IDocument instead * of CDocument. * * Revision 1.31 2003/09/03 14:49:02 rsmith * change namespace name from args to plugin_args to avoid clashes with variable names. * * Revision 1.30 2003/08/22 17:28:35 dicuccio * Moved prototypes for conversion routines to .cpp file * * Revision 1.29 2003/08/21 12:14:01 dicuccio * Added new typedefs for standard argument objects containers * * Revision 1.28 2003/08/19 18:51:44 friedman * Added the follwing conversion functionclality to Convert: * doc -> seq-annot, bioseq -> seq-annot, seq-id -> seq-annot, * seq-loc -> seq-annot, seq-entry -> seq-annot, doc -> seq-align * * Revision 1.27 2003/08/05 16:58:39 dicuccio * Changed calling conventions for plugin message queue - pass by reference, not * CConstRef<> * * Revision 1.26 2003/07/31 16:42:29 dicuccio * Changed calling semantics of CallPlugin() to permit calling a plugin with no * selections * * Revision 1.25 2003/07/25 13:41:08 dicuccio * Removed duplicated comment * * Revision 1.24 2003/07/24 13:11:00 dicuccio * Added basic bioseq conversions * * Revision 1.23 2003/07/23 17:52:23 dicuccio * Moved logic for validating arguments into CPluginUtils. * * Revision 1.22 2003/07/22 15:27:10 dicuccio * Changed Convert() to perform one-to-many conversions. Moved GetObjectLabel() * from a static internal function of plugin_arg_dialog.cpp to a member of * CPluginUtils * * Revision 1.21 2003/07/21 19:19:40 dicuccio * Added an interface to check if a selection buffer can fit into a set of args * * Revision 1.20 2003/07/14 10:57:52 shomrat * Plugin messageing system related changes * * Revision 1.19 2003/06/30 13:43:37 dicuccio * Added API to call a plugin directly with a CPluginRequest object * * Revision 1.18 2003/06/26 15:32:01 dicuccio * Moved GetURLValue() from PluginURL.hpp to plugin_utils.hpp - relieves one * circular dependency betweein gui/gqplugin and gui/core/ * * Revision 1.17 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.16 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.15 2003/06/02 16:01:29 dicuccio * Rearranged include/objects/ subtree. This includes the following shifts: * - include/objects/alnmgr --> include/objtools/alnmgr * - include/objects/cddalignview --> include/objtools/cddalignview * - include/objects/flat --> include/objtools/flat * - include/objects/objmgr/ --> include/objmgr/ * - include/objects/util/ --> include/objmgr/util/ * - include/objects/validator --> include/objtools/validator * * Revision 1.14 2003/05/19 13:32:43 dicuccio * Moved gui/core/plugin --> gui/plugin/ * * Revision 1.13 2003/05/06 15:51:07 dicuccio * Dropped identity object conversions in favor of a generic approach * * Revision 1.12 2003/05/05 12:39:59 dicuccio * Added new interface function 9CanFitArgs()) for testing whether a group of * selections or objects could possibly apply to a set of arguments * * Revision 1.11 2003/05/01 12:53:06 dicuccio * Added conversion routines for {doc,seq-id,seq-loc,seq-feat} -> seq-entry * * Revision 1.10 2003/04/29 14:30:37 dicuccio * Made main object conversion function public. Changed SelectionsToArgs() -> * FillArgs() and added a second interface that wraps filling arguments with * just a document * * Revision 1.9 2003/04/24 16:13:13 dicuccio * Large revision. Added many new interface functions to handle object * cats/conversion; simplified filling out of plugin arguments * * Revision 1.8 2003/04/16 20:11:29 dicuccio * Added missing #include for CPluginException * * Revision 1.7 2003/04/16 18:16:17 dicuccio * Added CallPlugin() methods to explicitly call plugins by name or plugin * handle * * Revision 1.6 2003/03/25 14:20:47 dicuccio * Changed export specifier from XGBPLUGIN to GUICORE * * Revision 1.5 2003/03/25 13:05:45 dicuccio * Changed SelBufferToArgs() to return the number of unset arguments - used to * determine if automated argument processing can continue. * * Revision 1.4 2003/02/26 14:33:21 dicuccio * Major rewrite. Most common cases of selection buffer-to-arguments should now * work automatically, but there is still no manual fall-back. * * 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. * * =========================================================================== */#endif // GUI_CORE___PLUGIN_UTILS__HPP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -