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

Go to the SVN repository for this file.

1 #ifndef ___ASN_CACHE_LOADER__HPP
2 #define ___ASN_CACHE_LOADER__HPP
3 
4 /* $Id: asn_cache_loader.hpp 90547 2020-06-26 12:58:17Z grichenk $
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: Mike DiCuccio
30  *
31  * File Description: Object manager compliant data loader for local data
32  * storage (ASN-Cache).
33  *
34  */
35 
36 #include <objmgr/data_loader.hpp>
38 
40 
41 class CAsnCache;
42 
44 
45 //////////////////////////////////////////////////////////////////
46 //
47 // CAsnCache_DataLoader.
48 // CDataLoader implementation for local data storage.
49 //
50 
51 // Parameter names used by loader factory
52 
54 {
55 public:
57  static TRegisterLoaderInfo RegisterInObjectManager(
59  const string& db_path,
62  static string GetLoaderNameFromArgs(void);
63  static string GetLoaderNameFromArgs(const string& db_path);
64 
65  // Public constructor not to break CSimpleClassFactoryImpl code
67 
68  virtual ~CAsnCache_DataLoader(void);
69 
70  /// @name CDataLoader interface methods
71  /// @{
72  virtual TTSE_LockSet GetRecords(const CSeq_id_Handle& idh,
73  EChoice choice);
74 
75  virtual void GetIds(const CSeq_id_Handle& idh, TIds& ids);
76  virtual TSeqPos GetSequenceLength(const CSeq_id_Handle& idh);
77 
78  virtual TGi GetGi(const CSeq_id_Handle& idh);
79  virtual TTaxId GetTaxId(const CSeq_id_Handle& idh);
80  virtual bool CanGetBlobById() const;
81  virtual TBlobId GetBlobId(const CSeq_id_Handle& idh);
82  virtual TTSE_Lock GetBlobById(const TBlobId& blob_id);
83 
84 #if NCBI_PRODUCTION_VER > 20110000
85  virtual void GetGis(const TIds& ids, TLoaded& loaded, TIds& ret);
86 #endif
87 
88  /// @}
89 
94 
95 private:
96  CAsnCache_DataLoader(const string& dl_name);
97 
98  // Construct dataloader, attach the external local data storage database
99  CAsnCache_DataLoader(const string& dl_name,
100  const string& db_path);
101 
102  // thread-specific index map
103  struct SCacheInfo
104  {
105  SCacheInfo();
106  ~SCacheInfo();
107 
110  size_t requests;
111  size_t found;
112  };
113 
114  typedef vector< AutoPtr<SCacheInfo> > TIndexMap;
117  string m_DbPath;
118  SCacheInfo& x_GetIndex();
119 };
120 
122 
123 
124 extern const string kDataLoader_AsnCache_DriverName;
125 
126 extern "C"
127 {
128 
132 
136 
137 } // extern C
138 
139 
141 
142 #endif
#define NCBI_ASN_CACHE_EXPORT
const string kDataLoader_AsnCache_DriverName
void NCBI_EntryPoint_xloader_asncache(CPluginManager< objects::CDataLoader >::TDriverInfoList &info_list, CPluginManager< objects::CDataLoader >::EEntryPointRequest method)
void NCBI_EntryPoint_DataLoader_AsnCache(CPluginManager< objects::CDataLoader >::TDriverInfoList &info_list, CPluginManager< objects::CDataLoader >::EEntryPointRequest method)
SRegisterLoaderInfo< CAsnCache_DataLoader > TRegisterLoaderInfo
CParamLoaderMaker< CAsnCache_DataLoader, string > TDbMaker
vector< AutoPtr< SCacheInfo > > TIndexMap
CSimpleLoaderMaker< CAsnCache_DataLoader > TSimpleMaker
CAsnCache is used by clients to access the ASN cache data.
Definition: asn_cache.hpp:61
CFastMutex –.
Definition: ncbimtx.hpp:667
CObjectManager –.
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
SStrictId_Tax::TId TTaxId
Taxon id type.
Definition: ncbimisc.hpp:1048
string
Definition: cgiapp.hpp:687
TTaxId GetTaxId(const CBioseq_Handle &handle)
return the tax-id associated with a given sequence.
Definition: sequence.cpp:274
vector< CSeq_id_Handle > TIds
EChoice
main blob is blob with sequence all other blobs are external and contain external annotations
EIsDefault
Flag defining if the data loader is included in the "default" group.
vector< bool > TLoaded
Bulk loading interface for a small pieces of information per id.
@ kPriority_NotSet
Deprecated: use kPriority_Default instead.
list< SDriverInfo > TDriverInfoList
List of driver information.
EEntryPointRequest
Actions performed by the entry point.
#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
static bool GetIds(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
CRef< objects::CObjectManager > om
SRegisterLoaderInfo –.
Modified on Sat Apr 13 11:47:58 2024 by modify_doxy.py rev. 669887