CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DetectorDescription/Core/interface/DDFilter.h

Go to the documentation of this file.
00001 #ifndef DDCore_DDFilter_h
00002 #define DDCore_DDFilter_h
00003 
00008 #include <vector>
00009 #include <string>
00010 #include <iosfwd>
00011 
00012 #include "DetectorDescription/Core/interface/DDsvalues.h"
00013 
00014 class DDQuery;
00015 class DDExpandedView;
00016 
00018 class DDFilter
00019 {
00020   friend class DDQuery;
00021 
00022 public:
00023   DDFilter();
00024   
00025   virtual ~DDFilter();
00026   
00028   virtual bool accept(const DDExpandedView &) const = 0;
00029   
00030 };
00031 
00032 #include "DetectorDescription/Core/interface/DDValue.h"
00033 #include "DetectorDescription/Core/interface/DDValuePair.h"
00034 
00035 
00037 class DDSpecificsFilter : public DDFilter
00038 {
00039 
00040   friend std::ostream & operator<<(std::ostream & os, const DDSpecificsFilter & f);
00041 
00042 public:
00045   enum comp_op { equals, matches, not_equals, not_matches, smaller, bigger, smaller_equals, bigger_equals };
00046   
00048   enum log_op { AND, OR };
00049 
00050 public:
00051   DDSpecificsFilter();
00052   
00053   ~DDSpecificsFilter();
00054   
00055   bool accept(const DDExpandedView &) const; 
00056               
00057   void setCriteria(const DDValue & nameVal, // name & value of a variable 
00058                    comp_op, 
00059                    log_op l = AND, 
00060                    bool asString = true, // compare strings otherwise doubles
00061                    bool merged = true // use merged-specifics or simple-specifics
00062                    );
00063                       
00064   struct SpecificCriterion {
00065     SpecificCriterion(const DDValue & nameVal, 
00066                       comp_op op,
00067                       bool asString,
00068                       bool merged)
00069      : nameVal_(nameVal), 
00070        comp_(op), 
00071        asString_(asString),
00072        merged_(merged)
00073      { }
00074      
00075      DDValue nameVal_;
00076      comp_op comp_;
00077      bool asString_;
00078      bool merged_;
00079   };
00080   
00081 protected:  
00082 
00083   bool accept_impl(const DDExpandedView &) const;
00084     
00085   typedef SpecificCriterion  criterion_type;  
00086   typedef std::vector<criterion_type> criteria_type;
00087   typedef std::vector<log_op> logops_type;
00088 
00089   criteria_type criteria_; 
00090   logops_type logOps_;
00091 };
00092 
00093 std::ostream & operator<<(std::ostream & os, const DDSpecificsFilter & f);
00094 #endif
00095 
00096