1 #ifndef OBJTOOLS_DATA_LOADERS_SRA___SRALOADER__HPP
2 #define OBJTOOLS_DATA_LOADERS_SRA___SRALOADER__HPP
3 
4 /*  $Id: sraloader.hpp 498345 2016-04-15 14:39:08Z 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: Eugene Vasilchenko
30  *
31  * File Description: SRA file data loader
32  *
33  * ===========================================================================
34  */
35 
36 #include <corelib/ncbistd.hpp>
37 #include <objmgr/data_loader.hpp>
38 
39 BEGIN_NCBI_SCOPE
40 BEGIN_SCOPE(objects)
41 
42 class CDataLoader;
43 class CSRADataLoader_Impl;
44 
45 //
46 // class CSRADataLoader is used to retrieve consensus sequences from
47 // the SRA server
48 //
49 
50 class NCBI_XLOADER_SRA_EXPORT CSRADataLoader : public CDataLoader
51 {
52 public:
53 
54     struct SLoaderParams
55     {
56         SLoaderParams(void);
57         SLoaderParams(bool trim);
58         ~SLoaderParams(void);
59 
60         string          m_RepPath;
61         string          m_VolPath;
62         bool            m_Trim;
63     };
64 
65 
66     typedef SRegisterLoaderInfo<CSRADataLoader> TRegisterLoaderInfo;
67     enum ETrim {
68         eNoTrim,
69         eTrim
70     };
71     static TRegisterLoaderInfo RegisterInObjectManager(
72         CObjectManager& om,
73         CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault,
74         CObjectManager::TPriority priority = CObjectManager::kPriority_NotSet);
75     NCBI_DEPRECATED
76     static TRegisterLoaderInfo RegisterInObjectManager(
77         CObjectManager& om,
78         const string& rep_path,
79         const string& vol_path,
80         CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault,
81         CObjectManager::TPriority priority = CObjectManager::kPriority_NotSet);
82     static TRegisterLoaderInfo RegisterInObjectManager(
83         CObjectManager& om,
84         ETrim trim,
85         CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault,
86         CObjectManager::TPriority priority = CObjectManager::kPriority_NotSet);
87     NCBI_DEPRECATED
88     static TRegisterLoaderInfo RegisterInObjectManager(
89         CObjectManager& om,
90         const string& rep_path,
91         const string& vol_path,
92         ETrim trim,
93         CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault,
94         CObjectManager::TPriority priority = CObjectManager::kPriority_NotSet);
95     static string GetLoaderNameFromArgs(void);
96     NCBI_DEPRECATED
97     static string GetLoaderNameFromArgs(const string& rep_path,
98                                         const string& vol_path);
99     static string GetLoaderNameFromArgs(ETrim trim);
100     NCBI_DEPRECATED
101     static string GetLoaderNameFromArgs(const string& rep_path,
102                                         const string& vol_path,
103                                         ETrim trim);
104 
105     virtual TBlobId GetBlobId(const CSeq_id_Handle& idh);
106     virtual TBlobId GetBlobIdFromString(const string& str) const;
107 
108     virtual bool CanGetBlobById(void) const;
109     virtual TTSE_Lock GetBlobById(const TBlobId& blob_id);
110 
111     virtual TTSE_LockSet GetRecords(const CSeq_id_Handle& idh, EChoice choice);
112     virtual TSeqPos GetSequenceLength(const CSeq_id_Handle& idh);
113     virtual STypeFound GetSequenceTypeFound(const CSeq_id_Handle& idh);
114 
115     virtual CObjectManager::TPriority GetDefaultPriority(void) const;
116 
117 private:
118     typedef CParamLoaderMaker<CSRADataLoader, SLoaderParams> TMaker;
119     friend class CParamLoaderMaker<CSRADataLoader, SLoaderParams>;
120 
121     // default constructor
122     CSRADataLoader(void);
123     // parametrized constructor
124     CSRADataLoader(const string& loader_name, const SLoaderParams& params);
125     ~CSRADataLoader(void);
126 
127     static string GetLoaderNameFromArgs(const SLoaderParams& params);
128 
129     CRef<CSRADataLoader_Impl> m_Impl;
130 };
131 
132 
133 END_SCOPE(objects)
134 
135 
136 extern NCBI_XLOADER_SRA_EXPORT const string kDataLoader_Sra_DriverName;
137 
138 extern "C"
139 {
140 
141 NCBI_XLOADER_SRA_EXPORT
142 void NCBI_EntryPoint_DataLoader_Sra(
143     CPluginManager<objects::CDataLoader>::TDriverInfoList&   info_list,
144     CPluginManager<objects::CDataLoader>::EEntryPointRequest method);
145 
146 NCBI_XLOADER_SRA_EXPORT
147 void NCBI_EntryPoint_xloader_sra(
148     CPluginManager<objects::CDataLoader>::TDriverInfoList&   info_list,
149     CPluginManager<objects::CDataLoader>::EEntryPointRequest method);
150 
151 } // extern C
152 
153 
154 END_NCBI_SCOPE
155 
156 #endif  // OBJTOOLS_DATA_LOADERS_SRA___SRALOADER__HPP
157