NCBI C++ ToolKit
T3Data.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: T3Data.cpp 78859 2017-07-24 18:47:22Z domrach $
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: NCBI Staff
27  *
28  * File Description:
29  * Convenience and optimization functions for CT3Data
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using the following specifications:
34  * 'taxon3.asn'.
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 
40 // generated includes
42 
43 // other includes
46 
47 // generated classes
48 
50 
51 BEGIN_objects_SCOPE // namespace ncbi::objects::
52 
53 // destructor
55 {
56 }
57 
58 void CT3Data::GetTaxFlags (bool& is_species_level, bool& force_consult, bool& has_nucleomorphs) const
59 {
60  is_species_level = true;
61  force_consult = false;
62  has_nucleomorphs = false;
63 
64  if (IsSetStatus()) {
66  if ((*status_it)->IsSetProperty()) {
67  string prop = (*status_it)->GetProperty();
68  if (NStr::EqualNocase(prop, "is_species_level")) {
69  if ((*status_it)->IsSetValue()
70  && (*status_it)->GetValue().IsBool()
71  && !(*status_it)->GetValue().GetBool()) {
72  is_species_level = false;
73  }
74  } else if (NStr::EqualNocase(prop, "force_consult")) {
75  if ((*status_it)->IsSetValue()
76  && (*status_it)->GetValue().IsBool()
77  && (*status_it)->GetValue().GetBool()) {
78  force_consult = true;
79  }
80  } else if (NStr::EqualNocase(prop, "has_nucleomorphs")) {
81  if ((*status_it)->IsSetValue()
82  && (*status_it)->GetValue().IsBool()
83  && (*status_it)->GetValue().GetBool()) {
84  has_nucleomorphs = true;
85  }
86  }
87  }
88  }
89  }
90 }
91 
92 
93 bool CT3Data::HasPlastids (void) const
94 {
95  bool rval = false;
96  if (IsSetStatus()) {
98  if ((*status_it)->IsSetProperty()
99  && NStr::EqualNocase((*status_it)->GetProperty(), "has_plastids")
100  && (*status_it)->IsSetValue()
101  && (*status_it)->GetValue().IsBool()
102  && (*status_it)->GetValue().GetBool()) {
103  rval = true;
104  break;
105  }
106  }
107  }
108  return rval;
109 }
110 
111 #define NO_FLAG(a,f) (( a & f ) == 0)
112 
114 {
115  if( NO_FLAG( to_remain, ITaxon3::eT3reply_org ) ) {
116  ResetOrg();
117  SetOrg(); // empty org since it is mandatory
118  }
119  if( NO_FLAG( to_remain, ITaxon3::eT3reply_blast_lin ) ) {
121  }
122  if( NO_FLAG( to_remain, ITaxon3::eT3reply_status ) ) {
123  ResetStatus();
124  }
125  if( NO_FLAG( to_remain, ITaxon3::eT3reply_refresh ) ) {
126  ResetRefresh();
127  }
128 }
129 
130 END_objects_SCOPE // namespace ncbi::objects::
131 
133 
134 /* Original file checksum: lines: 57, chars: 1713, CRC32: a1b62eef */
#define NO_FLAG(a, f)
Definition: T3Data.cpp:111
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
~CT3Data(void)
Definition: T3Data.cpp:54
void GetTaxFlags(bool &is_species_level, bool &force_consult, bool &has_nucleomorphs) const
Definition: T3Data.cpp:58
bool HasPlastids(void) const
Definition: T3Data.cpp:93
void FilterOutDataParts(ITaxon3::fT3reply_parts to_remain)
Definition: T3Data.cpp:113
unsigned int fT3reply_parts
Definition: itaxon3.hpp:85
@ eT3reply_status
Definition: itaxon3.hpp:79
@ eT3reply_blast_lin
Definition: itaxon3.hpp:78
@ eT3reply_org
Definition: itaxon3.hpp:77
@ eT3reply_refresh
Definition: itaxon3.hpp:80
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5353
bool IsSetStatus(void) const
Check if a value has been assigned to Status data member.
Definition: T3Data_.hpp:328
void ResetStatus(void)
Reset Status data member.
Definition: T3Data_.cpp:73
const TStatus & GetStatus(void) const
Get the Status member data.
Definition: T3Data_.hpp:340
TOrg & SetOrg(void)
Assign a value to Org data member.
Definition: T3Data_.hpp:294
void ResetRefresh(void)
Reset Refresh data member.
Definition: T3Data_.cpp:79
void ResetOrg(void)
Reset Org data member.
Definition: T3Data_.cpp:53
list< CRef< CT3StatusFlags > > TStatus
Definition: T3Data_.hpp:94
void ResetBlast_name_lineage(void)
Reset Blast_name_lineage data member.
Definition: T3Data_.cpp:67
Modified on Wed Apr 17 13:09:41 2024 by modify_doxy.py rev. 669887