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

Go to the SVN repository for this file.

1 /* $Id: BioTreeContainer.cpp 33815 2007-05-04 17:18:18Z kazimird $
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  * 'biotree.asn'.
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 
40 // generated includes
43 #include <objects/biotree/Node.hpp>
44 
45 #include <set>
46 
47 // generated classes
48 
50 
51 BEGIN_objects_SCOPE // namespace ncbi::objects::
52 
53 // destructor
55 {
56 }
57 
58 
60 {
61  if (IsSetNodes()) {
62  return GetNodes().Get().size();
63  }
64  return 0;
65 }
66 
67 
69 {
70  size_t leaf_nodes = 0;
71  if (IsSetNodes()) {
72  set<int> nodes;
73  ITERATE (TNodes::Tdata, iter, GetNodes().Get()) {
74  const CNode& node = **iter;
75  nodes.insert(node.GetId());
76  if (node.IsSetParent()) {
77  nodes.erase(node.GetParent());
78  }
79  }
80  leaf_nodes = nodes.size();
81  }
82  return leaf_nodes;
83 }
84 
85 
86 END_objects_SCOPE // namespace ncbi::objects::
87 
89 
90 /* Original file checksum: lines: 65, chars: 1912, CRC32: 94c35062 */
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
size_t GetNodeCount() const
size_t GetLeafCount() const
CNode –.
Definition: Node.hpp:66
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
size_type size() const
Definition: set.hpp:132
void erase(iterator pos)
Definition: set.hpp:151
#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
TId GetId(void) const
Get the Id member data.
Definition: Node_.hpp:259
TParent GetParent(void) const
Get the Parent member data.
Definition: Node_.hpp:306
bool IsSetParent(void) const
parent node id Check if a value has been assigned to Parent data member.
Definition: Node_.hpp:287
list< CRef< CNode > > Tdata
Definition: NodeSet_.hpp:89
const Tdata & Get(void) const
Get the member data.
Definition: NodeSet_.hpp:164
const TNodes & GetNodes(void) const
Get the Nodes member data.
bool IsSetNodes(void) const
set of nodes with encoded topology Check if a value has been assigned to Nodes data member.
const TYPE & Get(const CNamedParameterList *param)
Modified on Wed Sep 04 15:04:41 2024 by modify_doxy.py rev. 669887