NCBI C++ ToolKit
dummy_processor.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: dummy_processor.cpp 98308 2022-10-26 17:48:52Z satskyse $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Sergey Satskiy
27  *
28  * File Description: dummy processor
29  *
30  */
31 #include <ncbi_pch.hpp>
32 
34 #include <corelib/ncbidiag.hpp>
35 
36 #include "dummy_processor.hpp"
37 
38 
40 
41 
43 {}
44 
45 
46 CPSGS_DummyProcessor::CPSGS_DummyProcessor(shared_ptr<CPSGS_Request> request,
47  shared_ptr<CPSGS_Reply> reply,
48  TProcessorPriority priority)
49 {
51 
54  IPSGS_Processor::m_Priority = priority;
55 }
56 
57 
59 {}
60 
61 
62 bool
63 CPSGS_DummyProcessor::CanProcess(shared_ptr<CPSGS_Request> request,
64  shared_ptr<CPSGS_Reply> reply) const
65 {
66  for (const auto & dis_processor :
67  request->GetRequest<SPSGS_RequestBase>().m_DisabledProcessors) {
68  if (NStr::CompareNocase(dis_processor, "dummy") == 0) {
69  return false;
70  }
71  }
72 
73  switch (request->GetRequestType()) {
74  case CPSGS_Request::ePSGS_ResolveRequest: return true;
78  case CPSGS_Request::ePSGS_TSEChunkRequest: return true;
80  default: break;
81  }
82  return false;
83 }
84 
85 
87 CPSGS_DummyProcessor::CreateProcessor(shared_ptr<CPSGS_Request> request,
88  shared_ptr<CPSGS_Reply> reply,
89  TProcessorPriority priority) const
90 {
91  switch (request->GetRequestType()) {
93  return new CPSGS_DummyProcessor(request, reply, priority);
95  return new CPSGS_DummyProcessor(request, reply, priority);
97  return new CPSGS_DummyProcessor(request, reply, priority);
99  return new CPSGS_DummyProcessor(request, reply, priority);
101  return new CPSGS_DummyProcessor(request, reply, priority);
103  return new CPSGS_DummyProcessor(request, reply, priority);
104  default: break;
105  }
106  return nullptr;
107 }
108 
109 
111 {
112 }
113 
114 
116 {
117 }
118 
119 
122 {
123  return m_Status;
124 }
125 
127 {
128  return "DUMMY";
129 }
130 
131 
133 {
134  return "DUMMY";
135 }
136 
virtual void Process(void)
Main processing function.
IPSGS_Processor::EPSGS_Status m_Status
virtual void Cancel(void)
The infrastructure request to cancel processing.
virtual EPSGS_Status GetStatus(void)
Tells the processor status (if it has finished or in progress)
virtual string GetGroupName(void) const
Tells the processor group name.
virtual string GetName(void) const
Tells the processor name (used in logging and tracing)
virtual bool CanProcess(shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply) const override
Tells if processor can process the given request.
virtual IPSGS_Processor * CreateProcessor(shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply, TProcessorPriority priority) const
Create processor to fulfil PSG request using the data source.
@ ePSGS_BlobBySatSatKeyRequest
@ ePSGS_AccessionVersionHistoryRequest
Interface class (and self-factory) for request processor objects that can retrieve data from a given ...
shared_ptr< CPSGS_Reply > m_Reply
EPSGS_Status
The GetStatus() method returns a processor current status.
shared_ptr< CPSGS_Request > m_Request
TProcessorPriority m_Priority
USING_NCBI_SCOPE
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
Definition: ncbistr.cpp:219
Defines NCBI C++ diagnostic APIs, classes, and macros.
int TProcessorPriority
Defines CRequestStatus class for NCBI C++ diagnostic API.
vector< string > m_DisabledProcessors
Modified on Sun Jul 21 04:21:24 2024 by modify_doxy.py rev. 669887