1 /* $Id: PDB_seq_id.hpp 601577 2020-02-10 19:22:25Z lanczyck $
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_PDB_SEQ_ID_HPP
38 #define OBJECTS_SEQLOC_PDB_SEQ_ID_HPP
39 
40 
41 // generated includes
42 #include <objects/seqloc/PDB_seq_id_.hpp>
43 
44 // generated classes
45 
46 BEGIN_NCBI_SCOPE
47 
48 BEGIN_objects_SCOPE // namespace ncbi::objects::
49 
50 class NCBI_SEQLOC_EXPORT CPDB_seq_id : public CPDB_seq_id_Base
51 {
52     typedef CPDB_seq_id_Base Tparent;
53 public:
54     // constructor
55     CPDB_seq_id(void);
56     // destructor
57     ~CPDB_seq_id(void);
58 
59     // comaprison function
60     bool Match(const CPDB_seq_id& psip2) const;
61     int Compare(const CPDB_seq_id& psip2) const;
62 
63     // format a FASTA style string
64     ostream& AsFastaString(ostream& s) const;
65 
66 
67     //  Reset both chain and chain-id.
68     void ResetChainIdentifiers(void);
69 
70     //  Sets both 'chain' and 'chain-id'.
71     void SetChainIdentifiers(TChain chainIdentifier);
72 
73     //  Sets 'chain' and 'chain-id' to the same value, when possible.
74     //  When chainIdentifier is not a single-character, 'chain' is reset to avoid internal inconsistency.
75     //  If chainIdentifier is empty, or  both 'chain' and 'chain-id' are reset.
76     //  If chainIdentifier contains only whitespace:
77     //      length == 1:  both fields set to ' ' (this is a valid 'chain' value)
78     //      length >  1:  both 'chain' and 'chain-id' are reset (an invalid 'chain_id' value)
79     void SetChainIdentifiers(const TChain_id& chainIdentifier);
80 
81 
82     //  How to define the effective chain identifier when neither 'chain' nor 'chain-id' has been set.
83     enum EBothUnsetPriority {
84         eBothUnset_Chain,     //  a single space ('chain's default value)
85         eBothUnset_ChainId    //  empty string   ('chain-id' does not have a default)
86     };
87 
88     //  Return the effective chain identifier string defined as:
89     //
90     //    i) 'chain-id', when set;
91     //   ii) 'chain', when set;
92     //  iii) when neither are set, as per 'bothUnsetPriority'.
93     //
94     //  NB:  When both 'chain' and 'chain-id' are set there is no guarantee they are consistent.
95     //  See also:  IsChainConflict
96     string GetEffectiveChain_id(EBothUnsetPriority bothUnsetPriority = eBothUnset_ChainId) const;
97 
98 
99     //  "Legacy" encoding represents a lowercase character as the  corresponding uppercase character, doubled.
100     //  E.g., in GenPept pages chain = 65 = 'a' would be displayed as "AA".
101     enum EConflictMode {
102         eConflictMode_default,  //  conflicts detected by string comparisons
103         eConflictMode_legacy    //  ignore conflicts due purely to legacy encoding
104     };
105 
106     //  True iff both 'chain' and 'chain-id' are set and the values aren't equivalent according to the
107     //  specified conflict mode.
108     //  eConflictMode_default  :  chain = 65 = 'a' and chain-id = "AA" are not equivalent.
109     //  eConflictMode_legacy   :  chain = 65 = 'a' and chain-id = "AA" are considered equivalent.
110     //
111     //  Note: eConflictMode_legacy does not require that a lowercase chain value be encoded.
112     bool IsChainConflict(EConflictMode encodingMode = eConflictMode_default) const;
113 
114 
115 private:
116     // Prohibit copy constructor & assignment operator
117     CPDB_seq_id(const CPDB_seq_id&);
118     CPDB_seq_id& operator= (const CPDB_seq_id&);
119 
120 };
121 
122 
123 
124 /////////////////// CPDB_seq_id inline methods
125 
126 // constructor
127 inline
CPDB_seq_id(void)128 CPDB_seq_id::CPDB_seq_id(void)
129 {
130 }
131 
132 
133 /////////////////// end of CPDB_seq_id inline methods
134 
135 
136 END_objects_SCOPE // namespace ncbi::objects::
137 
138 END_NCBI_SCOPE
139 
140 
141 #endif // OBJECTS_SEQLOC_PDB_SEQ_ID_HPP
142 /* Original file checksum: lines: 85, chars: 2258, CRC32: 8edce8b4 */
143