📄 time_.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: Time_.hpp,v $ * PRODUCTION Revision 1000.1 2004/04/12 17:20:39 gouriano * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.3 * PRODUCTION * =========================================================================== *//* $Id: Time_.hpp,v 1000.1 2004/04/12 17:20:39 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 TIME_BASE_HPP#define TIME_BASE_HPP// standard includes#include <serial/serialbase.hpp>// forward declarationsclass CFull_Time;// generated classesclass CTime_Base : public ncbi::CSerialObject{ typedef ncbi::CSerialObject Tparent;public: // constructor CTime_Base(void); // destructor virtual ~CTime_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // choice state enum enum E_Choice { e_not_set = 0, e_Unix, e_Full }; enum E_ChoiceStopper { e_MaxChoice = 3 // == Full+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 int TUnix; typedef CFull_Time TFull; // getters // setters // typedef int TUnix bool IsUnix(void) const; TUnix GetUnix(void) const; TUnix& SetUnix(void); void SetUnix(const TUnix& value); // typedef CFull_Time TFull bool IsFull(void) const; const TFull& GetFull(void) const; TFull& SetFull(void); void SetFull(TFull& value);private: // copy constructor and assignment operator CTime_Base(const CTime_Base& ); CTime_Base& operator=(const CTime_Base& ); // choice state E_Choice m_choice; // helper methods void DoSelect(E_Choice index); static const char* const sm_SelectionNames[]; // data union { TUnix m_Unix; NCBI_NS_NCBI::CSerialObject *m_object; };};//////////////////////////////////////////////////////////////////////////////// inline methods /////////////////////////////////////////////////////////////////////////////////inlineCTime_Base::E_Choice CTime_Base::Which(void) const{ return m_choice;}inlinevoid CTime_Base::CheckSelected(E_Choice index) const{ if ( m_choice != index ) ThrowInvalidSelection(index);}inlinevoid CTime_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); }}inlinebool CTime_Base::IsUnix(void) const{ return m_choice == e_Unix;}inlineint CTime_Base::GetUnix(void) const{ CheckSelected(e_Unix); return m_Unix;}inlineint& CTime_Base::SetUnix(void){ Select(e_Unix, NCBI_NS_NCBI::eDoNotResetVariant); return m_Unix;}inlinevoid CTime_Base::SetUnix(const int& value){ Select(e_Unix, NCBI_NS_NCBI::eDoNotResetVariant); m_Unix = value;}inlinebool CTime_Base::IsFull(void) const{ return m_choice == e_Full;}///////////////////////////////////////////////////////////////////////////// end of inline methods /////////////////////////////////////////////////////////////////////////////#endif // TIME_BASE_HPP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -