1 /* $Id: GC_Replicon.cpp 381875 2012-11-29 20:08:33Z smithrg $ 2 * =========================================================================== 3 * 4 * PUBLIC DOMAIN NOTICE 5 * National Center for Biotechnology Information 6 * 7 * This software/database is a "United States Government Work" under the 8 * terms of the United States Copyright Act. It was written as part of 9 * the author's official duties as a United States Government employee and 10 * thus cannot be copyrighted. This software/database is freely available 11 * to the public for use. The National Library of Medicine and the U.S. 12 * Government have not placed any restriction on its use or reproduction. 13 * 14 * Although all reasonable efforts have been taken to ensure the accuracy 15 * and reliability of the software and data, the NLM and the U.S. 16 * Government do not and cannot warrant the performance or results that 17 * may be obtained by using this software or data. The NLM and the U.S. 18 * Government disclaim all warranties, express or implied, including 19 * warranties of performance, merchantability or fitness for any particular 20 * purpose. 21 * 22 * Please cite the author in any work or product based on this material. 23 * 24 * =========================================================================== 25 * 26 * Author: ....... 27 * 28 * File Description: 29 * ....... 30 * 31 * Remark: 32 * This code was originally generated by application DATATOOL 33 * using the following specifications: 34 * 'genome_collection.asn'. 35 */ 36 37 // standard includes 38 #include <ncbi_pch.hpp> 39 40 // generated includes 41 #include <objects/general/User_field.hpp> 42 #include <objects/general/User_object.hpp> 43 #include <objects/genomecoll/GC_Replicon.hpp> 44 #include <objects/genomecoll/GC_AssemblyUnit.hpp> 45 #include <objects/genomecoll/GC_Assembly.hpp> 46 47 // generated classes 48 49 BEGIN_NCBI_SCOPE 50 51 BEGIN_objects_SCOPE // namespace ncbi::objects:: 52 53 // constructor CGC_Replicon(void)54CGC_Replicon::CGC_Replicon(void) 55 : m_Assembly(NULL) 56 , m_AssemblyUnit(NULL) 57 { 58 } 59 60 // destructor ~CGC_Replicon(void)61CGC_Replicon::~CGC_Replicon(void) 62 { 63 } 64 65 66 /// Access the assembly unit the sequence belongs to GetAssemblyUnit() const67CConstRef<CGC_AssemblyUnit> CGC_Replicon::GetAssemblyUnit() const 68 { 69 return CConstRef<CGC_AssemblyUnit>(m_AssemblyUnit); 70 } 71 72 73 /// Access the assembly the sequence belongs to GetFullAssembly() const74CConstRef<CGC_Assembly> CGC_Replicon::GetFullAssembly() const 75 { 76 return CConstRef<CGC_Assembly>(m_Assembly); 77 } 78 79 static x_GetMolLocTypeUserObj(const CGC_Replicon & rep)80CConstRef<CUser_object> x_GetMolLocTypeUserObj(const CGC_Replicon& rep) 81 { 82 const CGC_Sequence& seq = rep.GetSequence().GetSingle(); 83 if (seq.IsSetDescr()) { 84 ITERATE(CSeq_descr::Tdata, dit, seq.GetDescr().Get()) { 85 if ((*dit)->IsUser()) { 86 const CUser_object& uo = (*dit)->GetUser(); 87 if ( uo.GetType().IsStr() && uo.GetType().GetStr() == "molecule-location-type") { 88 return CConstRef<CUser_object>(&uo); 89 } 90 } 91 } 92 } 93 return CConstRef<CUser_object>(); 94 } 95 GetMoleculeLocation() const96string CGC_Replicon::GetMoleculeLocation() const 97 { 98 CConstRef<CUser_object> uo = x_GetMolLocTypeUserObj(*this); 99 if (uo) { 100 return uo->GetField("location").GetData().GetStr(); 101 } 102 return kEmptyStr; 103 } 104 GetMoleculeType() const105string CGC_Replicon::GetMoleculeType() const 106 { 107 CConstRef<CUser_object> uo = x_GetMolLocTypeUserObj(*this); 108 if (uo) { 109 return uo->GetField("type").GetData().GetStr(); 110 } 111 return kEmptyStr; 112 } 113 GetMoleculeLabel() const114string CGC_Replicon::GetMoleculeLabel() const 115 { 116 CConstRef<CUser_object> uo = x_GetMolLocTypeUserObj(*this); 117 if (uo) { 118 return uo->GetField("label").GetData().GetStr(); 119 } 120 return kEmptyStr; 121 } 122 123 END_objects_SCOPE // namespace ncbi::objects:: 124 125 END_NCBI_SCOPE 126 127 /* Original file checksum: lines: 57, chars: 1758, CRC32: 4b99539e */ 128