OrgName.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
源码类别:

生物技术

开发平台:

C/C++

  1. /*
  2.  * ===========================================================================
  3.  * PRODUCTION $Log: OrgName.cpp,v $
  4.  * PRODUCTION Revision 1000.1  2004/06/01 19:33:56  gouriano
  5.  * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.3
  6.  * PRODUCTION
  7.  * ===========================================================================
  8.  */
  9. /* $Id: OrgName.cpp,v 1000.1 2004/06/01 19:33:56 gouriano Exp $
  10.  * ===========================================================================
  11.  *
  12.  *                            PUBLIC DOMAIN NOTICE
  13.  *               National Center for Biotechnology Information
  14.  *
  15.  *  This software/database is a "United States Government Work" under the
  16.  *  terms of the United States Copyright Act.  It was written as part of
  17.  *  the author's official duties as a United States Government employee and
  18.  *  thus cannot be copyrighted.  This software/database is freely available
  19.  *  to the public for use. The National Library of Medicine and the U.S.
  20.  *  Government have not placed any restriction on its use or reproduction.
  21.  *
  22.  *  Although all reasonable efforts have been taken to ensure the accuracy
  23.  *  and reliability of the software and data, the NLM and the U.S.
  24.  *  Government do not and cannot warrant the performance or results that
  25.  *  may be obtained by using this software or data. The NLM and the U.S.
  26.  *  Government disclaim all warranties, express or implied, including
  27.  *  warranties of performance, merchantability or fitness for any particular
  28.  *  purpose.
  29.  *
  30.  *  Please cite the author in any work or product based on this material.
  31.  *
  32.  * ===========================================================================
  33.  *
  34.  * Author:  .......
  35.  *
  36.  * File Description:
  37.  *   .......
  38.  *
  39.  * Remark:
  40.  *   This code was originally generated by application DATATOOL
  41.  *   using specifications from the data definition file
  42.  *   'seqfeat.asn'.
  43.  */
  44. // standard includes
  45. // generated includes
  46. #include <ncbi_pch.hpp>
  47. #include <objects/seqfeat/OrgName.hpp>
  48. #include <objects/seqfeat/PartialOrgName.hpp>
  49. #include <objects/seqfeat/TaxElement.hpp>
  50. // generated classes
  51. BEGIN_NCBI_SCOPE
  52. BEGIN_objects_SCOPE // namespace ncbi::objects::
  53. // destructor
  54. COrgName::~COrgName(void)
  55. {
  56. }
  57. bool COrgName::GetFlatName(string& name_out, string* lineage) const
  58. {
  59.     if (lineage  &&  lineage->empty()  &&  IsSetLineage()) {
  60.         *lineage = GetLineage();
  61.     }
  62.     if ( !IsSetName() ) {
  63.         return false;
  64.     }
  65.     const TName& name = GetName();
  66.     switch (name.Which()) {
  67.     case C_Name::e_Binomial: case C_Name::e_Namedhybrid:
  68.     {
  69.         const CBinomialOrgName& bin = (name.IsBinomial() ? name.GetBinomial()
  70.                                        : name.GetNamedhybrid());
  71.         name_out = bin.GetGenus();
  72.         if (bin.IsSetSpecies()) {
  73.             name_out += ' ' + bin.GetSpecies();
  74.             if (bin.IsSetSubspecies()) {
  75.                 name_out += ' ' + bin.GetSubspecies();
  76.             }
  77.         }
  78.         return true;
  79.     }
  80.     case COrgName::C_Name::e_Virus:
  81.         name_out = name.GetVirus();
  82.         return true;
  83.     case COrgName::C_Name::e_Hybrid:
  84.     {
  85.         ITERATE (CMultiOrgName::Tdata, it, name.GetHybrid().Get()) {
  86.             if ((*it)->GetFlatName(name_out, lineage)) {
  87.                 return true;
  88.             }
  89.         }
  90.     }
  91.     case COrgName::C_Name::e_Partial:
  92.     {
  93.         string delim;
  94.         ITERATE (CPartialOrgName::Tdata, it, name.GetPartial().Get()) {
  95.             name_out += delim + (*it)->GetName();
  96.             delim = " ";
  97.         }
  98.         return true;
  99.     }
  100.     
  101.     default:
  102.         return false;
  103.     }
  104. }
  105. END_objects_SCOPE // namespace ncbi::objects::
  106. END_NCBI_SCOPE
  107. /*
  108. * ===========================================================================
  109. *
  110. * $Log: OrgName.cpp,v $
  111. * Revision 1000.1  2004/06/01 19:33:56  gouriano
  112. * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.3
  113. *
  114. * Revision 1.3  2004/05/19 17:26:04  gorelenk
  115. * Added include of PCH - ncbi_pch.hpp
  116. *
  117. * Revision 1.2  2003/04/18 19:40:39  kans
  118. * changed iterate to ITERATE
  119. *
  120. * Revision 1.1  2003/03/10 16:36:21  ucko
  121. * +GetFlatName
  122. *
  123. *
  124. * ===========================================================================
  125. */
  126. /* Original file checksum: lines: 64, chars: 1877, CRC32: 38972243 */