NCBI C++ Toolkit Cross Reference

  C++/src/objects/general/Person_id_.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: * 'general.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/general/Person_id.hpp> #include <objects/general/Dbtag.hpp> #include <objects/general/Name_std.hpp> BEGIN_NCBI_SCOPE BEGIN_objects_SCOPE // namespace ncbi::objects:: // generated classes void CPerson_id_Base::Reset(void) { if ( m_choice != e_not_set ) ResetSelection(); } void CPerson_id_Base::ResetSelection(void) { switch ( m_choice ) { case e_Ml: case e_Str: case e_Consortium: m_string.Destruct(); break; case e_Dbtag: case e_Name: m_object->RemoveReference(); break; default: break; } m_choice = e_not_set; } void CPerson_id_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool) { switch ( index ) { case e_Dbtag: (m_object = new(pool) ncbi::objects::CDbtag())->AddReference(); break; case e_Name: (m_object = new(pool) ncbi::objects::CName_std())->AddReference(); break; case e_Ml: case e_Str: case e_Consortium: m_string.Construct(); break; default: break; } m_choice = index; } const char* const CPerson_id_Base::sm_SelectionNames[] = { "not set", "dbtag", "name", "ml", "str", "consortium" }; NCBI_NS_STD::string CPerson_id_Base::SelectionName(E_Choice index) { return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0])); } void CPerson_id_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 CPerson_id_Base::TDbtag& CPerson_id_Base::GetDbtag(void) const { CheckSelected(e_Dbtag); return *static_cast<const TDbtag*>(m_object); } CPerson_id_Base::TDbtag& CPerson_id_Base::SetDbtag(void) { Select(e_Dbtag, NCBI_NS_NCBI::eDoNotResetVariant); return *static_cast<TDbtag*>(m_object); } void CPerson_id_Base::SetDbtag(CPerson_id_Base::TDbtag& value) { TDbtag* ptr = &value; if ( m_choice != e_Dbtag || m_object != ptr ) { ResetSelection(); (m_object = ptr)->AddReference(); m_choice = e_Dbtag; } } const CPerson_id_Base::TName& CPerson_id_Base::GetName(void) const { CheckSelected(e_Name); return *static_cast<const TName*>(m_object); } CPerson_id_Base::TName& CPerson_id_Base::SetName(void) { Select(e_Name, NCBI_NS_NCBI::eDoNotResetVariant); return *static_cast<TName*>(m_object); } void CPerson_id_Base::SetName(CPerson_id_Base::TName& value) { TName* ptr = &value; if ( m_choice != e_Name || m_object != ptr ) { ResetSelection(); (m_object = ptr)->AddReference(); m_choice = e_Name; } } void CPerson_id_Base::SetMl(const CPerson_id_Base::TMl& value) { Select(e_Ml, NCBI_NS_NCBI::eDoNotResetVariant); *m_string = value; } void CPerson_id_Base::SetStr(const CPerson_id_Base::TStr& value) { Select(e_Str, NCBI_NS_NCBI::eDoNotResetVariant); *m_string = value; } void CPerson_id_Base::SetConsortium(const CPerson_id_Base::TConsortium& value) { Select(e_Consortium, NCBI_NS_NCBI::eDoNotResetVariant); *m_string = value; } // helper methods // type info BEGIN_NAMED_BASE_CHOICE_INFO("Person-id", CPerson_id) { SET_CHOICE_MODULE("NCBI-General"); ADD_NAMED_REF_CHOICE_VARIANT("dbtag", m_object, CDbtag); ADD_NAMED_REF_CHOICE_VARIANT("name", m_object, CName_std); ADD_NAMED_BUF_CHOICE_VARIANT("ml", m_string, STD, (string)); ADD_NAMED_BUF_CHOICE_VARIANT("str", m_string, STD, (string)); ADD_NAMED_BUF_CHOICE_VARIANT("consortium", m_string, STD, (string)); info->CodeVersion(21801); info->DataSpec(ncbi::EDataSpec::eASN); } END_CHOICE_INFO // constructor CPerson_id_Base::CPerson_id_Base(void) : m_choice(e_not_set) { } // destructor CPerson_id_Base::~CPerson_id_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.