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

Go to the SVN repository for this file.

1 /* $Id$
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  */
27 
28 /// @file Packed_seg_.hpp
29 /// Data storage class.
30 ///
31 /// This file was generated by application DATATOOL
32 /// using the following specifications:
33 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqalign/seqalign.asn">seqalign.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqalign/seqalign.def">seqalign.def</a>
36 ///
37 /// ATTENTION:
38 /// Don't edit or commit this file into CVS as this file will
39 /// be overridden (by DATATOOL) without warning!
40 
41 #ifndef OBJECTS_SEQALIGN_PACKED_SEG_BASE_HPP
42 #define OBJECTS_SEQALIGN_PACKED_SEG_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <vector>
50 
52 
53 #ifndef BEGIN_objects_SCOPE
54 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
55 # define END_objects_SCOPE END_SCOPE(objects)
56 #endif
57 BEGIN_objects_SCOPE // namespace ncbi::objects::
58 
59 
60 // forward declarations
61 class CScore;
62 class CSeq_id;
63 
64 
65 // generated classes
66 
67 
68 /** @addtogroup dataspec_NCBI_Seqalign
69  *
70  * @{
71  */
72 
73 /////////////////////////////////////////////////////////////////////////////
74 /// for (multiway) global or partial alignments
75 ///
76 /// CPacked_seg_Base --
77 ///
78 
80 {
82 public:
83  // constructor
84  CPacked_seg_Base(void);
85  // destructor
86  virtual ~CPacked_seg_Base(void);
87 
88  // type info
90 
91  // types
92  typedef int TDim;
93  typedef int TNumseg;
94  typedef vector< CRef< CSeq_id > > TIds;
95  typedef vector< TSeqPos > TStarts;
96  typedef vector< char > TPresent;
97  typedef vector< TSeqPos > TLens;
98  typedef vector< ENa_strand > TStrands;
99  typedef vector< CRef< CScore > > TScores;
100 
101  // member index
102  enum class E_memberIndex {
103  e__allMandatory = 0,
104  e_dim,
105  e_numseg,
106  e_ids,
107  e_starts,
108  e_present,
109  e_lens,
110  e_strands,
111  e_scores
112  };
114 
115  // getters
116  // setters
117 
118  /// dimensionality
119  /// Check if a value has been assigned to Dim data member.
120  ///
121  /// Data member Dim is optional with default 2;
122  /// its type is defined as 'typedef int TDim'
123  /// @return
124  /// - true, if a value has been assigned.
125  /// - false, otherwise.
126  bool IsSetDim(void) const;
127 
128  /// Check if it is safe to call GetDim method.
129  ///
130  /// @return
131  /// - true, if the data member is getatable.
132  /// - false, otherwise.
133  bool CanGetDim(void) const;
134 
135  /// Reset Dim data member.
136  void ResetDim(void);
137 
138  /// Assign default value to Dim data member.
139  void SetDefaultDim(void);
140 
141  /// Get the Dim member data.
142  ///
143  /// @return
144  /// Copy of the member data.
145  TDim GetDim(void) const;
146 
147  /// Assign a value to Dim data member.
148  ///
149  /// @param value
150  /// Value to assign
151  void SetDim(TDim value);
152 
153  /// Assign a value to Dim data member.
154  ///
155  /// @return
156  /// Reference to the data value.
157  TDim& SetDim(void);
158 
159  /// number of segments here
160  /// Check if a value has been assigned to Numseg data member.
161  ///
162  /// Data member Numseg is mandatory;
163  /// its type is defined as 'typedef int TNumseg'
164  /// @return
165  /// - true, if a value has been assigned.
166  /// - false, otherwise.
167  bool IsSetNumseg(void) const;
168 
169  /// Check if it is safe to call GetNumseg method.
170  ///
171  /// @return
172  /// - true, if the data member is getatable.
173  /// - false, otherwise.
174  bool CanGetNumseg(void) const;
175 
176  /// Reset Numseg data member.
177  void ResetNumseg(void);
178 
179  /// Get the Numseg member data.
180  ///
181  /// @return
182  /// Copy of the member data.
183  TNumseg GetNumseg(void) const;
184 
185  /// Assign a value to Numseg data member.
186  ///
187  /// @param value
188  /// Value to assign
189  void SetNumseg(TNumseg value);
190 
191  /// Assign a value to Numseg data member.
192  ///
193  /// @return
194  /// Reference to the data value.
195  TNumseg& SetNumseg(void);
196 
197  /// sequences in order
198  /// Check if a value has been assigned to Ids data member.
199  ///
200  /// Data member Ids is mandatory;
201  /// its type is defined as 'typedef vector< CRef< CSeq_id > > TIds'
202  /// @return
203  /// - true, if a value has been assigned.
204  /// - false, otherwise.
205  bool IsSetIds(void) const;
206 
207  /// Check if it is safe to call GetIds method.
208  ///
209  /// @return
210  /// - true, if the data member is getatable.
211  /// - false, otherwise.
212  bool CanGetIds(void) const;
213 
214  /// Reset Ids data member.
215  void ResetIds(void);
216 
217  /// Get the Ids member data.
218  ///
219  /// @return
220  /// Reference to the member data.
221  const TIds& GetIds(void) const;
222 
223  /// Assign a value to Ids data member.
224  ///
225  /// @return
226  /// Reference to the data value.
227  TIds& SetIds(void);
228 
229  /// start OFFSETS in ids order for whole alignment
230  /// Check if a value has been assigned to Starts data member.
231  ///
232  /// Data member Starts is mandatory;
233  /// its type is defined as 'typedef vector< TSeqPos > TStarts'
234  /// @return
235  /// - true, if a value has been assigned.
236  /// - false, otherwise.
237  bool IsSetStarts(void) const;
238 
239  /// Check if it is safe to call GetStarts method.
240  ///
241  /// @return
242  /// - true, if the data member is getatable.
243  /// - false, otherwise.
244  bool CanGetStarts(void) const;
245 
246  /// Reset Starts data member.
247  void ResetStarts(void);
248 
249  /// Get the Starts member data.
250  ///
251  /// @return
252  /// Reference to the member data.
253  const TStarts& GetStarts(void) const;
254 
255  /// Assign a value to Starts data member.
256  ///
257  /// @return
258  /// Reference to the data value.
259  TStarts& SetStarts(void);
260 
261  /// Boolean if each sequence present or absent in
262  /// each segment
263  /// Check if a value has been assigned to Present data member.
264  ///
265  /// Data member Present is mandatory;
266  /// its type is defined as 'typedef vector< char > TPresent'
267  /// @return
268  /// - true, if a value has been assigned.
269  /// - false, otherwise.
270  bool IsSetPresent(void) const;
271 
272  /// Check if it is safe to call GetPresent method.
273  ///
274  /// @return
275  /// - true, if the data member is getatable.
276  /// - false, otherwise.
277  bool CanGetPresent(void) const;
278 
279  /// Reset Present data member.
280  void ResetPresent(void);
281 
282  /// Get the Present member data.
283  ///
284  /// @return
285  /// Reference to the member data.
286  const TPresent& GetPresent(void) const;
287 
288  /// Assign a value to Present data member.
289  ///
290  /// @return
291  /// Reference to the data value.
292  TPresent& SetPresent(void);
293 
294  /// length of each segment
295  /// Check if a value has been assigned to Lens data member.
296  ///
297  /// Data member Lens is mandatory;
298  /// its type is defined as 'typedef vector< TSeqPos > TLens'
299  /// @return
300  /// - true, if a value has been assigned.
301  /// - false, otherwise.
302  bool IsSetLens(void) const;
303 
304  /// Check if it is safe to call GetLens method.
305  ///
306  /// @return
307  /// - true, if the data member is getatable.
308  /// - false, otherwise.
309  bool CanGetLens(void) const;
310 
311  /// Reset Lens data member.
312  void ResetLens(void);
313 
314  /// Get the Lens member data.
315  ///
316  /// @return
317  /// Reference to the member data.
318  const TLens& GetLens(void) const;
319 
320  /// Assign a value to Lens data member.
321  ///
322  /// @return
323  /// Reference to the data value.
324  TLens& SetLens(void);
325 
326  /// Check if a value has been assigned to Strands data member.
327  ///
328  /// Data member Strands is optional;
329  /// its type is defined as 'typedef vector< ENa_strand > TStrands'
330  /// @return
331  /// - true, if a value has been assigned.
332  /// - false, otherwise.
333  bool IsSetStrands(void) const;
334 
335  /// Check if it is safe to call GetStrands method.
336  ///
337  /// @return
338  /// - true, if the data member is getatable.
339  /// - false, otherwise.
340  bool CanGetStrands(void) const;
341 
342  /// Reset Strands data member.
343  void ResetStrands(void);
344 
345  /// Get the Strands member data.
346  ///
347  /// @return
348  /// Reference to the member data.
349  const TStrands& GetStrands(void) const;
350 
351  /// Assign a value to Strands data member.
352  ///
353  /// @return
354  /// Reference to the data value.
355  TStrands& SetStrands(void);
356 
357  /// score for each segment
358  /// Check if a value has been assigned to Scores data member.
359  ///
360  /// Data member Scores is optional;
361  /// its type is defined as 'typedef vector< CRef< CScore > > TScores'
362  /// @return
363  /// - true, if a value has been assigned.
364  /// - false, otherwise.
365  bool IsSetScores(void) const;
366 
367  /// Check if it is safe to call GetScores method.
368  ///
369  /// @return
370  /// - true, if the data member is getatable.
371  /// - false, otherwise.
372  bool CanGetScores(void) const;
373 
374  /// Reset Scores data member.
375  void ResetScores(void);
376 
377  /// Get the Scores member data.
378  ///
379  /// @return
380  /// Reference to the member data.
381  const TScores& GetScores(void) const;
382 
383  /// Assign a value to Scores data member.
384  ///
385  /// @return
386  /// Reference to the data value.
387  TScores& SetScores(void);
388 
389  /// Reset the whole object
390  virtual void Reset(void);
391 
392 
393 private:
394  // Prohibit copy constructor and assignment operator
397 
398  // data
399  Uint4 m_set_State[1];
400  int m_Dim;
401  int m_Numseg;
402  vector< CRef< CSeq_id > > m_Ids;
403  vector< TSeqPos > m_Starts;
404  vector< char > m_Present;
405  vector< TSeqPos > m_Lens;
406  vector< ENa_strand > m_Strands;
407  vector< CRef< CScore > > m_Scores;
408 };
409 
410 /* @} */
411 
412 
413 
414 
415 
416 ///////////////////////////////////////////////////////////
417 ///////////////////// inline methods //////////////////////
418 ///////////////////////////////////////////////////////////
419 inline
421 {
422  return ((m_set_State[0] & 0x3) != 0);
423 }
424 
425 inline
427 {
428  return true;
429 }
430 
431 inline
433 {
434  m_Dim = 2;
435  m_set_State[0] &= ~0x3;
436 }
437 
438 inline
440 {
441  ResetDim();
442 }
443 
444 inline
446 {
447  return m_Dim;
448 }
449 
450 inline
452 {
453  m_Dim = value;
454  m_set_State[0] |= 0x3;
455 }
456 
457 inline
459 {
460 #ifdef _DEBUG
461  if (!IsSetDim()) {
462  memset(&m_Dim,UnassignedByte(),sizeof(m_Dim));
463  }
464 #endif
465  m_set_State[0] |= 0x1;
466  return m_Dim;
467 }
468 
469 inline
471 {
472  return ((m_set_State[0] & 0xc) != 0);
473 }
474 
475 inline
477 {
478  return IsSetNumseg();
479 }
480 
481 inline
483 {
484  m_Numseg = 0;
485  m_set_State[0] &= ~0xc;
486 }
487 
488 inline
490 {
491  if (!CanGetNumseg()) {
492  ThrowUnassigned(1);
493  }
494  return m_Numseg;
495 }
496 
497 inline
499 {
500  m_Numseg = value;
501  m_set_State[0] |= 0xc;
502 }
503 
504 inline
506 {
507 #ifdef _DEBUG
508  if (!IsSetNumseg()) {
509  memset(&m_Numseg,UnassignedByte(),sizeof(m_Numseg));
510  }
511 #endif
512  m_set_State[0] |= 0x4;
513  return m_Numseg;
514 }
515 
516 inline
518 {
519  return ((m_set_State[0] & 0x30) != 0);
520 }
521 
522 inline
524 {
525  return true;
526 }
527 
528 inline
530 {
531  return m_Ids;
532 }
533 
534 inline
536 {
537  m_set_State[0] |= 0x10;
538  return m_Ids;
539 }
540 
541 inline
543 {
544  return ((m_set_State[0] & 0xc0) != 0);
545 }
546 
547 inline
549 {
550  return true;
551 }
552 
553 inline
555 {
556  return m_Starts;
557 }
558 
559 inline
561 {
562  m_set_State[0] |= 0x40;
563  return m_Starts;
564 }
565 
566 inline
568 {
569  return ((m_set_State[0] & 0x300) != 0);
570 }
571 
572 inline
574 {
575  return IsSetPresent();
576 }
577 
578 inline
580 {
581  if (!CanGetPresent()) {
582  ThrowUnassigned(4);
583  }
584  return m_Present;
585 }
586 
587 inline
589 {
590  m_set_State[0] |= 0x100;
591  return m_Present;
592 }
593 
594 inline
596 {
597  return ((m_set_State[0] & 0xc00) != 0);
598 }
599 
600 inline
602 {
603  return true;
604 }
605 
606 inline
608 {
609  return m_Lens;
610 }
611 
612 inline
614 {
615  m_set_State[0] |= 0x400;
616  return m_Lens;
617 }
618 
619 inline
621 {
622  return ((m_set_State[0] & 0x3000) != 0);
623 }
624 
625 inline
627 {
628  return true;
629 }
630 
631 inline
633 {
634  return m_Strands;
635 }
636 
637 inline
639 {
640  m_set_State[0] |= 0x1000;
641  return m_Strands;
642 }
643 
644 inline
646 {
647  return ((m_set_State[0] & 0xc000) != 0);
648 }
649 
650 inline
652 {
653  return true;
654 }
655 
656 inline
658 {
659  return m_Scores;
660 }
661 
662 inline
664 {
665  m_set_State[0] |= 0x4000;
666  return m_Scores;
667 }
668 
669 ///////////////////////////////////////////////////////////
670 ////////////////// end of inline methods //////////////////
671 ///////////////////////////////////////////////////////////
672 
673 
674 
675 
676 
677 END_objects_SCOPE // namespace ncbi::objects::
678 
680 
681 
682 #endif // OBJECTS_SEQALIGN_PACKED_SEG_BASE_HPP
void SetScores(objects::CSeq_align &seq_align, objects::CScope &scope, const string &matrix_name="BLOSUM62")
for (multiway) global or partial alignments
Definition: Packed_seg_.hpp:80
Definition: Score.hpp:57
Base class for all serializable objects.
Definition: serialbase.hpp:150
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_SEQALIGN_EXPORT
Definition: ncbi_export.h:744
vector< CRef< CSeq_id > > TIds
Definition: Packed_seg_.hpp:94
vector< char > TPresent
Definition: Packed_seg_.hpp:96
TNumseg & SetNumseg(void)
Assign a value to Numseg data member.
vector< TSeqPos > TStarts
Definition: Packed_seg_.hpp:95
vector< CRef< CSeq_id > > m_Ids
vector< ENa_strand > TStrands
Definition: Packed_seg_.hpp:98
vector< TSeqPos > m_Lens
TPresent & SetPresent(void)
Assign a value to Present data member.
vector< CRef< CScore > > m_Scores
const TStarts & GetStarts(void) const
Get the Starts member data.
bool IsSetNumseg(void) const
number of segments here Check if a value has been assigned to Numseg data member.
TStarts & SetStarts(void)
Assign a value to Starts data member.
Uint4 m_set_State[1]
vector< CRef< CScore > > TScores
Definition: Packed_seg_.hpp:99
TScores & SetScores(void)
Assign a value to Scores data member.
CPacked_seg_Base & operator=(const CPacked_seg_Base &)
bool IsSetScores(void) const
score for each segment Check if a value has been assigned to Scores data member.
TNumseg GetNumseg(void) const
Get the Numseg member data.
bool CanGetDim(void) const
Check if it is safe to call GetDim method.
Tparent::CMemberIndex< E_memberIndex, 9 > TmemberIndex
vector< char > m_Present
void ResetDim(void)
Reset Dim data member.
bool IsSetLens(void) const
length of each segment Check if a value has been assigned to Lens data member.
vector< ENa_strand > m_Strands
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
const TScores & GetScores(void) const
Get the Scores member data.
TIds & SetIds(void)
Assign a value to Ids data member.
bool CanGetScores(void) const
Check if it is safe to call GetScores method.
const TLens & GetLens(void) const
Get the Lens member data.
const TIds & GetIds(void) const
Get the Ids member data.
const TPresent & GetPresent(void) const
Get the Present member data.
bool CanGetStarts(void) const
Check if it is safe to call GetStarts method.
TDim & SetDim(void)
Assign a value to Dim data member.
bool IsSetDim(void) const
dimensionality Check if a value has been assigned to Dim data member.
const TStrands & GetStrands(void) const
Get the Strands member data.
void SetDefaultDim(void)
Assign default value to Dim data member.
vector< TSeqPos > TLens
Definition: Packed_seg_.hpp:97
bool CanGetIds(void) const
Check if it is safe to call GetIds method.
bool CanGetStrands(void) const
Check if it is safe to call GetStrands method.
bool IsSetIds(void) const
sequences in order Check if a value has been assigned to Ids data member.
CSerialObject Tparent
Definition: Packed_seg_.hpp:81
vector< TSeqPos > m_Starts
CPacked_seg_Base(const CPacked_seg_Base &)
void ResetNumseg(void)
Reset Numseg data member.
bool IsSetPresent(void) const
Boolean if each sequence present or absent in each segment Check if a value has been assigned to Pres...
TDim GetDim(void) const
Get the Dim member data.
bool IsSetStarts(void) const
start OFFSETS in ids order for whole alignment Check if a value has been assigned to Starts data memb...
TStrands & SetStrands(void)
Assign a value to Strands data member.
bool CanGetPresent(void) const
Check if it is safe to call GetPresent method.
bool CanGetNumseg(void) const
Check if it is safe to call GetNumseg method.
bool CanGetLens(void) const
Check if it is safe to call GetLens method.
TLens & SetLens(void)
Assign a value to Lens data member.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
static bool GetIds(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
Modified on Thu Jun 13 17:33:20 2024 by modify_doxy.py rev. 669887