NCBI C++ Toolkit Cross Reference

  C++/src/objects/seqtable/SeqTable_single_data_.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: * 'seqtable.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/seqtable/SeqTable_single_data.hpp> #include <objects/seqloc/Seq_id.hpp> #include <objects/seqloc/Seq_interval.hpp> #include <objects/seqloc/Seq_loc.hpp> BEGIN_NCBI_SCOPE BEGIN_objects_SCOPE // namespace ncbi::objects:: // generated classes void CSeqTable_single_data_Base::Reset(void) { if ( m_choice != e_not_set ) ResetSelection(); } void CSeqTable_single_data_Base::ResetSelection(void) { switch ( m_choice ) { case e_Bytes: m_Bytes.Destruct(); break; case e_String: m_string_utf8.Destruct(); break; case e_Loc: case e_Id: case e_Interval: m_object->RemoveReference(); break; default: break; } m_choice = e_not_set; } void CSeqTable_single_data_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool) { switch ( index ) { case e_Int: m_Int = 0; break; case e_Real: m_Real = 0; break; case e_Bytes: m_Bytes.Construct(); break; case e_Bit: m_Bit = 0; break; case e_Loc: (m_object = new(pool) ncbi::objects::CSeq_loc())->AddReference(); break; case e_Id: (m_object = new(pool) ncbi::objects::CSeq_id())->AddReference(); break; case e_Interval: (m_object = new(pool) ncbi::objects::CSeq_interval())->AddReference(); break; case e_Int8: m_Int8 = 0; break; case e_String: m_string_utf8.Construct(); break; default: break; } m_choice = index; } const char* const CSeqTable_single_data_Base::sm_SelectionNames[] = { "not set", "int", "real", "string", "bytes", "bit", "loc", "id", "interval", "int8" }; NCBI_NS_STD::string CSeqTable_single_data_Base::SelectionName(E_Choice index) { return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0])); } void CSeqTable_single_data_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])); } void CSeqTable_single_data_Base::SetString(const CSeqTable_single_data_Base::TString& value) { Select(e_String, NCBI_NS_NCBI::eDoNotResetVariant); *m_string_utf8 = value; } const CSeqTable_single_data_Base::TLoc& CSeqTable_single_data_Base::GetLoc(void) const { CheckSelected(e_Loc); return *static_cast<const TLoc*>(m_object); } CSeqTable_single_data_Base::TLoc& CSeqTable_single_data_Base::SetLoc(void) { Select(e_Loc, NCBI_NS_NCBI::eDoNotResetVariant); return *static_cast<TLoc*>(m_object); } void CSeqTable_single_data_Base::SetLoc(CSeqTable_single_data_Base::TLoc& value) { TLoc* ptr = &value; if ( m_choice != e_Loc || m_object != ptr ) { ResetSelection(); (m_object = ptr)->AddReference(); m_choice = e_Loc; } } const CSeqTable_single_data_Base::TId& CSeqTable_single_data_Base::GetId(void) const { CheckSelected(e_Id); return *static_cast<const TId*>(m_object); } CSeqTable_single_data_Base::TId& CSeqTable_single_data_Base::SetId(void) { Select(e_Id, NCBI_NS_NCBI::eDoNotResetVariant); return *static_cast<TId*>(m_object); } void CSeqTable_single_data_Base::SetId(CSeqTable_single_data_Base::TId& value) { TId* ptr = &value; if ( m_choice != e_Id || m_object != ptr ) { ResetSelection(); (m_object = ptr)->AddReference(); m_choice = e_Id; } } const CSeqTable_single_data_Base::TInterval& CSeqTable_single_data_Base::GetInterval(void) const { CheckSelected(e_Interval); return *static_cast<const TInterval*>(m_object); } CSeqTable_single_data_Base::TInterval& CSeqTable_single_data_Base::SetInterval(void) { Select(e_Interval, NCBI_NS_NCBI::eDoNotResetVariant); return *static_cast<TInterval*>(m_object); } void CSeqTable_single_data_Base::SetInterval(CSeqTable_single_data_Base::TInterval& value) { TInterval* ptr = &value; if ( m_choice != e_Interval || m_object != ptr ) { ResetSelection(); (m_object = ptr)->AddReference(); m_choice = e_Interval; } } // helper methods // type info BEGIN_NAMED_BASE_CHOICE_INFO("SeqTable-single-data", CSeqTable_single_data) { SET_CHOICE_MODULE("NCBI-SeqTable"); ADD_NAMED_STD_CHOICE_VARIANT("int", m_Int); ADD_NAMED_STD_CHOICE_VARIANT("real", m_Real); ADD_NAMED_BUF_CHOICE_VARIANT("string", m_string_utf8, CStringUTF8, ()); ADD_NAMED_BUF_CHOICE_VARIANT("bytes", m_Bytes, STL_CHAR_vector, (char)); ADD_NAMED_STD_CHOICE_VARIANT("bit", m_Bit); ADD_NAMED_REF_CHOICE_VARIANT("loc", m_object, CSeq_loc); ADD_NAMED_REF_CHOICE_VARIANT("id", m_object, CSeq_id); ADD_NAMED_REF_CHOICE_VARIANT("interval", m_object, CSeq_interval); ADD_NAMED_STD_CHOICE_VARIANT("int8", m_Int8); info->CodeVersion(21600); } END_CHOICE_INFO // constructor CSeqTable_single_data_Base::CSeqTable_single_data_Base(void) : m_choice(e_not_set) { } // destructor CSeqTable_single_data_Base::~CSeqTable_single_data_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.