PluginArgSet.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:9k
- /*
- * ===========================================================================
- * PRODUCTION $Log: PluginArgSet.hpp,v $
- * PRODUCTION Revision 1000.1 2004/04/12 18:14:40 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.14
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: PluginArgSet.hpp,v 1000.1 2004/04/12 18:14:40 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:
- * CPluginArgSet -- defines an interface for a collection of arguments for a
- * plugin
- *
- * Remark:
- * This code was originally generated by application DATATOOL
- * using specifications from the data definition file
- * 'plugin.asn'.
- */
- #ifndef GUI_CORE_PLUGIN_PLUGINARGSET_HPP
- #define GUI_CORE_PLUGIN_PLUGINARGSET_HPP
- // generated includes
- #include <gui/plugin/PluginArgSet_.hpp>
- #include <gui/plugin/PluginArg.hpp>
- #include <gui/plugin/PluginValueConstraint.hpp>
- // generated classes
- BEGIN_NCBI_SCOPE
- BEGIN_objects_SCOPE // namespace ncbi::objects::
- //
- // class CPluginArgSet is the primary argument interface class.
- //
- class NCBI_XGBPLUGIN_EXPORT CPluginArgSet : public CPluginArgSet_Base
- {
- typedef CPluginArgSet_Base Tparent;
- public:
- // constructor
- CPluginArgSet(void);
- // destructor
- ~CPluginArgSet(void);
- // operator[] for indexing based on named argument
- // this will throw if the named argument isn't found
- const CPluginArg& operator[](const string& name) const;
- // operator[] for indexing based on named argument (non-const)
- // this will throw if the named argument isn't found
- CPluginArg& operator[](const string& name);
- // HasArgument() verifies that an argument exists
- bool HasArgument(const string& name) const;
- // add a named argument. This argument is required, and has no default
- // value. Attempts to access the value without setting the value will
- // result in an exception being thrown.
- CPluginArg& AddArgument(const string& name, const string& desc,
- CPluginArg::EType type,
- CPluginArg::TData::E_Choice single_or_array =
- CPluginArg::TData::e_Single);
- // add a named argument. This argument is required, and has no default
- // value. Attempts to access the value without setting the value will
- // result in an exception being thrown.
- CPluginArg& AddArgument(const string& name, const string& desc,
- const CTypeInfo* info,
- CPluginArg::TData::E_Choice single_or_array =
- CPluginArg::TData::e_Single);
- // Add a flag value. This is a helper API; the request is reformatted
- // and passed on to AddArgument()
- CPluginArg& AddFlag(const string& name, const string& desc);
- // Add a default argument to the set of arguments. This function creates a
- // named argument with a default value of type string.
- CPluginArg& AddDefaultArgument(const string& name,
- const string& description,
- CPluginArg::EType type, const string& val);
- // Add a flag argument with a default value. This is a helper API; the
- // request is reformatted and passed on to AddDefaultArgument
- CPluginArg& AddDefaultFlag(const string& name, const string& desc,
- bool val);
- // add an optional argument to the set of arguments. This supports an
- // optional default value argument. For non-built-in types, the default
- // value is ignored.
- CPluginArg&
- AddOptionalArgument(const string& name,
- const string& description,
- CPluginArg::EType type,
- CPluginArg::TData::E_Choice single_or_array =
- CPluginArg::TData::e_Array);
- CPluginArg&
- AddOptionalArgument(const string& name, const string& description,
- const CTypeInfo* info,
- CPluginArg::TData::E_Choice single_or_array =
- CPluginArg::TData::e_Array);
- // Set the constraint of a named argument. This will throw an exception if
- // the argument is not found, and will replace all previous constraints if
- // the argument is found
- void SetConstraint(const string& name, CPluginValueConstraint& constraint);
- // Add a constraint to a named argument. This will throw an exception if
- // the argument is not found
- void AddConstraint(const string& name, CPluginValueConstraint& constraint);
- private:
- // Prohibit copy constructor and assignment operator
- CPluginArgSet(const CPluginArgSet& value);
- CPluginArgSet& operator=(const CPluginArgSet& value);
- };
- /////////////////// CPluginArgSet inline methods
- // constructor
- inline
- CPluginArgSet::CPluginArgSet(void)
- {
- }
- /////////////////// end of CPluginArgSet inline methods
- END_objects_SCOPE // namespace ncbi::objects::
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- *
- * $Log: PluginArgSet.hpp,v $
- * Revision 1000.1 2004/04/12 18:14:40 gouriano
- * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.14
- *
- * Revision 1.14 2004/01/21 14:13:15 dicuccio
- * Added AddFlag() and AddDefaultFlag() - front-ends to AddArgument() and
- * AddDefaultArgument()
- *
- * Revision 1.13 2003/10/07 13:33:43 dicuccio
- * Renamed CPluginURL* to CPluginValue*. Dropped find_if.hpp. Moved validation
- * code into CPluginUtils.
- *
- * Revision 1.12 2003/07/23 17:52:24 dicuccio
- * Moved logic for validating arguments into CPluginUtils.
- *
- * Revision 1.11 2003/06/20 14:45:52 dicuccio
- * Revised handling of default arguments - now, all built-in argument types are
- * supported.
- *
- * Revision 1.10 2003/05/19 13:33:02 dicuccio
- * Moved gui/core/plugin --> gui/plugin/
- *
- * Revision 1.9 2003/05/09 16:43:25 dicuccio
- * Added HasArgument() - useful for (non-throwing) check to see if a set of
- * arguments contains a given named argument
- *
- * Revision 1.8 2003/04/30 13:52:45 dicuccio
- * Added interface for creating multiple constraints for a given argument
- *
- * Revision 1.7 2003/04/29 14:32:27 dicuccio
- * Added interface function to check validity of plugin arguments
- *
- * Revision 1.6 2003/04/25 14:13:17 dicuccio
- * Changed API for optional arguments - permit data model objects as optional
- * components; eliminate old "optional-and-default" combination
- *
- * Revision 1.5 2003/04/24 16:16:45 dicuccio
- * Clarified addition of arguments that take data model objects.
- *
- * Revision 1.4 2003/03/20 19:55:16 dicuccio
- * Removed dead code
- *
- * Revision 1.3 2003/03/20 19:54:47 dicuccio
- * Added non-const op[] for indexing - permits explicit setting of arguments
- *
- * Revision 1.2 2003/03/03 14:22:04 dicuccio
- * Added argument constraints - lower bound, upper bound, range, and member-of-set
- *
- * 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_PLUGINARGSET_HPP
- /* Original file checksum: lines: 93, chars: 2348, CRC32: 56c3af4a */