Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:52

0001 
0002 #ifndef FWCore_ParameterSet_ParameterWildcardBase_h
0003 #define FWCore_ParameterSet_ParameterWildcardBase_h
0004 
0005 #include "FWCore/ParameterSet/interface/ParameterDescriptionNode.h"
0006 
0007 #include <set>
0008 #include <string>
0009 #include <iosfwd>
0010 #include <vector>
0011 
0012 namespace edm {
0013 
0014   class ParameterSet;
0015   class DocFormatHelper;
0016 
0017   enum WildcardValidationCriteria { RequireZeroOrMore, RequireAtLeastOne, RequireExactlyOne };
0018 
0019   class ParameterWildcardBase : public ParameterDescriptionNode {
0020   public:
0021     ~ParameterWildcardBase() override;
0022 
0023     ParameterTypes type() const { return type_; }
0024     bool isTracked() const { return isTracked_; }
0025     WildcardValidationCriteria criteria() const { return criteria_; }
0026 
0027   protected:
0028     ParameterWildcardBase(ParameterTypes iType, bool isTracked, WildcardValidationCriteria criteria);
0029 
0030     void throwIfInvalidPattern(char const* pattern) const;
0031     void throwIfInvalidPattern(std::string const& pattern) const;
0032 
0033     void validateMatchingNames(std::vector<std::string> const& matchingNames,
0034                                std::set<std::string>& validatedLabels,
0035                                bool optional) const;
0036 
0037   private:
0038     void checkAndGetLabelsAndTypes_(std::set<std::string>& usedLabels,
0039                                     std::set<ParameterTypes>& parameterTypes,
0040                                     std::set<ParameterTypes>& wildcardTypes) const override;
0041 
0042     void writeCfi_(
0043         std::ostream& os, bool optional, bool& startWithComma, int indentation, bool& wroteSomething) const override;
0044 
0045     void print_(std::ostream& os, bool optional, bool writeToCfi, DocFormatHelper& dfh) const override;
0046 
0047     bool partiallyExists_(ParameterSet const& pset) const override;
0048 
0049     int howManyXORSubNodesExist_(ParameterSet const& pset) const override;
0050 
0051     ParameterTypes type_;
0052     bool isTracked_;
0053     WildcardValidationCriteria criteria_;
0054 
0055     // In the future we may want to add a string for the label if
0056     // default values are added to be inserted into a ParameterSet
0057     // when missing.
0058 
0059     // In the future we may want to add a string for the wildcard
0060     // pattern if we implement regular expressions, globbing, or some
0061     // other kind of wildcard patterns other than "*".
0062   };
0063 }  // namespace edm
0064 #endif