1 /* $Id: Seq_interval.hpp 256179 2011-03-02 18:19:45Z vasilche $
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  * Author:  .......
27  *
28  * File Description:
29  *   .......
30  *
31  * Remark:
32  *   This code was originally generated by application DATATOOL
33  *   using specifications from the ASN data definition file
34  *   'seqloc.asn'.
35  */
36 
37 #ifndef OBJECTS_SEQLOC_SEQ_INTERVAL_HPP
38 #define OBJECTS_SEQLOC_SEQ_INTERVAL_HPP
39 
40 
41 // generated includes
42 #include <objects/seqloc/Seq_interval_.hpp>
43 
44 // generated classes
45 
46 BEGIN_NCBI_SCOPE
47 
48 BEGIN_objects_SCOPE // namespace ncbi::objects::
49 
50 class NCBI_SEQLOC_EXPORT CSeq_interval : public CSeq_interval_Base
51 {
52     typedef CSeq_interval_Base Tparent;
53 public:
54     // See also related function in util/sequence.hpp:
55     //
56     //   bool IsValid(const CSeq_interval&, CScope*)
57     //
58 
59     // constructor
60     CSeq_interval(void);
61     CSeq_interval(TId& id, TFrom from, TTo to, TStrand strand = eNa_strand_unknown);
62 
63     // destructor
64     ~CSeq_interval(void);
65 
66     // Get the length of the interval
67     TSeqPos GetLength(void) const;
68 
69     // check start or stop end of location for e_Lim fuzz
70     bool IsPartialStart(ESeqLocExtremes ext) const;
71     bool IsPartialStop (ESeqLocExtremes ext) const;
72 
73     // set / remove e_Lim fuzz on start or stop end
74     void SetPartialStart(bool val, ESeqLocExtremes ext);
75     void SetPartialStop (bool val, ESeqLocExtremes ext);
76 
77     /// check if parts of the seq-loc are missing
78     bool IsTruncatedStart(ESeqLocExtremes ext) const;
79     bool IsTruncatedStop (ESeqLocExtremes ext) const;
80 
81     /// set / remove e_Lim fuzz on start or stop
82     /// (tl/tr - indicating removed parts of the seq-loc)
83     void SetTruncatedStart(bool val, ESeqLocExtremes ext);
84     void SetTruncatedStop (bool val, ESeqLocExtremes ext);
85 
86     TSeqPos GetStart(ESeqLocExtremes ext) const;
87     TSeqPos GetStop (ESeqLocExtremes ext) const;
88 
89     // Flip the strand (e.g. plus to minus)
90     void FlipStrand(void);
91 
92 private:
93     // Prohibit copy constructor & assignment operator
94     CSeq_interval(const CSeq_interval&);
95     CSeq_interval& operator= (const CSeq_interval&);
96 
97     bool x_IsMinusStrand(void) const;
98 };
99 
100 
101 
102 /////////////////// CSeq_interval inline methods
103 
104 // constructor
105 inline
CSeq_interval(void)106 CSeq_interval::CSeq_interval(void)
107 {
108 }
109 
110 
111 inline
CSeq_interval(TId & id,TFrom from,TTo to,TStrand strand)112 CSeq_interval::CSeq_interval(TId& id, TFrom from, TTo to, TStrand strand)
113 {
114     SetId(id);
115     SetFrom(from);
116     SetTo(to);
117     if ( strand != eNa_strand_unknown ) {
118         SetStrand(strand);
119     }
120 }
121 
122 
123 // length return
124 inline
GetLength(void) const125 TSeqPos CSeq_interval::GetLength(void) const
126 {
127     return GetTo() >= GetFrom() ? ((GetTo() - GetFrom()) + 1) : 0;
128 }
129 
130 /////////////////// end of CSeq_interval inline methods
131 
132 
133 END_objects_SCOPE // namespace ncbi::objects::
134 
135 END_NCBI_SCOPE
136 
137 
138 #endif // OBJECTS_SEQLOC_SEQ_INTERVAL_HPP
139