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

Go to the SVN repository for this file.

1 #ifndef ANNOT_TYPE_SELECTOR__HPP
2 #define ANNOT_TYPE_SELECTOR__HPP
3 
4 /* $Id: annot_type_selector.hpp 88126 2019-11-12 17:11:44Z vasilche $
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, Michael Kimelman, Eugene Vasilchenko
30 *
31 * File Description:
32 * Annotations selector structure.
33 *
34 */
35 
36 
39 
42 
43 
45 {
52 
54  : m_FeatSubtype(CSeqFeatData::eSubtype_any),
55  m_FeatType(CSeqFeatData::e_not_set),
56  m_AnnotType(TAnnotTypeInt(annot))
57  {
58  }
59 
61  : m_FeatSubtype(CSeqFeatData::eSubtype_any),
62  m_FeatType(TFeatTypeInt(feat)),
63  m_AnnotType(CSeq_annot::C_Data::e_Ftable)
64  {
65  }
66 
68  : m_FeatSubtype(TFeatSubtypeInt(feat_subtype)),
69  m_FeatType(TFeatTypeInt(CSeqFeatData::GetTypeFromSubtype(feat_subtype))),
70  m_AnnotType(CSeq_annot::C_Data::e_Ftable)
71  {
72  }
73 
75  {
76  return TAnnotType(m_AnnotType);
77  }
78 
79  TFeatType GetFeatType(void) const
80  {
81  return TFeatType(m_FeatType);
82  }
83 
85  {
86  return TFeatSubtype(m_FeatSubtype);
87  }
88 
89  bool operator<(const SAnnotTypeSelector& s) const
90  {
91  if ( m_AnnotType != s.m_AnnotType )
92  return m_AnnotType < s.m_AnnotType;
93  if ( m_FeatType != s.m_FeatType )
94  return m_FeatType < s.m_FeatType;
95  return m_FeatSubtype < s.m_FeatSubtype;
96  }
97 
98  bool operator==(const SAnnotTypeSelector& s) const
99  {
100  return m_AnnotType == s.m_AnnotType &&
101  m_FeatType == s.m_FeatType &&
102  m_FeatSubtype == s.m_FeatSubtype;
103  }
104 
105  bool operator!=(const SAnnotTypeSelector& s) const
106  {
107  return m_AnnotType != s.m_AnnotType ||
108  m_FeatType != s.m_FeatType ||
109  m_FeatSubtype != s.m_FeatSubtype;
110  }
111 
113  {
114  if ( m_AnnotType != type ) {
115  m_AnnotType = TAnnotTypeInt(type);
116  // Reset feature type/subtype
117  m_FeatType = CSeqFeatData::e_not_set;
118  m_FeatSubtype = CSeqFeatData::eSubtype_any;
119  }
120  }
121 
123  {
124  m_FeatType = TFeatTypeInt(type);
125  // Adjust annot type and feature subtype
126  m_AnnotType = CSeq_annot::C_Data::e_Ftable;
127  m_FeatSubtype = CSeqFeatData::eSubtype_any;
128  }
129 
131  {
132  m_FeatSubtype = TFeatSubtypeInt(subtype);
133  // Adjust annot type and feature type
134  m_AnnotType = CSeq_annot::C_Data::e_Ftable;
135  if (m_FeatSubtype != CSeqFeatData::eSubtype_any) {
136  m_FeatType =
138  }
139  }
140 
141 private:
142  TFeatSubtypeInt m_FeatSubtype; // Seq-feat subtype
143  TFeatTypeInt m_FeatType; // Seq-feat type
144  TAnnotTypeInt m_AnnotType; // Annotation type
145 };
146 
147 
150 
151 #endif // ANNOT_TYPE_SELECTOR__HPP
static E_Choice GetTypeFromSubtype(ESubtype subtype)
objects::CSeqFeatData::ESubtype GetFeatSubtype(const string &feat_type)
Definition: macro_util.cpp:350
uint8_t Uint1
1-byte (8-bit) unsigned integer
Definition: ncbitype.h:99
uint16_t Uint2
2-byte (16-bit) unsigned integer
Definition: ncbitype.h:101
#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
E_Choice
Choice variants.
@ e_not_set
No variant selected.
E_Choice
Choice variants.
Definition: Seq_annot_.hpp:131
@ e_not_set
No variant selected.
Definition: Seq_annot_.hpp:132
@ e_not_set
bool operator!=(const SAnnotTypeSelector &s) const
TFeatSubtype GetFeatSubtype(void) const
CSeq_annot::C_Data::E_Choice TAnnotType
CSeqFeatData::ESubtype TFeatSubtype
TAnnotType GetAnnotType(void) const
SAnnotTypeSelector(TFeatSubtype feat_subtype)
TFeatType GetFeatType(void) const
void SetAnnotType(TAnnotType type)
bool operator==(const SAnnotTypeSelector &s) const
bool operator<(const SAnnotTypeSelector &s) const
void SetFeatType(TFeatType type)
void SetFeatSubtype(TFeatSubtype subtype)
SAnnotTypeSelector(TAnnotType annot=CSeq_annot::C_Data::e_not_set)
SAnnotTypeSelector(TFeatType feat)
CSeqFeatData::E_Choice TFeatType
TFeatSubtypeInt m_FeatSubtype
Definition: type.c:6
Modified on Wed Apr 17 13:08:48 2024 by modify_doxy.py rev. 669887