Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:52

0001 #ifndef FWCore_ParameterSet_ParameterSwitchBase_h
0002 #define FWCore_ParameterSet_ParameterSwitchBase_h
0003 
0004 #include "FWCore/ParameterSet/interface/ParameterDescriptionNode.h"
0005 #include "FWCore/Utilities/interface/value_ptr.h"
0006 
0007 #include <string>
0008 #include <set>
0009 #include <utility>
0010 #include <iosfwd>
0011 
0012 namespace edm {
0013 
0014   class DocFormatHelper;
0015 
0016   class ParameterSwitchBase : public ParameterDescriptionNode {
0017   public:
0018     ~ParameterSwitchBase() override;
0019 
0020   protected:
0021     void insertAndCheckLabels(std::string const& switchLabel,
0022                               std::set<std::string>& usedLabels,
0023                               std::set<std::string>& labels) const;
0024 
0025     void insertAndCheckTypes(ParameterTypes switchType,
0026                              std::set<ParameterTypes> const& caseParameterTypes,
0027                              std::set<ParameterTypes> const& caseWildcardTypes,
0028                              std::set<ParameterTypes>& parameterTypes,
0029                              std::set<ParameterTypes>& wildcardTypes) const;
0030 
0031     void throwDuplicateCaseValues(std::string const& switchLabel) const;
0032 
0033     void throwNoCaseForDefault(std::string const& switchLabel) const;
0034 
0035     void throwNoCaseForSwitchValue(std::string const& message) const;
0036 
0037     void printBase(std::ostream& os,
0038                    bool optional,
0039                    bool writeToCfi,
0040                    DocFormatHelper& dfh,
0041                    std::string const& switchLabel,
0042                    bool isTracked,
0043                    std::string const& typeString) const;
0044 
0045     bool hasNestedContent_() const override;
0046 
0047     void printNestedContentBase(std::ostream& os,
0048                                 DocFormatHelper& dfh,
0049                                 DocFormatHelper& new_dfh,
0050                                 std::string const& switchLabel) const;
0051 
0052     template <typename T>
0053     static void printCaseT(std::pair<T, edm::value_ptr<ParameterDescriptionNode> > const& p,
0054                            std::ostream& os,
0055                            bool optional,
0056                            DocFormatHelper& dfh,
0057                            std::string const& switchLabel) {
0058       ParameterSwitchBase::printCase(p, os, optional, dfh, switchLabel);
0059     }
0060 
0061   private:
0062     static void printCase(std::pair<bool, edm::value_ptr<ParameterDescriptionNode> > const& p,
0063                           std::ostream& os,
0064                           bool optional,
0065                           DocFormatHelper& dfh,
0066                           std::string const& switchLabel);
0067 
0068     static void printCase(std::pair<int, edm::value_ptr<ParameterDescriptionNode> > const& p,
0069                           std::ostream& os,
0070                           bool optional,
0071                           DocFormatHelper& dfh,
0072                           std::string const& switchLabel);
0073 
0074     static void printCase(std::pair<std::string, edm::value_ptr<ParameterDescriptionNode> > const& p,
0075                           std::ostream& os,
0076                           bool optional,
0077                           DocFormatHelper& dfh,
0078                           std::string const& switchLabel);
0079 
0080     bool partiallyExists_(ParameterSet const& pset) const override;
0081 
0082     int howManyXORSubNodesExist_(ParameterSet const& pset) const override;
0083   };
0084 }  // namespace edm
0085 
0086 #endif