PluginArg.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:9k
- /*
- * ===========================================================================
- * PRODUCTION $Log: PluginArg.hpp,v $
- * PRODUCTION Revision 1000.1 2004/04/12 18:14:37 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.18
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: PluginArg.hpp,v 1000.1 2004/04/12 18:14:37 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.
- *
- * ===========================================================================
- *
- * Author: Mike DiCuccio, Denis Vakatov, Anatoliy Kuznetsov
- *
- * File Description:
- * CPluginArg -- defines an interface for a single plugin argument
- *
- * Remark:
- * This code was originally generated by application DATATOOL
- * using specifications from the data definition file
- * 'plugin.asn'.
- */
- #ifndef GUI_CORE_PLUGIN_PLUGINARG_HPP
- #define GUI_CORE_PLUGIN_PLUGINARG_HPP
- // generated includes
- #include <gui/plugin/PluginArg_.hpp>
- // generated classes
- BEGIN_NCBI_SCOPE
- // predeclarations
- class CObject;
- class IDocument;
- BEGIN_objects_SCOPE // namespace ncbi::objects::
- class NCBI_XGBPLUGIN_EXPORT CPluginArg : public CPluginArg_Base
- {
- typedef CPluginArg_Base Tparent;
- public:
- // constructor
- CPluginArg(void);
- // destructor
- ~CPluginArg(void);
- // enumerated list of types we support
- enum EType {
- eNotSet,
- eBoolean,
- eDocument,
- eDouble,
- eInteger,
- eObject,
- eString,
- eFile,
- // this must be last!
- eMaxArg
- };
- // typedefs for collections of argument types
- // CPluginValue supports type-specific data retrieval of single entities
- // and also wraps the necessary document
- typedef list< CConstRef<CPluginValue> > TValues;
- // access the type for this argument
- EType GetType(void) const;
- // determine if this argument is empty (i.e., has all type information but
- // no values)
- bool IsEmpty(void) const;
- // clear any objects from object-based arguments
- void ClearObjects();
- // accessors for specific sub-components
- // in the event that the data type is list, NULL is returned
- const IDocument* GetDocument (void) const;
- const CObject* GetObject (void) const;
- // accessor for the object-specific type info
- // in the event the data type is list, the type info for the first
- // item is returned, as we guarantee that all items in a list will
- // be equivalently typed
- const string& GetObjectSubtype(void) const;
- // set this argument as an integer
- void SetBoolean(void);
- void SetBoolean(bool arg);
- void SetBoolean(const list<bool>& arg);
- bool AsBoolean (void) const;
- // set this argument as an integer
- void SetInteger(void);
- void SetInteger(const string& arg);
- void SetInteger(int arg);
- void SetInteger(const list<int>& arg);
- int AsInteger (void) const;
- // set this argument as a double
- void SetDouble(void);
- void SetDouble(const string& arg);
- void SetDouble(double arg);
- void SetDouble(const list<double>& arg);
- double AsDouble (void) const;
- // set this argument as a string
- void SetString(void);
- void SetString(const string& arg);
- void SetString(const list<string>& arg);
- const string& AsString (void) const;
- // set this argument as a file
- void SetFile(void);
- void SetFile(const string& arg);
- void SetFile(const list<string>& arg);
- const string& AsFile (void) const;
- // set this argument as a IDocument
- void SetDocument(void);
- void SetDocument(const IDocument& arg);
- void SetDocument(const TValues& arg);
- const IDocument& AsDocument (void) const;
- // set this argument as a CObject. There are multiple forms of this;
- // we provide for the passing in of a CTypeInfo object that provides
- // additional information, specifically about CSerialObject-derived
- // objects
- void SetObject(const string& type);
- void SetObject(const CTypeInfo* info = NULL);
- void SetObject(const IDocument& doc, const CObject& arg);
- void SetObject(const TValues& arg);
- const CObject& AsObject (void) const;
- // insure that this argument can accept a list of its current type
- void SetList(void);
- void SetList(const TValues& values);
- void AsList(TValues& values) const;
- private:
- // Prohibit copy constructor and assignment operator
- CPluginArg(const CPluginArg& value);
- CPluginArg& operator=(const CPluginArg& value);
- };
- /////////////////// CPluginArg inline methods
- // constructor
- inline
- CPluginArg::CPluginArg(void)
- {
- }
- /////////////////// end of CPluginArg inline methods
- END_objects_SCOPE // namespace ncbi::objects::
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- *
- * $Log: PluginArg.hpp,v $
- * Revision 1000.1 2004/04/12 18:14:37 gouriano
- * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.18
- *
- * Revision 1.18 2004/02/03 21:23:09 dicuccio
- * Added ClearObjects(). Added SetObjects() with string-based descriptor
- *
- * Revision 1.17 2003/12/23 20:23:22 jcherry
- * Make argument values persist across invocations of plugin
- *
- * Revision 1.16 2003/12/16 20:39:48 jcherry
- * Added support for plugin arguments of type file
- *
- * Revision 1.15 2003/10/27 17:30:38 dicuccio
- * Formatting changes. Changed return value of SetString() to be const ref, not
- * value
- *
- * Revision 1.14 2003/10/07 13:33:43 dicuccio
- * Renamed CPluginURL* to CPluginValue*. Dropped find_if.hpp. Moved validation
- * code into CPluginUtils.
- *
- * Revision 1.13 2003/09/04 14:00:27 dicuccio
- * Introduce IDocument and IView as abstract base classes. Use IDocument instead
- * of CDocument.
- *
- * Revision 1.12 2003/07/23 17:52:24 dicuccio
- * Moved logic for validating arguments into CPluginUtils.
- *
- * Revision 1.11 2003/07/22 15:27:51 dicuccio
- * Dropped support for CSeqVector as an explicitly handled argument type
- *
- * Revision 1.10 2003/05/19 13:33:02 dicuccio
- * Moved gui/core/plugin --> gui/plugin/
- *
- * Revision 1.9 2003/05/09 16:42:26 dicuccio
- * Added an IsEmpty() test to see if no value has been entered - useful check for
- * optional arguments
- *
- * Revision 1.8 2003/04/29 14:31:55 dicuccio
- * Removed lots of dead code. Added function to wrap checking constraints against
- * object types
- *
- * Revision 1.7 2003/04/24 16:16:13 dicuccio
- * Simplified argument type access - eliminated most object derived types in favor
- * of a more generic type mechanism. Added boolean types
- *
- * Revision 1.6 2003/03/25 19:37:50 dicuccio
- * Added CSeq_annot as a named type
- *
- * Revision 1.5 2003/03/10 16:02:47 dicuccio
- * Added accessors for an arguments URL (or set of URLs)'s document and abstract
- * object
- *
- * Revision 1.4 2003/03/03 14:22:04 dicuccio
- * Added argument constraints - lower bound, upper bound, range, and member-of-set
- *
- * Revision 1.3 2003/02/26 14:34:18 dicuccio
- * Changed all setters to take const arguments - relieves need to use const_cast<>
- * outside of the plugin framework. Added beefed up argument validation.
- *
- * Revision 1.2 2003/02/25 14:42:17 dicuccio
- * Changed internal sotrage mechanism for plugin URL - confogrms more closely to
- * URL spec (addresses look like 'gbdata://PluginValue/Document=0xaddr&...')
- *
- * Revision 1.1 2003/02/24 13:00:18 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_PLUGINARG_HPP
- /* Original file checksum: lines: 93, chars: 2382, CRC32: fb41a3 */