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

Go to the SVN repository for this file.

1 #ifndef SPLIT_HISTORY_CALLBACK__HPP
2 #define SPLIT_HISTORY_CALLBACK__HPP
3 
4 /* $Id: split_history_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(CCassSplitHistoryFetch * fetch_details,
43  vector<SSplitHistoryRecord> && result)>;
45  function<void(CCassSplitHistoryFetch * fetch_details,
46  CRequestStatus::ECode status,
47  int code,
48  EDiagSev severity,
49  const string & message)>;
50 
51 class IPSGS_Processor;
52 
53 
55 {
56  public:
58  IPSGS_Processor * processor,
59  TSplitHistoryConsumeCB consume_cb,
60  CCassSplitHistoryFetch * fetch_details) :
61  m_Processor(processor),
62  m_ConsumeCB(consume_cb),
63  m_FetchDetails(fetch_details),
65  {}
66 
67  void operator()(vector<SSplitHistoryRecord> && result)
68  {
70  if (result.empty())
71  op_status = eOpStatusNotFound;
72 
74  Register(m_Processor, eSplitHistoryRetrieve, op_status,
76 
77  m_ConsumeCB(m_FetchDetails, std::move(result));
78  }
79 
80  private:
85 };
86 
87 
89 {
90  public:
92  IPSGS_Processor * processor,
93  TSplitHistoryErrorCB error_cb,
94  CCassSplitHistoryFetch * fetch_details) :
95  m_Processor(processor),
96  m_ErrorCB(error_cb),
97  m_FetchDetails(fetch_details),
99  {}
100 
102  int code,
103  EDiagSev severity,
104  const string & message)
105  {
106  if (status == CRequestStatus::e404_NotFound)
111  m_ErrorCB(m_FetchDetails, status, code, severity, message);
112  }
113 
114  private:
119 };
120 
121 
122 #endif
123 
COperationTiming & GetTiming(void)
static CPubseqGatewayApp * GetInstance(void)
CSplitHistoryConsumeCallback(IPSGS_Processor *processor, TSplitHistoryConsumeCB consume_cb, CCassSplitHistoryFetch *fetch_details)
CCassSplitHistoryFetch * m_FetchDetails
void operator()(vector< SSplitHistoryRecord > &&result)
CSplitHistoryErrorCallback(IPSGS_Processor *processor, TSplitHistoryErrorCB error_cb, CCassSplitHistoryFetch *fetch_details)
CCassSplitHistoryFetch * m_FetchDetails
void operator()(CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)
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
chrono::steady_clock psg_clock_t
psg_clock_t::time_point psg_time_point_t
function< void(CCassSplitHistoryFetch *fetch_details, vector< SSplitHistoryRecord > &&result)> TSplitHistoryConsumeCB
function< void(CCassSplitHistoryFetch *fetch_details, CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)> TSplitHistoryErrorCB
Definition: inftrees.h:24
EPSGOperationStatus
Definition: timing.hpp:60
@ eOpStatusFound
Definition: timing.hpp:61
@ eOpStatusNotFound
Definition: timing.hpp:62
@ eSplitHistoryRetrieve
Definition: timing.hpp:82
else result
Definition: token2.c:20
Modified on Wed Feb 21 09:54:42 2024 by modify_doxy.py rev. 669887