ParameterWildcardBase

WildcardValidationCriteria

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

#ifndef FWCore_ParameterSet_ParameterWildcardBase_h
#define FWCore_ParameterSet_ParameterWildcardBase_h

#include "FWCore/ParameterSet/interface/ParameterDescriptionNode.h"

#include <set>
#include <string>
#include <iosfwd>
#include <vector>

namespace edm {

  class ParameterSet;
  class DocFormatHelper;

  enum WildcardValidationCriteria { RequireZeroOrMore, RequireAtLeastOne, RequireExactlyOne };

  class ParameterWildcardBase : public ParameterDescriptionNode {
  public:
    ~ParameterWildcardBase() override;

    ParameterTypes type() const { return type_; }
    bool isTracked() const { return isTracked_; }
    WildcardValidationCriteria criteria() const { return criteria_; }

    bool isWildcard() const override { return true; }

  protected:
    ParameterWildcardBase(ParameterTypes iType, bool isTracked, WildcardValidationCriteria criteria);

    void throwIfInvalidPattern(char const* pattern) const;
    void throwIfInvalidPattern(std::string const& pattern) const;

    void validateMatchingNames(std::vector<std::string> const& matchingNames,
                               std::set<std::string>& validatedLabels,
                               bool optional) const;

  private:
    void checkAndGetLabelsAndTypes_(std::set<std::string>& usedLabels,
                                    std::set<ParameterTypes>& parameterTypes,
                                    std::set<ParameterTypes>& wildcardTypes) const override;

    void writeCfi_(std::ostream& os,
                   Modifier modifier,
                   bool& startWithComma,
                   int indentation,
                   CfiOptions&,
                   bool& wroteSomething) const override;

    void print_(std::ostream& os, Modifier modifier, bool writeToCfi, DocFormatHelper& dfh) const override;

    bool partiallyExists_(ParameterSet const& pset) const override;

    int howManyXORSubNodesExist_(ParameterSet const& pset) const override;

    virtual void writeTemplate(std::ostream& os, int indentation, CfiOptions&) const;
    ParameterTypes type_;
    bool isTracked_;
    WildcardValidationCriteria criteria_;

    // In the future we may want to add a string for the label if
    // default values are added to be inserted into a ParameterSet
    // when missing.

    // In the future we may want to add a string for the wildcard
    // pattern if we implement regular expressions, globbing, or some
    // other kind of wildcard patterns other than "*".
  };
}  // namespace edm
#endif