Query_Command_.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: Query_Command_.hpp,v $
- * PRODUCTION Revision 1000.1 2004/04/12 17:20:08 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.3
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: Query_Command_.hpp,v 1000.1 2004/04/12 17:20:08 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.
- *
- * ===========================================================================
- *
- * File Description:
- * This code is generated by application DATATOOL
- * using specifications from the data definition file
- * 'twebenv.asn'.
- *
- * ATTENTION:
- * Don't edit or check-in this file to the CVS as this file will
- * be overridden (by DATATOOL) without warning!
- * ===========================================================================
- */
- #ifndef QUERY_COMMAND_BASE_HPP
- #define QUERY_COMMAND_BASE_HPP
- // standard includes
- #include <serial/serialbase.hpp>
- // forward declarations
- class CQuery_Related;
- class CQuery_Search;
- class CQuery_Select;
- // generated classes
- class CQuery_Command_Base : public ncbi::CSerialObject
- {
- typedef ncbi::CSerialObject Tparent;
- public:
- // constructor
- CQuery_Command_Base(void);
- // destructor
- virtual ~CQuery_Command_Base(void);
- // type info
- DECLARE_INTERNAL_TYPE_INFO();
- // choice state enum
- enum E_Choice {
- e_not_set = 0,
- e_Search,
- e_Select,
- e_Related
- };
- enum E_ChoiceStopper {
- e_MaxChoice = 4 // == Related+1
- };
- // reset selection to none
- virtual void Reset(void);
- // choice state
- E_Choice Which(void) const;
- // throw exception if current selection is not as requested
- void CheckSelected(E_Choice index) const;
- // throw exception about wrong selection
- void ThrowInvalidSelection(E_Choice index) const;
- // return selection name (for diagnostic purposes)
- static std::string SelectionName(E_Choice index);
- // select requested variant if needed
- void Select(E_Choice index, ncbi::EResetVariant reset = ncbi::eDoResetVariant);
- // types
- typedef CQuery_Search TSearch;
- typedef CQuery_Select TSelect;
- typedef CQuery_Related TRelated;
- // getters
- // setters
- // typedef CQuery_Search TSearch
- bool IsSearch(void) const;
- const TSearch& GetSearch(void) const;
- TSearch& SetSearch(void);
- void SetSearch(TSearch& value);
- // typedef CQuery_Select TSelect
- bool IsSelect(void) const;
- const TSelect& GetSelect(void) const;
- TSelect& SetSelect(void);
- void SetSelect(TSelect& value);
- // typedef CQuery_Related TRelated
- bool IsRelated(void) const;
- const TRelated& GetRelated(void) const;
- TRelated& SetRelated(void);
- void SetRelated(TRelated& value);
- private:
- // copy constructor and assignment operator
- CQuery_Command_Base(const CQuery_Command_Base& );
- CQuery_Command_Base& operator=(const CQuery_Command_Base& );
- // choice state
- E_Choice m_choice;
- // helper methods
- void DoSelect(E_Choice index);
- static const char* const sm_SelectionNames[];
- // data
- NCBI_NS_NCBI::CSerialObject *m_object;
- };
- ///////////////////////////////////////////////////////////
- ///////////////////// inline methods //////////////////////
- ///////////////////////////////////////////////////////////
- inline
- CQuery_Command_Base::E_Choice CQuery_Command_Base::Which(void) const
- {
- return m_choice;
- }
- inline
- void CQuery_Command_Base::CheckSelected(E_Choice index) const
- {
- if ( m_choice != index )
- ThrowInvalidSelection(index);
- }
- inline
- void CQuery_Command_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset)
- {
- if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
- if ( m_choice != e_not_set )
- Reset();
- DoSelect(index);
- }
- }
- inline
- bool CQuery_Command_Base::IsSearch(void) const
- {
- return m_choice == e_Search;
- }
- inline
- bool CQuery_Command_Base::IsSelect(void) const
- {
- return m_choice == e_Select;
- }
- inline
- bool CQuery_Command_Base::IsRelated(void) const
- {
- return m_choice == e_Related;
- }
- ///////////////////////////////////////////////////////////
- ////////////////// end of inline methods //////////////////
- ///////////////////////////////////////////////////////////
- #endif // QUERY_COMMAND_BASE_HPP