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

Go to the SVN repository for this file.

1 #ifndef PSGS_OSGANNOT__HPP
2 #define PSGS_OSGANNOT__HPP
3 
4 /* $Id: osg_annot.hpp 98916 2023-01-23 23:42:19Z 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 #include "osg_resolve_base.hpp"
37 #include "osg_getblob_base.hpp"
38 
40 
42 
43 class CID2_Blob_Id;
45 
47 
50 
51 
52 class CPSGS_OSGAnnot : virtual public CPSGS_OSGProcessorBase,
54 {
55 public:
56  CPSGS_OSGAnnot(TEnabledFlags enabled_flags,
57  const CRef<COSGConnectionPool>& pool,
58  const shared_ptr<CPSGS_Request>& request,
59  const shared_ptr<CPSGS_Reply>& reply,
60  TProcessorPriority priority);
61  virtual ~CPSGS_OSGAnnot();
62 
63  virtual string GetName() const override;
64  virtual string GetGroupName() const override;
65 
66  static vector<string> WhatCanProcess(TEnabledFlags enabled_flags,
67  shared_ptr<CPSGS_Request>& request);
68  static bool CanProcess(TEnabledFlags enabled_flags,
69  shared_ptr<CPSGS_Request>& request,
70  TProcessorPriority priority);
71  static vector<string> GetNamesToProcess(TEnabledFlags enabled_flags,
72  SPSGS_AnnotRequest& request,
73  TProcessorPriority priority);
74  static bool CanProcessAnnotName(TEnabledFlags enabled_flags,
75  const string& name);
76 
77  virtual void CreateRequests() override;
78  virtual void ProcessReplies() override;
79 
80  // check if CDD request timed out inside OSG
81  virtual void NotifyOSGCallStart() override;
82  virtual void NotifyOSGCallReply(const CID2_Reply& reply) override;
83  virtual void NotifyOSGCallEnd() override;
84 
85 protected:
86  void SendReplies();
87 
88  // gets annot_name of blob-id reply
89  static string GetAnnotName(const CID2_Reply_Get_Blob_Id& blob_id);
90 
91  // returns null if blob-id is not relevant, or pointer to annot_name
92  const string* AddBlobId(const CID2_Reply_Get_Blob_Id& blob_id);
93 
94  // returns false if higher priority processor works on this annot_name
95  bool RegisterProcessedName(const string& annot_name);
96 
97  // returns true if the reply is blob-id reply about CDD
98  bool IsCDDReply(const CID2_Reply& reply) const;
99 
100 protected:
102  typedef vector<CConstRef<CID2_Reply_Get_Blob_Id>> TBlobIdList;
103  map<string, TBlobIdList> m_BlobIds;
107 };
108 
109 
113 
114 #endif // PSGS_OSGANNOT__HPP
CID2_Blob_Id –.
Definition: ID2_Blob_Id.hpp:66
CID2_Reply_Get_Blob_Id –.
CID2_Reply –.
Definition: ID2_Reply.hpp:66
virtual void ProcessReplies() override
Definition: osg_annot.cpp:265
virtual string GetName() const override
Tells the processor name (used in logging and tracing)
Definition: osg_annot.cpp:68
const string * AddBlobId(const CID2_Reply_Get_Blob_Id &blob_id)
Definition: osg_annot.cpp:331
static string GetAnnotName(const CID2_Reply_Get_Blob_Id &blob_id)
Definition: osg_annot.cpp:310
map< string, TBlobIdList > m_BlobIds
Definition: osg_annot.hpp:103
virtual void NotifyOSGCallReply(const CID2_Reply &reply) override
Definition: osg_annot.cpp:217
static bool CanProcess(TEnabledFlags enabled_flags, shared_ptr< CPSGS_Request > &request, TProcessorPriority priority)
Definition: osg_annot.cpp:105
bool IsCDDReply(const CID2_Reply &reply) const
Definition: osg_annot.cpp:404
CStopWatch m_RequestTime
Definition: osg_annot.hpp:106
static vector< string > GetNamesToProcess(TEnabledFlags enabled_flags, SPSGS_AnnotRequest &request, TProcessorPriority priority)
Definition: osg_annot.cpp:131
virtual void NotifyOSGCallStart() override
Definition: osg_annot.cpp:208
set< string > m_NamesToProcess
Definition: osg_annot.hpp:101
virtual string GetGroupName() const override
Tells the processor group name.
Definition: osg_annot.cpp:74
static vector< string > WhatCanProcess(TEnabledFlags enabled_flags, shared_ptr< CPSGS_Request > &request)
Definition: osg_annot.cpp:80
virtual ~CPSGS_OSGAnnot()
Definition: osg_annot.cpp:62
virtual void NotifyOSGCallEnd() override
Definition: osg_annot.cpp:227
vector< CConstRef< CID2_Reply_Get_Blob_Id > > TBlobIdList
Definition: osg_annot.hpp:102
static bool CanProcessAnnotName(TEnabledFlags enabled_flags, const string &name)
Definition: osg_annot.cpp:171
virtual void CreateRequests() override
Definition: osg_annot.cpp:184
void SendReplies()
Definition: osg_annot.cpp:348
CPSGS_OSGAnnot(TEnabledFlags enabled_flags, const CRef< COSGConnectionPool > &pool, const shared_ptr< CPSGS_Request > &request, const shared_ptr< CPSGS_Reply > &reply, TProcessorPriority priority)
Definition: osg_annot.cpp:52
bool RegisterProcessedName(const string &annot_name)
Definition: osg_annot.cpp:238
CStopWatch –.
Definition: ncbitime.hpp:1938
BEGIN_NAMESPACE(objects)
END_NCBI_NAMESPACE
Definition: osg_annot.hpp:112
END_NAMESPACE(objects)
BEGIN_NCBI_NAMESPACE
Definition: osg_annot.hpp:39
int TProcessorPriority
Modified on Sun Apr 14 05:25:23 2024 by modify_doxy.py rev. 669887