<
classBioTree>
94 const string& feature_value);
101 const string& feature_name,
102 const string& feature_value);
149 template<
classBioTree>
154 template<
classBioTree>
156: m_FeatureDict(btr.m_FeatureDict)
157, m_NodeIdCounter(btr.m_NodeIdCounter)
158, m_Forest(btr.m_Forest)
162 template<
classBioTree>
168 template<
classBioTree>
178 template<
classBioTree>
184 typenamestd::vector<BioTree*>::const_iterator iter;
185 for(iter=m_Forest.begin(); iter!=m_Forest.end() && (
n==
NULL); ++iter) {
186 n= (*iter)->FindNode(node_id);
192 template<
classBioTree>
195 typenamestd::vector<BioTree*>::iterator iter;
196iter = std::find(m_Forest.begin(), m_Forest.end(),
t);
198 if(iter == m_Forest.end())
199m_Forest.push_back(
t);
202 template<
classBioTree>
205 typenamestd::vector<BioTree*>::iterator iter;
206iter = std::find(m_Forest.begin(), m_Forest.end(),
t);
208 _ASSERT(iter != m_Forest.end());
210m_Forest.erase(iter);
213 template<
classBioTree>
216 typenamestd::vector<BioTree*>::iterator iter;
217iter = std::find(m_Forest.begin(), m_Forest.end(),
t);
219 _ASSERT(iter != m_Forest.end());
221m_Forest.erase(iter);
226 template<
classBioTree>
229 const string& feature_value)
232 boolid_found = m_FeatureDict.HasFeature(feature_id);
234node->GetValue().features.SetFeature(feature_id, feature_value);
241 template<
classBioTree>
243 const string& feature_name,
244 const string& feature_value)
248= m_FeatureDict.GetId(feature_name);
251feature_id = m_FeatureDict.Register(feature_name);
255AddFeature(node, feature_id, feature_value);
258 template<
classBioTree>
262node->GetValue().uid = uid;
265 template<
classBioTree>
274ret = parent_node->AddNode(node_value);
280 template<
classBioTree>
283m_FeatureDict.Clear();
286 ITERATE(
typenamestd::vector<BioTree*>, iter, m_Forest) {
Things for representing and manipulating bio trees.
CBioTreeForest< CBioTreeDynamic > CBioTreeForestDynamic
Bio tree without static elements.
Set of BioTree objects managed as a single forest.
const CBioTreeFeatureDictionary & GetFeatureDict() const
Return feature dictionary.
void AddTree(BioTree *t)
Add a new tree to the set of managed BioTrees.
void AddFeature(TBioTreeNode *node, TBioTreeFeatureId feature_id, const string &feature_value)
Add feature to the tree node Function controls that the feature is registered in the feature dictiona...
void SetTreeNode(TBioTreeNode *node)
Assign new top level tree node.
TBioTreeNodeId m_NodeIdCounter
CBioTreeForest< BioTree > & operator=(const CBioTreeForest< BioTree > &btr)
void Clear()
Clear the bio tree.
void RemoveTree(BioTree *t)
Remove a tree from the forest, but do not delete it.
TBioTree::TBioNodeType TBioNodeType
const TBioTreeNode * FindNode(TBioTreeNodeId node_id) const
Finds node by id.
void SetNodeId(TBioTreeNode *node)
Assign new unique node id to the node.
std::vector< BioTree * > GetTrees() const
Return a copy of the forest vector for direct access to the trees.
std::vector< BioTree * > TBioTreeVec
virtual TBioTreeNodeId GetNodeId(const TBioTreeNode &node)
Get new unique node id (for cases when node id depends on the node's content.
void DeleteTree(BioTree *t)
Remove and delete a tree from the forest.
CBioTreeFeatureDictionary & GetFeatureDict()
Return feature dictionary.
TBioTree::TBioTreeNode TBioTreeNode
Biotree node (forms the tree hierarchy)
CBioTreeFeatureDictionary m_FeatureDict
virtual TBioTreeNodeId GetNodeId()
Get new unique node id.
virtual ~CBioTreeForest()
TBioTreeNode * AddNode(const TBioNodeType &node_value, TBioTreeNodeId parent_id)
Add node to the tree (node location is defined by the parent id.
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Fun TreeDepthFirstTraverse(TTreeNode &tree_node, Fun func)
Depth-first tree traversal algorithm.
unsigned int TBioTreeNodeId
Tree node id. Every node has its unique id in the tree.
unsigned int TBioTreeFeatureId
Feature Id.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4