NCBI C++ ToolKit
annot_ci.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef ANNOT_CI__HPP
2 #define ANNOT_CI__HPP
3 
4 /* $Id: annot_ci.hpp 42022 2009-05-29 17:09:42Z vasilche $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Author: Aleksey Grichenko, Michael Kimelman, Eugene Vasilchenko
30 *
31 * File Description:
32 * Object manager iterators
33 *
34 */
35 
37 #include <objmgr/seq_annot_ci.hpp>
38 #include <corelib/ncbistd.hpp>
39 
40 
43 
44 
45 /** @addtogroup ObjectManagerIterators
46  *
47  * @{
48  */
49 
50 /////////////////////////////////////////////////////////////////////////////
51 ///
52 /// CAnnot_CI --
53 ///
54 /// Searche individual features, alignments and graphs related to
55 /// the specified bioseq or location
56 ///
57 
59 {
60 public:
61  /// Create an empty iterator
62  CAnnot_CI(void);
63 
64  /// Create an iterator that enumerates CSeq_annot objects
65  /// related to the given bioseq
66  explicit CAnnot_CI(const CBioseq_Handle& bioseq);
67 
68  /// Create an iterator that enumerates CSeq_annot objects
69  /// related to the given bioseq
70  ///
71  /// @sa
72  /// SAnnotSelector
73  CAnnot_CI(const CBioseq_Handle& bioseq,
74  const SAnnotSelector& sel);
75 
76  /// Create an iterator that enumerates CSeq_annot objects
77  /// related to the given seq-loc based on selection
78  CAnnot_CI(CScope& scope,
79  const CSeq_loc& loc);
80 
81  /// Create an iterator that enumerates CSeq_annot objects
82  /// related to the given seq-loc based on selection
83  ///
84  /// @sa
85  /// SAnnotSelector
86  CAnnot_CI(CScope& scope,
87  const CSeq_loc& loc,
88  const SAnnotSelector& sel);
89 
90  /// Iterate all Seq-annot objects from the seq-entry
91  /// regardless of their location, using SAnnotSelector for filtering
92  ///
93  /// @sa
94  /// SAnnotSelector
95  CAnnot_CI(const CSeq_entry_Handle& entry,
96  const SAnnotSelector& sel);
97 
98  /// Copy constructor
99  CAnnot_CI(const CAnnot_CI& iter);
100 
101  /// Create an iterator that enumerates all CSeq_annot objects
102  /// collected by another iterator CFeat_CI, CGraph_CI, or CAlign_CI
103  explicit CAnnot_CI(const CAnnotTypes_CI& iter);
104 
105  virtual ~CAnnot_CI(void);
106 
107  CAnnot_CI& operator= (const CAnnot_CI& iter);
108 
109  /// Move to the next object in iterated sequence
110  CAnnot_CI& operator++ (void);
111 
112  /// Move to the pervious object in iterated sequence
113  CAnnot_CI& operator-- (void);
114 
115  void Rewind(void);
116 
117  /// Check if iterator points to an object
118  DECLARE_OPERATOR_BOOL(x_IsValid());
119 
120  /// Check if iterator is empty
121  bool empty(void) const;
122 
123  /// Get number of collected Seq-annots
124  size_t size(void) const;
125 
126  const CSeq_annot_Handle& operator*(void) const;
127  const CSeq_annot_Handle* operator->(void) const;
128 
129 private:
130  void x_Initialize(const CAnnotTypes_CI& iter);
131 
132  bool x_IsValid(void) const;
133 
134  CAnnot_CI operator++ (int);
136 
139 
142 };
143 
144 
145 inline
147 {
149  ++m_Iterator;
150  return *this;
151 }
152 
153 
154 inline
156 {
158  --m_Iterator;
159  return *this;
160 }
161 
162 
163 inline
165 {
166  _ASSERT(*this);
167  return *m_Iterator;
168 }
169 
170 
171 inline
173 {
174  _ASSERT(*this);
175  return &*m_Iterator;
176 }
177 
178 
179 inline
180 bool CAnnot_CI::x_IsValid(void) const
181 {
182  return m_Iterator != m_SeqAnnotSet.end();
183 }
184 
185 
186 inline
187 bool CAnnot_CI::empty(void) const
188 {
189  return m_SeqAnnotSet.empty();
190 }
191 
192 
193 inline
194 size_t CAnnot_CI::size(void) const
195 {
196  return m_SeqAnnotSet.size();
197 }
198 
199 
200 inline
202 {
204 }
205 
206 
207 /* @} */
208 
209 
212 
213 #endif // ANNOT_CI__HPP
CAnnot_CI –.
Definition: annot_ci.hpp:59
CBioseq_Handle –.
CScope –.
Definition: scope.hpp:92
CSeq_annot_Handle –.
CSeq_entry_Handle –.
const_iterator begin() const
Definition: set.hpp:135
size_type size() const
Definition: set.hpp:132
bool empty() const
Definition: set.hpp:133
const_iterator end() const
Definition: set.hpp:136
parent_type::const_iterator const_iterator
Definition: set.hpp:79
Include a standard set of the NCBI C++ Toolkit most basic headers.
CVect2< NCBI_PROMOTE(int,U) > operator*(int v1, const CVect2< U > &v2)
Definition: globals.hpp:371
bool x_IsValid(void) const
Definition: annot_ci.hpp:180
const CSeq_annot_Handle * operator->(void) const
Definition: annot_ci.hpp:172
TSeqAnnotSet m_SeqAnnotSet
Definition: annot_ci.hpp:140
const CSeq_annot_Handle & operator*(void) const
Definition: annot_ci.hpp:164
CAnnot_CI & operator--(void)
Move to the pervious object in iterated sequence.
Definition: annot_ci.hpp:155
size_t size(void) const
Get number of collected Seq-annots.
Definition: annot_ci.hpp:194
TSeqAnnotSet::const_iterator TIterator
Definition: annot_ci.hpp:138
DECLARE_OPERATOR_BOOL(x_IsValid())
Check if iterator points to an object.
bool empty(void) const
Check if iterator is empty.
Definition: annot_ci.hpp:187
set< CSeq_annot_Handle > TSeqAnnotSet
Definition: annot_ci.hpp:137
TIterator m_Iterator
Definition: annot_ci.hpp:141
void Rewind(void)
Definition: annot_ci.hpp:201
CAnnot_CI & operator++(void)
Move to the next object in iterated sequence.
Definition: annot_ci.hpp:146
#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
#define NCBI_XOBJMGR_EXPORT
Definition: ncbi_export.h:1307
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
S & operator--(CNetRef< S > &r, int)
SAnnotSelector –.
#define _ASSERT
Modified on Fri Sep 20 14:58:06 2024 by modify_doxy.py rev. 669887