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

Go to the SVN repository for this file.

1 #ifndef PUBLIC_COMMENT_CALLBACK__HPP
2 #define PUBLIC_COMMENT_CALLBACK__HPP
3 
4 /* $Id: public_comment_callback.hpp 98837 2023-01-12 13:25:00Z satskyse $
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: Sergey Satskiy
30  *
31  * File Description:
32  *
33  */
34 
35 #include "http_daemon.hpp"
36 #include "cass_fetch.hpp"
37 
38 #include <functional>
39 
40 
42  function<void(CCassPublicCommentFetch * fetch_details,
43  string comment,
44  bool is_found)>;
46  function<void(CCassPublicCommentFetch * fetch_details,
47  CRequestStatus::ECode status,
48  int code,
49  EDiagSev severity,
50  const string & message)>;
51 
52 class IPSGS_Processor;
53 
54 
55 
57 {
58  public:
60  IPSGS_Processor * processor,
61  TPublicCommentConsumeCB consume_cb,
62  CCassPublicCommentFetch * fetch_details) :
63  m_Processor(processor),
64  m_ConsumeCB(consume_cb),
65  m_FetchDetails(fetch_details),
67  {}
68 
69  void operator()(string comment, bool is_found)
70  {
72  if (!is_found)
73  op_status = eOpStatusNotFound;
74 
76  Register(m_Processor, ePublicCommentRetrieve, op_status,
78 
79  m_ConsumeCB(m_FetchDetails, comment, is_found);
80  }
81 
82  private:
87 };
88 
89 
91 {
92  public:
94  IPSGS_Processor * processor,
95  TPublicCommentErrorCB error_cb,
96  CCassPublicCommentFetch * fetch_details) :
97  m_Processor(processor),
98  m_ErrorCB(error_cb),
99  m_FetchDetails(fetch_details),
101  {}
102 
104  int code,
105  EDiagSev severity,
106  const string & message)
107  {
108  if (status == CRequestStatus::e404_NotFound)
113  m_ErrorCB(m_FetchDetails, status, code, severity, message);
114  }
115 
116  private:
121 };
122 
123 
124 #endif
125 
CCassPublicCommentFetch * m_FetchDetails
CPublicCommentConsumeCallback(IPSGS_Processor *processor, TPublicCommentConsumeCB consume_cb, CCassPublicCommentFetch *fetch_details)
void operator()(string comment, bool is_found)
void operator()(CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)
CCassPublicCommentFetch * m_FetchDetails
CPublicCommentErrorCallback(IPSGS_Processor *processor, TPublicCommentErrorCB error_cb, CCassPublicCommentFetch *fetch_details)
COperationTiming & GetTiming(void)
static CPubseqGatewayApp * GetInstance(void)
Interface class (and self-factory) for request processor objects that can retrieve data from a given ...
EDiagSev
Severity level for the posted diagnostics.
Definition: ncbidiag.hpp:650
function< void(CCassPublicCommentFetch *fetch_details, string comment, bool is_found)> TPublicCommentConsumeCB
function< void(CCassPublicCommentFetch *fetch_details, CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)> TPublicCommentErrorCB
chrono::steady_clock psg_clock_t
psg_clock_t::time_point psg_time_point_t
Definition: inftrees.h:24
EPSGOperationStatus
Definition: timing.hpp:60
@ eOpStatusFound
Definition: timing.hpp:61
@ eOpStatusNotFound
Definition: timing.hpp:62
@ ePublicCommentRetrieve
Definition: timing.hpp:83
Modified on Fri Sep 20 14:58:30 2024 by modify_doxy.py rev. 669887