NCBI C++ ToolKit
seqref.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: seqref.cpp 93710 2021-05-14 15:54:29Z vasilche $
2  * ===========================================================================
3  * PUBLIC DOMAIN NOTICE
4  * National Center for Biotechnology Information
5  *
6  * This software/database is a "United States Government Work" under the
7  * terms of the United States Copyright Act. It was written as part of
8  * the author's official duties as a United States Government employee and
9  * thus cannot be copyrighted. This software/database is freely available
10  * to the public for use. The National Library of Medicine and the U.S.
11  * Government have not placed any restriction on its use or reproduction.
12  *
13  * Although all reasonable efforts have been taken to ensure the accuracy
14  * and reliability of the software and data, the NLM and the U.S.
15  * Government do not and cannot warrant the performance or results that
16  * may be obtained by using this software or data. The NLM and the U.S.
17  * Government disclaim all warranties, express or implied, including
18  * warranties of performance, merchantability or fitness for any particular
19  * purpose.
20  *
21  * Please cite the author in any work or product based on this material.
22  * ===========================================================================
23  *
24  * Author: Eugene Vasilchenko
25  *
26  * File Description: Base data reader interface
27  *
28  */
29 
30 #include <ncbi_pch.hpp>
32 
35 
37  : m_Flags(fBlobHasAllLocal),
38  m_Gi(ZERO_GI), m_Sat(0), m_SubSat(eSubSat_main), m_SatKey(0),
39  m_Version(0)
40 {
41 }
42 
43 
44 CSeqref::CSeqref(TGi gi, TSat sat, TSatKey satkey)
45  : m_Flags(fBlobHasAllLocal),
46  m_Gi(gi), m_Sat(sat), m_SubSat(eSubSat_main), m_SatKey(satkey),
47  m_Version(0)
48 {
49 }
50 
51 
52 CSeqref::CSeqref(TGi gi, TSat sat, TSatKey satkey, TSubSat subsat, TFlags flags)
53  : m_Flags(flags),
54  m_Gi(gi), m_Sat(sat), m_SubSat(subsat), m_SatKey(satkey),
55  m_Version(0)
56 {
57 }
58 
59 
61 {
62 }
63 
64 
65 const string CSeqref::print(void) const
66 {
67  CNcbiOstrstream ostr;
68  ostr << "SeqRef(" << GetSat();
69  if ( GetSubSat() != eSubSat_main )
70  ostr << '.' << GetSubSat();
71  ostr << ',' << GetSatKey() << ',' << GetGi() << ')';
72  return CNcbiOstrstreamToString(ostr);
73 }
74 
75 
76 const string CSeqref::printTSE(void) const
77 {
78  CNcbiOstrstream ostr;
79  ostr << "TSE(" << GetSat();
80  if ( GetSubSat() != eSubSat_main )
81  ostr << '.' << GetSubSat();
82  ostr << ',' << GetSatKey() << ')';
83  return CNcbiOstrstreamToString(ostr);
84 }
85 
86 
87 const string CSeqref::printTSE(const TKeyByTSE& key)
88 {
89  CNcbiOstrstream ostr;
90  ostr << "TSE(" << key.first.first;
91  if ( key.first.second != eSubSat_main )
92  ostr << '.' << key.first.second;
93  ostr << ',' << key.second << ')';
94  return CNcbiOstrstreamToString(ostr);
95 }
96 
97 
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Definition: ncbistre.hpp:802
pair< pair< TSat, TSubSat >, TSatKey > TKeyByTSE
Definition: seqref.hpp:84
CSeqref(void)
Definition: seqref.cpp:36
TBlobContentsMask TFlags
Definition: seqref.hpp:49
@ eSubSat_main
Definition: seqref.hpp:61
virtual ~CSeqref(void)
Definition: seqref.cpp:60
Int4 TSat
Definition: seqref.hpp:72
const string print(void) const
Definition: seqref.cpp:65
TGi GetGi() const
Definition: seqref.hpp:87
Int4 TSubSat
Definition: seqref.hpp:73
TSubSat GetSubSat() const
Definition: seqref.hpp:95
Int4 TSatKey
Definition: seqref.hpp:74
const string printTSE(void) const
Definition: seqref.cpp:76
TSatKey GetSatKey() const
Definition: seqref.hpp:99
TSat GetSat() const
Definition: seqref.hpp:91
static uch flags
#define ZERO_GI
Definition: ncbimisc.hpp:1088
#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
const struct ncbi::grid::netcache::search::fields::KEY key
@ fBlobHasAllLocal
Definition: blob_id.hpp:196
Modified on Fri Sep 20 14:58:11 2024 by modify_doxy.py rev. 669887