CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Protected Types | 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 Types

enum  comp_op {
  equals, matches, not_equals, not_matches,
  smaller, bigger, smaller_equals, bigger_equals
}
 
enum  log_op { AND, OR }
 logical operations to obtain one result from two filter comparisons More...
 

Public Member Functions

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

Protected Types

typedef std::vector
< criterion_type
criteria_type
 
typedef SpecificCriterion criterion_type
 
typedef std::vector< log_oplogops_type
 

Protected Member Functions

bool accept_impl (const DDExpandedView &) const
 

Protected Attributes

criteria_type criteria_
 
logops_type logOps_
 

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 37 of file DDFilter.h.

Member Typedef Documentation

typedef std::vector<criterion_type> DDSpecificsFilter::criteria_type
protected

Definition at line 86 of file DDFilter.h.

Definition at line 85 of file DDFilter.h.

typedef std::vector<log_op> DDSpecificsFilter::logops_type
protected

Definition at line 87 of file DDFilter.h.

Member Enumeration Documentation

comparison operators to be used with this filter

Enumerator
equals 
matches 
not_equals 
not_matches 
smaller 
bigger 
smaller_equals 
bigger_equals 

Definition at line 45 of file DDFilter.h.

logical operations to obtain one result from two filter comparisons

Enumerator
AND 
OR 

Definition at line 48 of file DDFilter.h.

Constructor & Destructor Documentation

DDSpecificsFilter::DDSpecificsFilter ( )

Definition at line 278 of file DDFilter.cc.

279  : DDFilter()
280 { }
DDFilter()
Definition: DDFilter.cc:7
DDSpecificsFilter::~DDSpecificsFilter ( )

Definition at line 282 of file DDFilter.cc.

282 {}

Member Function Documentation

bool DDSpecificsFilter::accept ( const DDExpandedView ) const
virtual

true, if the DDExpandedNode fulfills the filter criteria

Implements DDFilter.

Definition at line 296 of file DDFilter.cc.

References accept_impl().

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

297 {
298  return accept_impl(node);
299 }
bool accept_impl(const DDExpandedView &) const
Definition: DDFilter.cc:302
tuple node
Definition: Node.py:50
bool DDSpecificsFilter::accept_impl ( const DDExpandedView node) const
protected

Definition at line 302 of file DDFilter.cc.

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

Referenced by accept().

303 {
304  bool result = true;
305  criteria_type::const_iterator it = criteria_.begin();
306  criteria_type::const_iterator crEnd = criteria_.end();
307  logops_type::const_iterator logOpIt = logOps_.begin();
308  //logops_type::iterator logOpEnd = logOps_.end();
309  const DDLogicalPart & logp = node.logicalPart();
310  DDsvalues_type sv;
311  std::vector<const DDsvalues_type *> specs;
312  for (; it != crEnd; ++it, ++logOpIt) {
313  // avoid useless evaluations
314  if ( ( result &&(*logOpIt)==OR ) ||
315  ( (!result)&&(*logOpIt)==AND) ) continue;
316 
317  bool locres=false;
318  if (logp.hasDDValue(it->nameVal_)) {
319 
320  if (it->merged_) {
321 
322  if (sv.empty()) node.mergedSpecificsV(sv);
323 
324  if (it->asString_) { // merged specifics & compare std::strings
325  locres = sfs_compare(*it,sv);
326  }
327  else { // merged specifics & compare doubles
328  locres = sfd_compare(*it,sv);
329  }
330  }
331  else {
332 
333  if (specs.empty()) node.specificsV(specs);
334 
335  if (it->asString_) { // non-merged specifics & compare std::strings
336  locres = sfs_compare_nm(*it, specs);
337  }
338  else { // non-merged specifics & compare doubles
339  locres = sfd_compare_nm(*it, specs);
340  }
341  }
342  }
343  if (*logOpIt==AND) {
344  result &= locres;
345  }
346  else {
347  result |= locres;
348  }
349  }
350  return result;
351 }
bool hasDDValue(const DDValue &) const
criteria_type criteria_
Definition: DDFilter.h:89
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
logops_type logOps_
Definition: DDFilter.h:90
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,
comp_op  op,
log_op  l = 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

criteria_type DDSpecificsFilter::criteria_
protected

Definition at line 89 of file DDFilter.h.

Referenced by accept_impl(), and setCriteria().

logops_type DDSpecificsFilter::logOps_
protected

Definition at line 90 of file DDFilter.h.

Referenced by accept_impl(), and setCriteria().