NCBI C++ Toolkit Cross Reference

  C++/src/objects/proj/Projdesc_.cpp


/* $Id$ * =========================================================================== * * 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 was generated by application DATATOOL * using the following specifications: * 'proj.asn'. * * ATTENTION: * Don't edit or commit this file into CVS as this file will * be overridden (by DATATOOL) without warning! * =========================================================================== */ // standard includes #include <ncbi_pch.hpp> #include <serial/serialimpl.hpp> // generated includes #include <objects/proj/Projdesc.hpp> #include <objects/general/Date.hpp> #include <objects/seq/Pubdesc.hpp> BEGIN_NCBI_SCOPE BEGIN_objects_SCOPE // namespace ncbi::objects:: // generated classes void CProjdesc_Base::Reset(void) { if ( m_choice != e_not_set ) ResetSelection(); } void CProjdesc_Base::ResetSelection(void) { switch ( m_choice ) { case e_Comment: case e_Title: m_string.Destruct(); break; case e_Pub: case e_Date: m_object->RemoveReference(); break; default: break; } m_choice = e_not_set; } void CProjdesc_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool) { switch ( index ) { case e_Pub: (m_object = new(pool) ncbi::objects::CPubdesc())->AddReference(); break; case e_Date: (m_object = new(pool) ncbi::objects::CDate())->AddReference(); break; case e_Comment: case e_Title: m_string.Construct(); break; default: break; } m_choice = index; } const char* const CProjdesc_Base::sm_SelectionNames[] = { "not set", "pub", "date", "comment", "title" }; NCBI_NS_STD::string CProjdesc_Base::SelectionName(E_Choice index) { return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0])); } void CProjdesc_Base::ThrowInvalidSelection(E_Choice index) const { throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0])); } const CProjdesc_Base::TPub& CProjdesc_Base::GetPub(void) const { CheckSelected(e_Pub); return *static_cast<const TPub*>(m_object); } CProjdesc_Base::TPub& CProjdesc_Base::SetPub(void) { Select(e_Pub, NCBI_NS_NCBI::eDoNotResetVariant); return *static_cast<TPub*>(m_object); } void CProjdesc_Base::SetPub(CProjdesc_Base::TPub& value) { TPub* ptr = &value; if ( m_choice != e_Pub || m_object != ptr ) { ResetSelection(); (m_object = ptr)->AddReference(); m_choice = e_Pub; } } const CProjdesc_Base::TDate& CProjdesc_Base::GetDate(void) const { CheckSelected(e_Date); return *static_cast<const TDate*>(m_object); } CProjdesc_Base::TDate& CProjdesc_Base::SetDate(void) { Select(e_Date, NCBI_NS_NCBI::eDoNotResetVariant); return *static_cast<TDate*>(m_object); } void CProjdesc_Base::SetDate(CProjdesc_Base::TDate& value) { TDate* ptr = &value; if ( m_choice != e_Date || m_object != ptr ) { ResetSelection(); (m_object = ptr)->AddReference(); m_choice = e_Date; } } void CProjdesc_Base::SetComment(const CProjdesc_Base::TComment& value) { Select(e_Comment, NCBI_NS_NCBI::eDoNotResetVariant); *m_string = value; } void CProjdesc_Base::SetTitle(const CProjdesc_Base::TTitle& value) { Select(e_Title, NCBI_NS_NCBI::eDoNotResetVariant); *m_string = value; } // helper methods // type info BEGIN_NAMED_BASE_CHOICE_INFO("Projdesc", CProjdesc) { SET_CHOICE_MODULE("NCBI-Project"); ADD_NAMED_REF_CHOICE_VARIANT("pub", m_object, CPubdesc); ADD_NAMED_REF_CHOICE_VARIANT("date", m_object, CDate); ADD_NAMED_BUF_CHOICE_VARIANT("comment", m_string, STD, (string)); ADD_NAMED_BUF_CHOICE_VARIANT("title", m_string, STD, (string)); } END_CHOICE_INFO // constructor CProjdesc_Base::CProjdesc_Base(void) : m_choice(e_not_set) { } // destructor CProjdesc_Base::~CProjdesc_Base(void) { Reset(); } END_objects_SCOPE // namespace ncbi::objects:: END_NCBI_SCOPE

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.