DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Filter.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : Ianna Osborne
11 //
12 //==========================================================================
13 #ifndef DD4HEP_FILTER_H
14 #define DD4HEP_FILTER_H
15 
16 // -*- C++ -*-
17 //
18 // Class: Filter
19 //
27 //
28 // Original Author: Ianna Osborne
29 // Created: Tue, 12 Mar 2019 09:51:33 CET
30 //
31 //
32 #include <memory>
33 #include <vector>
34 #include <regex>
35 #include <unordered_map>
36 
37 namespace dd4hep {
38  struct SpecPar;
39 
40  struct Filter {
41  std::vector<bool> isRegex;
42  std::vector<bool> hasNamespace;
43  std::vector<int> index;
44  std::vector<std::string_view> skeys;
45  std::vector<std::regex> keys;
46  std::unique_ptr<Filter> next;
47  struct Filter* up;
48  const SpecPar* spec = nullptr;
49  };
50 
51  namespace dd {
52  bool accepted(std::vector<std::regex> const&, std::string_view);
53  bool accepted(const Filter*, std::string_view);
54  bool isRegex(std::string_view);
55  bool hasNamespace(std::string_view);
56  bool isMatch(std::string_view, std::string_view);
57  bool compareEqual(std::string_view, std::string_view);
58  bool compareEqual(std::string_view, std::regex);
59  bool compareEqualName(std::string_view, std::string_view);
60  bool compareEqualCopyNumber(std::string_view, int);
61  std::string_view realTopName(std::string_view);
62  std::vector<std::string_view> split(std::string_view, const char*);
63  std::string_view noNamespace(std::string_view);
64  } // namespace dd
65 } // namespace dd4hep
66 
67 #endif
dd4hep::Filter::isRegex
std::vector< bool > isRegex
Definition: Filter.h:41
dd4hep::Filter::spec
const SpecPar * spec
Definition: Filter.h:48
dd4hep::Filter::up
struct Filter * up
Definition: Filter.h:47
dd4hep::dd::isMatch
bool isMatch(std::string_view, std::string_view)
Definition: Filter.cpp:28
dd4hep::Filter::skeys
std::vector< std::string_view > skeys
Definition: Filter.h:44
dd4hep::Filter::next
std::unique_ptr< Filter > next
Definition: Filter.h:46
dd4hep::dd::hasNamespace
bool hasNamespace(std::string_view)
Definition: Filter.cpp:83
dd4hep::dd::compareEqual
bool compareEqual(std::string_view, std::string_view)
Definition: Filter.cpp:37
dd4hep::Filter::keys
std::vector< std::regex > keys
Definition: Filter.h:45
dd4hep::Filter
Definition: Filter.h:40
dd4hep::dd::isRegex
bool isRegex(std::string_view)
Definition: Filter.cpp:79
dd4hep::dd::compareEqualCopyNumber
bool compareEqualCopyNumber(std::string_view, int)
Definition: Filter.cpp:48
dd4hep::dd::compareEqualName
bool compareEqualName(std::string_view, std::string_view)
Definition: Filter.cpp:43
dd4hep::dd::split
std::vector< std::string_view > split(std::string_view, const char *)
Definition: Filter.cpp:94
dd4hep::Filter::hasNamespace
std::vector< bool > hasNamespace
Definition: Filter.h:42
dd4hep::SpecPar
Definition: SpecParRegistry.h:26
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::Filter::index
std::vector< int > index
Definition: Filter.h:43
dd4hep::dd::realTopName
std::string_view realTopName(std::string_view)
Definition: Filter.cpp:87
dd4hep::dd::noNamespace
std::string_view noNamespace(std::string_view)
Definition: Filter.cpp:111
dd4hep::dd::accepted
bool accepted(std::vector< std::regex > const &, std::string_view)
Definition: Filter.cpp:59