1 #ifndef PSGS_OSGRESOLVEBASE__HPP
2 #define PSGS_OSGRESOLVEBASE__HPP
3 
4 /*  $Id: osg_resolve_base.hpp 618623 2020-10-22 23:38:53Z 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  * Authors: Eugene Vasilchenko
30  *
31  * File Description: processor to resolve Seq-id using OSG
32  *
33  */
34 
35 #include "osg_processor_base.hpp"
36 
37 BEGIN_NCBI_NAMESPACE;
38 
39 BEGIN_NAMESPACE(objects);
40 
41 class CSeq_id;
42 class CID2_Blob_Id;
43 
44 END_NAMESPACE(objects);
45 
46 BEGIN_NAMESPACE(psg);
47 BEGIN_NAMESPACE(osg);
48 
49 
50 class CPSGS_OSGResolveBase : virtual public CPSGS_OSGProcessorBase
51 {
52 public:
53     CPSGS_OSGResolveBase();
54     virtual ~CPSGS_OSGResolveBase();
55 
CanResolve(int seq_id_type,const string & seq_id)56     static bool CanResolve(int seq_id_type, const string& seq_id)
57         {
58             return CanBeWGS(seq_id_type, seq_id);
59         }
60 
61     static bool CanBeWGS(int seq_id_type, const string& seq_id);
62 
63     static void SetSeqId(CSeq_id& id, int seq_id_type, const string& seq_id);
64 
65 protected:
66     typedef SPSGS_ResolveRequest::EPSGS_OutputFormat EOutputFormat;
67     typedef SPSGS_ResolveRequest::TPSGS_BioseqIncludeData TBioseqInfoFlags;
68 
69     CBioseqInfoRecord m_BioseqInfo;
70     string m_BlobId;
71     TBioseqInfoFlags m_BioseqInfoFlags;
72 
73     void ProcessResolveReply(const CID2_Reply& reply);
74     EOutputFormat GetOutputFormat(EOutputFormat format);
75     void SendResult(const string& data_to_send, EOutputFormat format);
76     void SendBioseqInfo(EOutputFormat output_format);
77 };
78 
79 
80 END_NAMESPACE(osg);
81 END_NAMESPACE(psg);
82 END_NCBI_NAMESPACE;
83 
84 #endif  // PSGS_OSGRESOLVEBASE__HPP
85