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

Go to the SVN repository for this file.

1 /* $Id: cuNRCriteria.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: Chris Lanczycki
27 *
28 * File Description:
29 * Contains both the virtual base class and a concrete subclass used for non-redundification
30 * of clusters of sequences according to class-specific rules.
31 *
32 */
33 
34 #include <ncbi_pch.hpp>
36 
38 BEGIN_SCOPE(cd_utils)
39 
40 // Do the redundant cast in case the underlying type of CBaseClusterer::TId changes.
42 
44  if (m_id2ItemMap) {
45  for (TId2ItemIt i = m_id2ItemMap->begin(); i != m_id2ItemMap->end(); ++i) {
46  delete i->second;
47  i->second = NULL;
48  }
49  }
50 };
51 
53  if (!m_id2ItemMap) return NULL;
54  TId2ItemIt it = m_id2ItemMap->find(itemId);
55  return (it == m_id2ItemMap->end()) ? NULL : it->second;
56 }
57 
59  bool result = false;
60  TId2ItemCit cit;
61  if (m_id2ItemMap) {
62  cit = m_id2ItemMap->find(itemId);
63  if (cit != m_id2ItemMap->end() && cit->second) {
64  result = true;
65  nrItem = *(cit->second);
66  }
67  }
68  if (!result) {
70  nrItem.keep = false;
71  }
72  return result;
73 }
74 
76  bool result = false;
77  CNRItem nrItem;
78  if (GetItemForId(itemId, nrItem)) {
79  result = nrItem.keep;
80  }
81  return result;
82 }
83 
84 END_SCOPE(cd_utils)
static const TId INVALID_ID
unsigned int TId
TId2Item::iterator TId2ItemIt
TId2Item * m_id2ItemMap
CNRItem * GetItemForId(CBaseClusterer::TId itemId)
TId2Item::const_iterator TId2ItemCit
virtual ~CNRCriteria()
bool IsItemKept(CBaseClusterer::TId itemId) const
static const TItemId INVALID_ITEM_ID
unsigned int TItemId
TItemId itemId
const_iterator begin() const
Definition: map.hpp:151
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
#define NULL
Definition: ncbistd.hpp:225
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
int i
else result
Definition: token2.c:20
Modified on Sat Jun 15 11:54:33 2024 by modify_doxy.py rev. 669887