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

Go to the SVN repository for this file.

1 /* $Id: cass_blob_id.cpp 100918 2023-09-29 15:56:54Z satskyse $
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  * Authors: Sergey Satskiy
27  *
28  * File Description:
29  *
30  */
31 #include <ncbi_pch.hpp>
32 
33 #include <corelib/ncbistr.hpp>
34 
35 #include "cass_blob_id.hpp"
36 #include "pubseq_gateway.hpp"
37 
39 
40 SCass_BlobId::SCass_BlobId(const string & blob_id) :
41  m_Sat(-1), m_SatKey(-1)
42 {
43  list<string> parts;
44  NStr::Split(blob_id, ".", parts);
45 
46  if (parts.size() == 2) {
47  try {
48  m_Sat = NStr::StringToNumeric<int>(parts.front());
49  m_SatKey = NStr::StringToNumeric<int>(parts.back());
50  } catch (...) {
51  }
52  }
53 }
54 
55 
56 // Maps integer sat to a keyspace
58 {
60  if (m_Keyspace.has_value()) {
61  m_IsSecureKeyspace = m_Keyspace->IsSecureSat();
62  return true;
63  }
64  return false;
65 }
66 
USING_NCBI_SCOPE
optional< SSatInfoEntry > SatToKeyspace(int32_t sat)
static CPubseqGatewayApp * GetInstance(void)
The NCBI C++ standard methods for dealing with std::string.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
Definition: ncbistr.cpp:3461
CBioseqInfoRecord::TSat m_Sat
optional< SSatInfoEntry > m_Keyspace
optional< bool > m_IsSecureKeyspace
bool MapSatToKeyspace(void)
CBioseqInfoRecord::TSatKey m_SatKey
Modified on Mon May 27 04:40:20 2024 by modify_doxy.py rev. 669887