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

Go to the SVN repository for this file.

1 #ifndef SEQ_GRAPH_HANDLE__HPP
2 #define SEQ_GRAPH_HANDLE__HPP
3 
4 /* $Id: seq_graph_handle.hpp 33815 2007-05-04 17:18:18Z kazimird $
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, Eugene Vasilchenko
30 *
31 * File Description:
32 * Seq-graph handle
33 *
34 */
35 
36 #include <corelib/ncbiobj.hpp>
37 #include <corelib/ncbi_limits.h>
40 
43 
44 
45 /** @addtogroup ObjectManagerHandles
46  *
47  * @{
48  */
49 
50 
51 class CSeq_annot_Handle;
52 class CMappedGraph;
53 class CAnnotObject_Info;
54 
55 /////////////////////////////////////////////////////////////////////////////
56 ///
57 /// CSeq_graph_Handle --
58 ///
59 /// Proxy to access seq-graph objects data
60 ///
61 
62 template<typename Handle>
64 template<typename Handle>
66 template<typename Handle>
68 
70 {
71 public:
72  CSeq_graph_Handle(void);
73 
74  void Reset(void);
75 
76  DECLARE_OPERATOR_BOOL(m_Annot && m_AnnotIndex != eNull && !IsRemoved());
77 
78  /// Get scope this handle belongs to
79  CScope& GetScope(void) const;
80 
81  /// Get an annotation handle for the current seq-graph
82  const CSeq_annot_Handle& GetAnnot(void) const;
83 
84  /// Get constant reference to the current seq-graph
85  CConstRef<CSeq_graph> GetSeq_graph(void) const;
86 
87  // Mappings for CSeq_graph methods
88  bool IsSetTitle(void) const;
89  const string& GetTitle(void) const;
90  bool IsSetComment(void) const;
91  const string& GetComment(void) const;
92  bool IsSetLoc(void) const;
93  const CSeq_loc& GetLoc(void) const;
94  bool IsSetTitle_x(void) const;
95  const string& GetTitle_x(void) const;
96  bool IsSetTitle_y(void) const;
97  const string& GetTitle_y(void) const;
98  bool IsSetComp(void) const;
99  TSeqPos GetComp(void) const;
100  bool IsSetA(void) const;
101  double GetA(void) const;
102  bool IsSetB(void) const;
103  double GetB(void) const;
104  TSeqPos GetNumval(void) const;
105  const CSeq_graph::TGraph& GetGraph(void) const;
106 
107  /// Return true if this Seq-graph was removed already
108  bool IsRemoved(void) const;
109  /// Remove the Seq-graph from Seq-annot
110  void Remove(void) const;
111  /// Replace the Seq-graph with new Seq-graph object.
112  /// All indexes are updated correspondingly.
113  void Replace(const CSeq_graph& new_obj) const;
114  /// Update index after manual modification of the object
115  void Update(void) const;
116 
117 private:
118  friend class CMappedGraph;
119  friend class CSeq_annot_EditHandle;
120  typedef Int4 TIndex;
121  enum {
122  eNull = kMax_I4
123  };
124 
125  const CSeq_graph& x_GetSeq_graph(void) const;
126 
127  CSeq_graph_Handle(const CSeq_annot_Handle& annot, TIndex index);
128 
130  TIndex m_AnnotIndex;
131 
132 private:
136 
137  /// Remove the Seq-graph from Seq-annot
138  void x_RealRemove(void) const;
139  /// Replace the Seq-graph with new Seq-graph object.
140  /// All indexes are updated correspondingly.
141  void x_RealReplace(const CSeq_graph& new_obj) const;
142 
143 };
144 
145 
146 inline
148  : m_AnnotIndex(eNull)
149 {
150 }
151 
152 
153 inline
155 {
156  return m_Annot;
157 }
158 
159 
160 inline
162 {
163  return GetAnnot().GetScope();
164 }
165 
166 
167 inline
169 {
170  return x_GetSeq_graph().IsSetTitle();
171 }
172 
173 
174 inline
175 const string& CSeq_graph_Handle::GetTitle(void) const
176 {
177  return x_GetSeq_graph().GetTitle();
178 }
179 
180 
181 inline
183 {
184  return x_GetSeq_graph().IsSetComment();
185 }
186 
187 
188 inline
189 const string& CSeq_graph_Handle::GetComment(void) const
190 {
191  return x_GetSeq_graph().GetComment();
192 }
193 
194 
195 inline
197 {
198  return x_GetSeq_graph().IsSetLoc();
199 }
200 
201 
202 inline
204 {
205  return x_GetSeq_graph().GetLoc();
206 }
207 
208 
209 inline
211 {
212  return x_GetSeq_graph().IsSetTitle_x();
213 }
214 
215 
216 inline
217 const string& CSeq_graph_Handle::GetTitle_x(void) const
218 {
219  return x_GetSeq_graph().GetTitle_x();
220 }
221 
222 
223 inline
225 {
226  return x_GetSeq_graph().IsSetTitle_y();
227 }
228 
229 
230 inline
231 const string& CSeq_graph_Handle::GetTitle_y(void) const
232 {
233  return x_GetSeq_graph().GetTitle_y();
234 }
235 
236 
237 inline
239 {
240  return x_GetSeq_graph().IsSetComp();
241 }
242 
243 
244 inline
246 {
247  return x_GetSeq_graph().GetComp();
248 }
249 
250 
251 inline
253 {
254  return x_GetSeq_graph().IsSetA();
255 }
256 
257 
258 inline
259 double CSeq_graph_Handle::GetA(void) const
260 {
261  return x_GetSeq_graph().GetA();
262 }
263 
264 
265 inline
267 {
268  return x_GetSeq_graph().IsSetB();
269 }
270 
271 
272 inline
273 double CSeq_graph_Handle::GetB(void) const
274 {
275  return x_GetSeq_graph().GetB();
276 }
277 
278 
279 inline
281 {
282  return x_GetSeq_graph().GetNumval();
283 }
284 
285 
286 inline
288 {
289  return x_GetSeq_graph().GetGraph();
290 }
291 
292 
293 /* @} */
294 
295 
298 
299 #endif // SEQ_GRAPH_HANDLE__HPP
User-defined methods of the data storage class.
CMappedGraph –.
Definition: graph_ci.hpp:61
CScope –.
Definition: scope.hpp:92
CSeq_annot_Handle –.
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
NCBI_XOBJUTIL_EXPORT string GetTitle(const CBioseq_Handle &hnd, TGetTitleFlags flags=0)
Definition: seqtitle.cpp:106
const CSeq_annot_Handle & GetAnnot(void) const
Get an annotation handle for the current seq-graph.
bool IsSetComp(void) const
bool IsSetTitle_x(void) const
double GetA(void) const
const string & GetComment(void) const
CSeq_annot_Handle m_Annot
TSeqPos GetNumval(void) const
const CSeq_graph & x_GetSeq_graph(void) const
double GetB(void) const
bool IsSetComment(void) const
const CSeq_loc & GetLoc(void) const
const CSeq_graph::TGraph & GetGraph(void) const
bool IsSetTitle_y(void) const
const string & GetTitle_y(void) const
bool IsSetLoc(void) const
DECLARE_OPERATOR_BOOL(m_Annot &&m_AnnotIndex !=eNull &&!IsRemoved())
TSeqPos GetComp(void) const
bool IsSetTitle(void) const
bool IsSetB(void) const
bool IsSetA(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
const string & GetTitle_x(void) const
const string & GetTitle(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
#define kMax_I4
Definition: ncbi_limits.h:218
#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
bool IsSetComp(void) const
compression (residues/value) Check if a value has been assigned to Comp data member.
Definition: Seq_graph_.hpp:981
bool IsSetB(void) const
display = (a x value) + b Check if a value has been assigned to B data member.
bool IsSetLoc(void) const
region this applies to Check if a value has been assigned to Loc data member.
Definition: Seq_graph_.hpp:857
bool IsSetComment(void) const
Check if a value has been assigned to Comment data member.
Definition: Seq_graph_.hpp:810
bool IsSetA(void) const
for scaling values Check if a value has been assigned to A data member.
const TGraph & GetGraph(void) const
Get the Graph member data.
const TTitle & GetTitle(void) const
Get the Title member data.
Definition: Seq_graph_.hpp:775
TB GetB(void) const
Get the B member data.
const TTitle_x & GetTitle_x(void) const
Get the Title_x member data.
Definition: Seq_graph_.hpp:899
const TTitle_y & GetTitle_y(void) const
Get the Title_y member data.
Definition: Seq_graph_.hpp:946
const TLoc & GetLoc(void) const
Get the Loc member data.
Definition: Seq_graph_.hpp:869
TNumval GetNumval(void) const
Get the Numval member data.
TA GetA(void) const
Get the A member data.
bool IsSetTitle(void) const
Check if a value has been assigned to Title data member.
Definition: Seq_graph_.hpp:763
bool IsSetTitle_x(void) const
title for x-axis Check if a value has been assigned to Title_x data member.
Definition: Seq_graph_.hpp:887
const TComment & GetComment(void) const
Get the Comment member data.
Definition: Seq_graph_.hpp:822
bool IsSetTitle_y(void) const
Check if a value has been assigned to Title_y data member.
Definition: Seq_graph_.hpp:934
TComp GetComp(void) const
Get the Comp member data.
CMapControl::TIndex TIndex
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
int GetLoc(const string &acc, const string &pat, CSeq_loc &loc, CScope &scope)
CScope & GetScope()
Modified on Fri May 24 14:52:28 2024 by modify_doxy.py rev. 669887