1 /* $Id: Dense_diag.hpp 479309 2015-09-18 13:33:56Z grichenk $
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 Dense_diag.hpp
29 /// User-defined methods of the data storage class.
30 ///
31 /// This file was originally generated by application DATATOOL
32 /// using the following specifications:
33 /// 'seqalign.asn'.
34 ///
35 /// New methods or data members can be added to it if needed.
36 /// See also: Dense_diag_.hpp
37
38
39 #ifndef OBJECTS_SEQALIGN_DENSE_DIAG_HPP
40 #define OBJECTS_SEQALIGN_DENSE_DIAG_HPP
41
42
43 // generated includes
44 #include <objects/seqalign/Dense_diag_.hpp>
45
46 #include <objects/seqalign/seqalign_exception.hpp>
47 #include <util/range.hpp>
48
49 // generated classes
50
51 BEGIN_NCBI_SCOPE
52
53 BEGIN_objects_SCOPE // namespace ncbi::objects::
54
55 class CSeq_interval;
56
57 /////////////////////////////////////////////////////////////////////////////
58 class NCBI_SEQALIGN_EXPORT CDense_diag : public CDense_diag_Base
59 {
60 typedef CDense_diag_Base Tparent;
61 public:
62 // constructor
63 CDense_diag(void);
64 // destructor
65 ~CDense_diag(void);
66
67 /// Validators
68 TDim CheckNumRows(void) const;
69 void Validate () const;
70
71 /// GetSeqRange
72 CRange<TSeqPos> GetSeqRange (TDim row) const;
73 TSeqPos GetSeqStart (TDim row) const;
74 TSeqPos GetSeqStop (TDim row) const;
75 ENa_strand GetSeqStrand(TDim row) const;
76
77 /// Offset row's coords
78 void OffsetRow(TDim row, TSignedSeqPos offset);
79
80 CRef<CSeq_interval> CreateRowSeq_interval(TDim row) const;
81
82 private:
83 // Prohibit copy constructor and assignment operator
84 CDense_diag(const CDense_diag& value);
85 CDense_diag& operator=(const CDense_diag& value);
86
87 };
88
89 /////////////////// CDense_diag inline methods
90
91 // constructor
92 inline
CDense_diag(void)93 CDense_diag::CDense_diag(void)
94 {
95 }
96
97
98 inline
GetSeqStart(TDim row) const99 TSeqPos CDense_diag::GetSeqStart(TDim row) const
100 {
101 if (row < 0 || row >= GetDim()) {
102 NCBI_THROW(CSeqalignException, eInvalidRowNumber,
103 "CDense_diag::GetSeqStart():"
104 " Invalid row number");
105 }
106 return GetStarts()[row];
107 }
108
109
110 inline
GetSeqStop(TDim row) const111 TSeqPos CDense_diag::GetSeqStop(TDim row) const
112 {
113 return GetSeqStart(row) + GetLen() - 1;
114 }
115
116
117 inline
GetSeqRange(TDim row) const118 CRange<TSeqPos> CDense_diag::GetSeqRange(TDim row) const
119 {
120 return CRange<TSeqPos>(GetSeqStart(row), GetSeqStop(row));
121 }
122
123
124 inline
CheckNumRows() const125 CDense_diag::TDim CDense_diag::CheckNumRows() const
126 {
127 TDim dim = GetDim();
128 if (size_t(dim) != GetIds().size() || size_t(dim) != GetStarts().size()) {
129 NCBI_THROW(CSeqalignException, eInvalidAlignment,
130 "CDense_diag::CheckNumRows()"
131 " dim is not consistent with ids.size & starts.size");
132 }
133 return dim;
134 }
135
136
137 /////////////////// end of CDense_diag inline methods
138
139
140 END_objects_SCOPE // namespace ncbi::objects::
141
142 END_NCBI_SCOPE
143
144 #endif // OBJECTS_SEQALIGN_DENSE_DIAG_HPP
145 /* Original file checksum: lines: 94, chars: 2608, CRC32: ba2ec5bc */
146