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

Go to the SVN repository for this file.

1 #ifndef SEQDESC_CI__HPP
2 #define SEQDESC_CI__HPP
3 
4 /* $Id: seqdesc_ci.hpp 59914 2013-09-26 15:15:41Z 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
30 *
31 * File Description:
32 * Object manager iterators
33 *
34 */
35 
36 
37 #include <objmgr/seq_descr_ci.hpp>
38 #include <corelib/ncbistd.hpp>
39 #include <objects/seq/Seqdesc.hpp>
40 
43 
44 
45 /** @addtogroup ObjectManagerIterators
46  *
47  * @{
48  */
49 
50 
51 class CBioseq_Base_Info;
52 
53 
54 /////////////////////////////////////////////////////////////////////////////
55 ///
56 /// CSeqdesc_CI --
57 ///
58 /// Another type of descriptor
59 /// Enumerate individual descriptors (CSeqdesc) rather than sets of them
60 ///
61 /// @sa
62 /// CSeq_descr_CI
63 
65 {
66 public:
67  typedef vector<CSeqdesc::E_Choice> TDescChoices;
68 
69  CSeqdesc_CI(void);
70  // Old method, should not be used.
71  explicit
72  CSeqdesc_CI(const CSeq_descr_CI& desc_it,
74 
75  /// Create an iterator that enumerates CSeqdesc objects
76  /// from a bioseq with limit number of seq-entries
77  /// to "search_depth" (0 = unlimited) for specific type
78  explicit
79  CSeqdesc_CI(const CBioseq_Handle& handle,
81  size_t search_depth = 0);
82 
83  /// Create an iterator that enumerates CSeqdesc objects
84  /// from a seq-entry, limit number of seq-entries
85  /// to "search_depth" (0 = unlimited) for specific type
86  explicit
87  CSeqdesc_CI(const CSeq_entry_Handle& entry,
89  size_t search_depth = 0);
90 
91  /// Create an iterator that enumerates CSeqdesc objects
92  /// from a bioseq with limit number of seq-entries
93  /// to "search_depth" (0 = unlimited) for set of types
94  CSeqdesc_CI(const CBioseq_Handle& handle,
95  const TDescChoices& choices,
96  size_t search_depth = 0);
97 
98  /// Create an iterator that enumerates CSeqdesc objects
99  /// from a seq-entry, limit number of seq-entries
100  /// to "search_depth" (0 = unlimited) for set of types
102  const TDescChoices& choices,
103  size_t search_depth = 0);
104 
105  CSeqdesc_CI(const CSeqdesc_CI& iter);
106  ~CSeqdesc_CI(void);
107 
108  CSeqdesc_CI& operator= (const CSeqdesc_CI& iter);
109 
110  /// Move to the next object in iterated sequence
111  CSeqdesc_CI& operator++ (void); // prefix
112 
113  /// Check if iterator points to an object
115 
116  const CSeqdesc& operator* (void) const;
117  const CSeqdesc* operator-> (void) const;
118 
120 
121 private:
122  CSeqdesc_CI operator++ (int); // prohibit postfix
123 
124  typedef unsigned TDescTypeMask;
125 
126  typedef list< CRef<CSeqdesc> > TDescList;
127  typedef TDescList::const_iterator TDescList_CI;
128 
129  void x_AddChoice(CSeqdesc::E_Choice choice);
130  void x_RemoveChoice(CSeqdesc::E_Choice choice);
131  void x_SetChoice(CSeqdesc::E_Choice choice);
132  void x_SetChoices(const TDescChoices& choices);
133 
134  bool x_RequestedType(void) const;
135 
136  bool x_Valid(void) const; // for debugging
137  bool x_ValidDesc(void) const;
138 
139  void x_FirstDesc(void);
140  void x_NextDesc(void);
141 
142  void x_SetEntry(const CSeq_descr_CI& entry);
143 
144  void x_Next(void);
145  void x_Settle(void);
146 
147  const CBioseq_Base_Info& x_GetBaseInfo(void) const;
148 
149  void x_CheckRef(const CBioseq_Handle& handle);
150 
156  size_t m_Depth;
157 };
158 
159 
160 /* @} */
161 
162 
165 
166 #endif // SEQDESC_CI__HPP
static CSeq_entry_Handle GetSeq_entry_Handle(TTypeInfo type, TConstObjectPtr ptr, CScope &scope)
CBioseq_Handle –.
CSeq_descr_CI –.
CSeq_entry_Handle –.
CSeqdesc_CI –.
Definition: seqdesc_ci.hpp:65
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
TDescList_CI m_Desc_CI
Definition: seqdesc_ci.hpp:153
unsigned TDescTypeMask
Definition: seqdesc_ci.hpp:124
size_t m_Depth
Definition: seqdesc_ci.hpp:156
list< CRef< CSeqdesc > > TDescList
Definition: seqdesc_ci.hpp:126
TDescList::const_iterator TDescList_CI
Definition: seqdesc_ci.hpp:127
CBioseq_Handle m_Ref
Definition: seqdesc_ci.hpp:154
CSeq_descr_CI m_Entry
Definition: seqdesc_ci.hpp:152
TDescTypeMask m_Choice
Definition: seqdesc_ci.hpp:151
bool m_HaveTitle
Definition: seqdesc_ci.hpp:155
DECLARE_OPERATOR_BOOL(m_Entry)
Check if iterator points to an object.
CSeqdesc_CI(const CBioseq_Handle &handle, const TDescChoices &choices, size_t search_depth=0)
Create an iterator that enumerates CSeqdesc objects from a bioseq with limit number of seq-entries to...
vector< CSeqdesc::E_Choice > TDescChoices
Definition: seqdesc_ci.hpp:67
CSeqdesc_CI(const CSeq_entry_Handle &entry, const TDescChoices &choices, size_t search_depth=0)
Create an iterator that enumerates CSeqdesc objects from a seq-entry, limit number of seq-entries to ...
#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
E_Choice
Choice variants.
Definition: Seqdesc_.hpp:109
@ e_not_set
No variant selected.
Definition: Seqdesc_.hpp:110
Modified on Wed May 22 11:28:01 2024 by modify_doxy.py rev. 669887