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

Go to the SVN repository for this file.

1 /* $Id: Suspect_rule_set.cpp 98553 2022-12-05 12:50:08Z gotvyans $
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  * Author: .......
27  *
28  * File Description:
29  * .......
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using the following specifications:
34  * 'macro.asn'.
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 
40 // generated includes
42 
43 
45 
46 // generated classes
47 
49 
50 BEGIN_objects_SCOPE // namespace ncbi::objects::
51 
52 // constructor
54 {
55 }
56 // destructor
58 {
59 }
60 
61 
62 void CSuspect_rule_set::Screen(const char* input, char* output) const
63 {
64  const auto& callback = [&](size_t n) { output[n] = 1; };
65  if (m_Precompiled_FSM) {
67  return;
68  }
69 
70  if (!m_FSM) {
71  m_FSM.reset(new CMultipatternSearch);
72  vector<string> patterns;
73  for (auto rule: Get()) {
74  const CSearch_func& find = rule->GetFind();
75  patterns.push_back(find.GetRegex());
76  }
77  m_FSM->AddPatterns(patterns);
78  }
79  m_FSM->Search(input, callback);
80 }
81 
82 
83 END_objects_SCOPE // namespace ncbi::objects::
85 
86 /* Original file checksum: lines: 57, chars: 1741, CRC32: b1125738 */
User-defined methods of the data storage class.
CMultipatternSearch.
void Search(const char *input, VoidCall1 found_callback) const
string GetRegex() const
const FSM::CCompiledFSM * m_Precompiled_FSM
void Screen(const char *input, char *output) const
unique_ptr< CMultipatternSearch > m_FSM
static SQLCHAR output[256]
Definition: print.c:5
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
const Tdata & Get(void) const
Get the member data.
static int input()
yy_size_t n
Simultaneous search of multiple RegEx patterns in the input string.
static patstr * patterns
Definition: pcregrep.c:259
Modified on Wed Apr 17 13:10:17 2024 by modify_doxy.py rev. 669887