Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12: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     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_(
0045         std::ostream& os, bool optional, bool& startWithComma, int indentation, bool& wroteSomething) const override;
0046 
0047     void print_(std::ostream& os, bool optional, bool writeToCfi, DocFormatHelper& dfh) const override;
0048 
0049     bool partiallyExists_(ParameterSet const& pset) const override;
0050 
0051     int howManyXORSubNodesExist_(ParameterSet const& pset) const override;
0052 
0053     virtual void writeTemplate(std::ostream& os, int indentation) const;
0054     ParameterTypes type_;
0055     bool isTracked_;
0056     WildcardValidationCriteria criteria_;
0057 
0058     // In the future we may want to add a string for the label if
0059     // default values are added to be inserted into a ParameterSet
0060     // when missing.
0061 
0062     // In the future we may want to add a string for the wildcard
0063     // pattern if we implement regular expressions, globbing, or some
0064     // other kind of wildcard patterns other than "*".
0065   };
0066 }  // namespace edm
0067 #endif