CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDFilter.h
Go to the documentation of this file.
1 #ifndef DDCore_DDFilter_h
2 #define DDCore_DDFilter_h
3 
8 #include <vector>
9 #include <string>
10 #include <iosfwd>
11 
13 
14 class DDQuery;
15 class DDExpandedView;
16 
18 class DDFilter
19 {
20  friend class DDQuery;
21 
22 public:
23  DDFilter();
24 
25  virtual ~DDFilter();
26 
28  virtual bool accept(const DDExpandedView &) const = 0;
29 
30 };
31 
34 
35 
38 {
39 
40  friend std::ostream & operator<<(std::ostream & os, const DDSpecificsFilter & f);
41 
42 public:
46 
48  enum log_op { AND, OR };
49 
50 public:
52 
54 
55  bool accept(const DDExpandedView &) const;
56 
57  void setCriteria(const DDValue & nameVal, // name & value of a variable
58  comp_op,
59  log_op l = AND,
60  bool asString = true, // compare strings otherwise doubles
61  bool merged = true // use merged-specifics or simple-specifics
62  );
63 
65  SpecificCriterion(const DDValue & nameVal,
66  comp_op op,
67  bool asString,
68  bool merged)
69  : nameVal_(nameVal),
70  comp_(op),
71  asString_(asString),
72  merged_(merged)
73  { }
74 
77  bool asString_;
78  bool merged_;
79  };
80 
81 protected:
82 
83  bool accept_impl(const DDExpandedView &) const;
84 
86  typedef std::vector<criterion_type> criteria_type;
87  typedef std::vector<log_op> logops_type;
88 
91 };
92 
93 std::ostream & operator<<(std::ostream & os, const DDSpecificsFilter & f);
94 #endif
95 
96 
virtual ~DDFilter()
Definition: DDFilter.cc:11
Base class for querying for nodes in the DDExpandedView.
Definition: DDQuery.h:15
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
log_op
logical operations to obtain one result from two filter comparisons
Definition: DDFilter.h:48
bool accept_impl(const DDExpandedView &) const
Definition: DDFilter.cc:302
friend std::ostream & operator<<(std::ostream &os, const DDSpecificsFilter &f)
criteria_type criteria_
Definition: DDFilter.h:89
SpecificCriterion criterion_type
Definition: DDFilter.h:85
double f[11][100]
SpecificCriterion(const DDValue &nameVal, comp_op op, bool asString, bool merged)
Definition: DDFilter.h:65
DDFilter()
Definition: DDFilter.cc:7
A Filter accepts or rejects a DDExpandedNode based on a user-coded decision rule. ...
Definition: DDFilter.h:18
virtual bool accept(const DDExpandedView &) const =0
true, if the DDExpandedNode fulfills the filter criteria
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:285
bool accept(const DDExpandedView &) const
true, if the DDExpandedNode fulfills the filter criteria
Definition: DDFilter.cc:296
logops_type logOps_
Definition: DDFilter.h:90
std::vector< criterion_type > criteria_type
Definition: DDFilter.h:86
std::vector< log_op > logops_type
Definition: DDFilter.h:87
Provides an exploded view of the detector (tree-view)
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37