Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-23 03:13:13

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     bool isWildcard() const override { return true; }
0028 
0029   protected:
0030     ParameterWildcardBase(ParameterTypes iType, bool isTracked, WildcardValidationCriteria criteria);
0031 
0032     void throwIfInvalidPattern(char const* pattern) const;
0033     void throwIfInvalidPattern(std::string const& pattern) const;
0034 
0035     void validateMatchingNames(std::vector<std::string> const& matchingNames,
0036                                std::set<std::string>& validatedLabels,
0037                                bool optional) const;
0038 
0039   private:
0040     void checkAndGetLabelsAndTypes_(std::set<std::string>& usedLabels,
0041                                     std::set<ParameterTypes>& parameterTypes,
0042                                     std::set<ParameterTypes>& wildcardTypes) const override;
0043 
0044     void writeCfi_(std::ostream& os,
0045                    bool optional,
0046                    bool& startWithComma,
0047                    int indentation,
0048                    CfiOptions&,
0049                    bool& wroteSomething) const override;
0050 
0051     void print_(std::ostream& os, bool optional, bool writeToCfi, DocFormatHelper& dfh) const override;
0052 
0053     bool partiallyExists_(ParameterSet const& pset) const override;
0054 
0055     int howManyXORSubNodesExist_(ParameterSet const& pset) const override;
0056 
0057     virtual void writeTemplate(std::ostream& os, int indentation, CfiOptions&) const;
0058     ParameterTypes type_;
0059     bool isTracked_;
0060     WildcardValidationCriteria criteria_;
0061 
0062     // In the future we may want to add a string for the label if
0063     // default values are added to be inserted into a ParameterSet
0064     // when missing.
0065 
0066     // In the future we may want to add a string for the wildcard
0067     // pattern if we implement regular expressions, globbing, or some
0068     // other kind of wildcard patterns other than "*".
0069   };
0070 }  // namespace edm
0071 #endif