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

Go to the SVN repository for this file.

1 #ifndef OBJTOOLS__PUBSEQ_GATEWAY__IPG__IPG_TYPES_HPP_
2 #define OBJTOOLS__PUBSEQ_GATEWAY__IPG__IPG_TYPES_HPP_
3 /*****************************************************************************
4 * $Id: ipg_types.hpp 98383 2022-11-03 16:12:16Z saprykin $
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 v* 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 * Common facilities to work with WGS VDB database.
28 *
29 *****************************************************************************/
30 
31 #include <corelib/ncbistd.hpp>
32 #include <corelib/ncbitime.hpp>
33 
35 
36 #include <functional>
37 #include <tuple>
38 #include <vector>
39 
41 BEGIN_SCOPE(ipg)
42 
43 using TIpg = Int8;
44 using TGbState = Int4;
45 using TCdsValue = Int4;
46 using TDigest = vector<unsigned char>;
47 using TIpgWeights = vector<double>;
48 using TPubMedIds = set<Int4>;
49 
50 enum class EIpgProteinFlags : Int4
51 {
52  ePartial = 1,
53  eRemote = 2,
54  eUnverified = 4,
55  eMatPeptide = 8
56 };
57 
59 {
60  eUndefined = 0,
61  eMurmur3Split16 = 1,
62 };
63 
65 {
66  eUndefined = 0,
67  eNew = 1,
68  eActive = 2,
69  eWriteProtected = 3,
70  eDisabled = 4,
71 };
72 
74 {
75  using TCIterator = vector<int32_t>::const_iterator;
76 
80  vector<int32_t> subgroups;
81 
82  bool IsReadable() const
83  {
86  }
87 
88  bool IsWriteable() const
89  {
90  switch(status) {
91  case EIpgSubgroupsStatus::eActive: return true;
93  NCBI_THROW(CIpgStorageException, eIpgUpdateReportWriteProtected,
94  string("IPG report '") + to_string(ipg) + "' is write protected."
95  );
96  default: return false;
97  }
98  }
99 };
100 
101 struct SIpgCds
102 {
103  using TCdsTuple = tuple<TCdsValue, TCdsValue, TCdsValue>;
104 
105  SIpgCds() = default;
106  SIpgCds(TCdsTuple const& cds)
107  : start(get<0>(cds))
108  , stop(get<1>(cds))
109  , strand(get<2>(cds))
110  {
111  }
112 
113  SIpgCds(TCdsValue vstart, TCdsValue vstop, TCdsValue vstrand)
114  : start(vstart)
115  , stop(vstop)
116  , strand(vstrand)
117  {
118  }
119 
121  {
122  return TCdsTuple(start, stop, strand);
123  }
124 
125  string AsString() const
126  {
127  return "(" + to_string(start) + "," + to_string(stop) + "," + to_string(strand) + ")";
128  }
129 
130  bool IsEmpty() const
131  {
132  return start == 0 && stop == 0 && strand == 0;
133  }
134 
138 };
139 
140 using TIpgCds = SIpgCds;
141 
142 END_SCOPE(ipg)
144 
145 #endif // OBJTOOLS__PUBSEQ_GATEWAY__IPG__IPG_TYPES_HPP_
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
int64_t Int8
8-byte (64-bit) signed integer
Definition: ncbitype.h:104
#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
EIpgSubgroupsStatus
Definition: ipg_types.hpp:65
vector< double > TIpgWeights
Definition: ipg_types.hpp:47
Int4 TCdsValue
Definition: ipg_types.hpp:45
Int4 TGbState
Definition: ipg_types.hpp:44
EIpgProteinFlags
Definition: ipg_types.hpp:51
EIpgSubgroupHashType
Definition: ipg_types.hpp:59
Int8 TIpg
Definition: ipg_types.hpp:43
vector< unsigned char > TDigest
Definition: ipg_types.hpp:46
Defines: CTimeFormat - storage class for time format.
@ ePartial
SIpgCds(TCdsTuple const &cds)
Definition: ipg_types.hpp:106
tuple< TCdsValue, TCdsValue, TCdsValue > TCdsTuple
Definition: ipg_types.hpp:103
TCdsValue stop
Definition: ipg_types.hpp:136
TCdsValue strand
Definition: ipg_types.hpp:137
TCdsTuple AsTuple() const
Definition: ipg_types.hpp:120
TCdsValue start
Definition: ipg_types.hpp:135
SIpgCds()=default
bool IsEmpty() const
Definition: ipg_types.hpp:130
SIpgCds(TCdsValue vstart, TCdsValue vstop, TCdsValue vstrand)
Definition: ipg_types.hpp:113
string AsString() const
Definition: ipg_types.hpp:125
EIpgSubgroupsStatus status
Definition: ipg_types.hpp:78
vector< int32_t >::const_iterator TCIterator
Definition: ipg_types.hpp:75
bool IsWriteable() const
Definition: ipg_types.hpp:88
EIpgSubgroupHashType hash_type
Definition: ipg_types.hpp:79
bool IsReadable() const
Definition: ipg_types.hpp:82
vector< int32_t > subgroups
Definition: ipg_types.hpp:80
Modified on Sun May 19 04:40:03 2024 by modify_doxy.py rev. 669887