Query_Related_.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:10k
- /*
- * ===========================================================================
- * PRODUCTION $Log: Query_Related_.hpp,v $
- * PRODUCTION Revision 1000.1 2004/04/12 17:20:20 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.5
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: Query_Related_.hpp,v 1000.1 2004/04/12 17:20:20 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_RELATED_BASE_HPP
- #define QUERY_RELATED_BASE_HPP
- // standard includes
- #include <serial/serialbase.hpp>
- // generated includes
- #include <string>
- // forward declarations
- class CItem_Set;
- class CQuery_Command;
- // generated classes
- class CQuery_Related_Base : public ncbi::CSerialObject
- {
- typedef ncbi::CSerialObject Tparent;
- public:
- // constructor
- CQuery_Related_Base(void);
- // destructor
- virtual ~CQuery_Related_Base(void);
- // type info
- DECLARE_INTERNAL_TYPE_INFO();
- class C_Items : public ncbi::CSerialObject
- {
- typedef ncbi::CSerialObject Tparent;
- public:
- // constructor
- C_Items(void);
- // destructor
- ~C_Items(void);
-
- // type info
- DECLARE_INTERNAL_TYPE_INFO();
-
- // choice state enum
- enum E_Choice {
- e_not_set = 0,
- e_Items,
- e_ItemCount
- };
- enum E_ChoiceStopper {
- e_MaxChoice = 3 // == ItemCount+1
- };
-
- // reset selection to none
- 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 CItem_Set TItems;
- typedef int TItemCount;
-
- // getters
- // setters
-
- // typedef CItem_Set TItems
- bool IsItems(void) const;
- const TItems& GetItems(void) const;
- TItems& SetItems(void);
- void SetItems(TItems& value);
-
- // typedef int TItemCount
- bool IsItemCount(void) const;
- TItemCount GetItemCount(void) const;
- TItemCount& SetItemCount(void);
- void SetItemCount(const TItemCount& value);
-
-
- private:
- // copy constructor and assignment operator
- C_Items(const C_Items& );
- C_Items& operator=(const C_Items& );
-
- // choice state
- E_Choice m_choice;
- // helper methods
- void DoSelect(E_Choice index);
-
- static const char* const sm_SelectionNames[];
- // data
- union {
- TItemCount m_ItemCount;
- NCBI_NS_NCBI::CSerialObject *m_object;
- };
- };
- // types
- typedef CQuery_Command TBase;
- typedef std::string TRelation;
- typedef std::string TDb;
- typedef C_Items TItems;
- // getters
- // setters
- // mandatory
- // typedef CQuery_Command TBase
- bool IsSetBase(void) const;
- bool CanGetBase(void) const;
- void ResetBase(void);
- const TBase& GetBase(void) const;
- void SetBase(TBase& value);
- TBase& SetBase(void);
- // mandatory
- // typedef std::string TRelation
- bool IsSetRelation(void) const;
- bool CanGetRelation(void) const;
- void ResetRelation(void);
- const TRelation& GetRelation(void) const;
- void SetRelation(const TRelation& value);
- TRelation& SetRelation(void);
- // mandatory
- // typedef std::string TDb
- bool IsSetDb(void) const;
- bool CanGetDb(void) const;
- void ResetDb(void);
- const TDb& GetDb(void) const;
- void SetDb(const TDb& value);
- TDb& SetDb(void);
- // mandatory
- // typedef C_Items TItems
- bool IsSetItems(void) const;
- bool CanGetItems(void) const;
- void ResetItems(void);
- const TItems& GetItems(void) const;
- void SetItems(TItems& value);
- TItems& SetItems(void);
- // reset whole object
- virtual void Reset(void);
- private:
- // Prohibit copy constructor and assignment operator
- CQuery_Related_Base(const CQuery_Related_Base&);
- CQuery_Related_Base& operator=(const CQuery_Related_Base&);
- // data
- Uint4 m_set_State[1];
- ncbi::CRef< TBase > m_Base;
- TRelation m_Relation;
- TDb m_Db;
- ncbi::CRef< TItems > m_Items;
- };
- ///////////////////////////////////////////////////////////
- ///////////////////// inline methods //////////////////////
- ///////////////////////////////////////////////////////////
- inline
- CQuery_Related_Base::C_Items::E_Choice CQuery_Related_Base::C_Items::Which(void) const
- {
- return m_choice;
- }
- inline
- void CQuery_Related_Base::C_Items::CheckSelected(E_Choice index) const
- {
- if ( m_choice != index )
- ThrowInvalidSelection(index);
- }
- inline
- void CQuery_Related_Base::C_Items::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_Related_Base::C_Items::IsItems(void) const
- {
- return m_choice == e_Items;
- }
- inline
- bool CQuery_Related_Base::C_Items::IsItemCount(void) const
- {
- return m_choice == e_ItemCount;
- }
- inline
- int CQuery_Related_Base::C_Items::GetItemCount(void) const
- {
- CheckSelected(e_ItemCount);
- return m_ItemCount;
- }
- inline
- int& CQuery_Related_Base::C_Items::SetItemCount(void)
- {
- Select(e_ItemCount, NCBI_NS_NCBI::eDoNotResetVariant);
- return m_ItemCount;
- }
- inline
- void CQuery_Related_Base::C_Items::SetItemCount(const int& value)
- {
- Select(e_ItemCount, NCBI_NS_NCBI::eDoNotResetVariant);
- m_ItemCount = value;
- }
- inline
- bool CQuery_Related_Base::IsSetBase(void) const
- {
- return m_Base;
- }
- inline
- bool CQuery_Related_Base::CanGetBase(void) const
- {
- return IsSetBase();
- }
- inline
- const CQuery_Command& CQuery_Related_Base::GetBase(void) const
- {
- if (!CanGetBase()) {
- ThrowUnassigned(0);
- }
- return (*m_Base);
- }
- inline
- CQuery_Command& CQuery_Related_Base::SetBase(void)
- {
- return (*m_Base);
- }
- inline
- bool CQuery_Related_Base::IsSetRelation(void) const
- {
- return ((m_set_State[0] & 0xc) != 0);
- }
- inline
- bool CQuery_Related_Base::CanGetRelation(void) const
- {
- return IsSetRelation();
- }
- inline
- const std::string& CQuery_Related_Base::GetRelation(void) const
- {
- if (!CanGetRelation()) {
- ThrowUnassigned(1);
- }
- return m_Relation;
- }
- inline
- void CQuery_Related_Base::SetRelation(const std::string& value)
- {
- m_Relation = value;
- m_set_State[0] |= 0xc;
- }
- inline
- std::string& CQuery_Related_Base::SetRelation(void)
- {
- #ifdef _DEBUG
- if (!IsSetRelation()) {
- m_Relation = ms_UnassignedStr;
- }
- #endif
- m_set_State[0] |= 0x4;
- return m_Relation;
- }
- inline
- bool CQuery_Related_Base::IsSetDb(void) const
- {
- return ((m_set_State[0] & 0x30) != 0);
- }
- inline
- bool CQuery_Related_Base::CanGetDb(void) const
- {
- return IsSetDb();
- }
- inline
- const std::string& CQuery_Related_Base::GetDb(void) const
- {
- if (!CanGetDb()) {
- ThrowUnassigned(2);
- }
- return m_Db;
- }
- inline
- void CQuery_Related_Base::SetDb(const std::string& value)
- {
- m_Db = value;
- m_set_State[0] |= 0x30;
- }
- inline
- std::string& CQuery_Related_Base::SetDb(void)
- {
- #ifdef _DEBUG
- if (!IsSetDb()) {
- m_Db = ms_UnassignedStr;
- }
- #endif
- m_set_State[0] |= 0x10;
- return m_Db;
- }
- inline
- bool CQuery_Related_Base::IsSetItems(void) const
- {
- return m_Items;
- }
- inline
- bool CQuery_Related_Base::CanGetItems(void) const
- {
- return IsSetItems();
- }
- inline
- const CQuery_Related_Base::C_Items& CQuery_Related_Base::GetItems(void) const
- {
- if (!CanGetItems()) {
- ThrowUnassigned(3);
- }
- return (*m_Items);
- }
- inline
- CQuery_Related_Base::C_Items& CQuery_Related_Base::SetItems(void)
- {
- return (*m_Items);
- }
- ///////////////////////////////////////////////////////////
- ////////////////// end of inline methods //////////////////
- ///////////////////////////////////////////////////////////
- #endif // QUERY_RELATED_BASE_HPP