1 #ifndef CDD_PROCESSOR__HPP
2 #define CDD_PROCESSOR__HPP
3 
4 /*  $Id: cdd_processor.hpp 629860 2021-04-22 16:38:08Z ivanov $
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: Aleksey Grichenko
30  *
31  * File Description: processor for data from CDD
32  *
33  */
34 
35 #include "ipsgs_processor.hpp"
36 #include "psgs_request.hpp"
37 #include "psgs_reply.hpp"
38 
39 BEGIN_NCBI_NAMESPACE;
40 
41 BEGIN_NAMESPACE(objects);
42 class CCDDClientPool;
43 class CCDD_Reply_Get_Blob_Id;
44 class CSeq_annot;
45 class CID2_Blob_Id;
46 END_NAMESPACE(objects);
47 
48 BEGIN_NAMESPACE(psg);
49 BEGIN_NAMESPACE(cdd);
50 
51 class CPSGS_CDDProcessor : public IPSGS_Processor
52 {
53 public:
54     CPSGS_CDDProcessor(void);
55     ~CPSGS_CDDProcessor(void) override;
56 
57     IPSGS_Processor* CreateProcessor(shared_ptr<CPSGS_Request> request,
58                                              shared_ptr<CPSGS_Reply> reply,
59                                              TProcessorPriority priority) const override;
60     void Process(void) override;
61     void Cancel(void) override;
62     EPSGS_Status GetStatus(void) override;
63     string GetName(void) const override;
64 
65 private:
66     CPSGS_CDDProcessor(shared_ptr<objects::CCDDClientPool> client_pool,
67                        shared_ptr<CPSGS_Request> request,
68                        shared_ptr<CPSGS_Reply> reply,
69                        TProcessorPriority priority);
70 
71     bool x_CanProcessAnnotRequest(SPSGS_AnnotRequest& annot_request,
72                                   TProcessorPriority priority) const;
73     bool x_CanProcessBlobRequest(SPSGS_BlobBySatSatKeyRequest& blob_request) const;
74     bool x_NameIncluded(const vector<string>& names) const;
75     void x_Finish(EPSGS_Status status);
76     void x_ProcessResolveRequest(void);
77     void x_ProcessGetBlobRequest(void);
78     void x_SendAnnotInfo(const objects::CCDD_Reply_Get_Blob_Id& blob_info);
79     void x_SendAnnot(const objects::CID2_Blob_Id& id2_blob_id, CRef<objects::CSeq_annot>& annot);
80     shared_ptr<objects::CCDDClientPool> m_ClientPool;
81     EPSGS_Status m_Status;
82 };
83 
84 
85 END_NAMESPACE(cdd);
86 END_NAMESPACE(psg);
87 END_NCBI_NAMESPACE;
88 
89 #endif  // CDD_PROCESSOR__HPP
90