CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends
DDSpecificsFilter Class Reference

The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs. More...

#include <DDFilter.h>

Inheritance diagram for DDSpecificsFilter:
DDFilter

Classes

struct  SpecificCriterion
 

Public Member Functions

bool accept (const DDExpandedView &) const
 true, if the DDExpandedNode fulfills the filter criteria More...
 
 DDSpecificsFilter ()
 
void setCriteria (const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
 
 ~DDSpecificsFilter ()
 
- Public Member Functions inherited from DDFilter
 DDFilter ()
 
virtual ~DDFilter ()
 

Protected Member Functions

bool accept_impl (const DDExpandedView &) const
 

Protected Attributes

std::vector< SpecificCriterioncriteria_
 
std::vector< DDLogOplogOps_
 

Friends

std::ostream & operator<< (std::ostream &os, const DDSpecificsFilter &f)
 

Detailed Description

The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.

Definition at line 32 of file DDFilter.h.

Constructor & Destructor Documentation

DDSpecificsFilter::DDSpecificsFilter ( )

Definition at line 238 of file DDFilter.cc.

239  : DDFilter()
240 { }
DDFilter()
Definition: DDFilter.cc:5
DDSpecificsFilter::~DDSpecificsFilter ( )

Definition at line 242 of file DDFilter.cc.

242 {}

Member Function Documentation

bool DDSpecificsFilter::accept ( const DDExpandedView ) const
virtual

true, if the DDExpandedNode fulfills the filter criteria

Implements DDFilter.

Definition at line 256 of file DDFilter.cc.

References accept_impl().

Referenced by Vispa.Gui.BoxContentDialog.BoxContentDialog::apply(), Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog::apply(), and esMonitoring.FDJsonServer::handle_accept().

257 {
258  return accept_impl(node);
259 }
bool accept_impl(const DDExpandedView &) const
Definition: DDFilter.cc:261
tuple node
Definition: Node.py:50
bool DDSpecificsFilter::accept_impl ( const DDExpandedView node) const
protected

Definition at line 261 of file DDFilter.cc.

References AND, begin, criteria_, end, DDLogicalPart::hasDDValue(), DDExpandedView::logicalPart(), logOps_, DDExpandedView::mergedSpecificsV(), OR, query::result, and DDExpandedView::specificsV().

Referenced by accept().

262 {
263  bool result = true;
264  auto logOpIt = logOps_.begin();
265  const DDLogicalPart & logp = node.logicalPart();
266  DDsvalues_type sv;
267  std::vector<const DDsvalues_type *> specs;
268  for( auto it = begin(criteria_); it != end(criteria_); ++it, ++logOpIt ) {
269  // avoid useless evaluations
270  if ( ( result &&(*logOpIt)==DDLogOp::OR ) ||
271  ( (!result)&&(*logOpIt)==DDLogOp::AND) ) continue;
272 
273  bool locres=false;
274  if (logp.hasDDValue(it->nameVal_)) {
275 
276  if (it->merged_) {
277 
278  if (sv.empty()) node.mergedSpecificsV(sv);
279 
280  if (it->asString_) { // merged specifics & compare std::strings
281  locres = sfs_compare(*it,sv);
282  }
283  else { // merged specifics & compare doubles
284  locres = sfd_compare(*it,sv);
285  }
286  }
287  else {
288 
289  if (specs.empty()) node.specificsV(specs);
290 
291  if (it->asString_) { // non-merged specifics & compare std::strings
292  locres = sfs_compare_nm(*it, specs);
293  }
294  else { // non-merged specifics & compare doubles
295  locres = sfd_compare_nm(*it, specs);
296  }
297  }
298  }
299  if (*logOpIt==DDLogOp::AND) {
300  result &= locres;
301  }
302  else {
303  result |= locres;
304  }
305  }
306  return result;
307 }
bool hasDDValue(const DDValue &) const
std::vector< SpecificCriterion > criteria_
Definition: DDFilter.h:71
void specificsV(std::vector< const DDsvalues_type * > &vc) const
tuple result
Definition: query.py:137
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:19
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
#define end
Definition: vmac.h:37
std::vector< DDLogOp > logOps_
Definition: DDFilter.h:72
#define begin
Definition: vmac.h:30
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the expanded-view.
void mergedSpecificsV(DDsvalues_type &res) const
void DDSpecificsFilter::setCriteria ( const DDValue nameVal,
DDCompOp  op,
DDLogOp  l = DDLogOp::AND,
bool  asString = true,
bool  merged = true 
)

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const DDSpecificsFilter f 
)
friend

Member Data Documentation

std::vector<SpecificCriterion> DDSpecificsFilter::criteria_
protected

Definition at line 71 of file DDFilter.h.

Referenced by accept_impl(), and setCriteria().

std::vector<DDLogOp> DDSpecificsFilter::logOps_
protected

Definition at line 72 of file DDFilter.h.

Referenced by accept_impl(), and setCriteria().