Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef FWCore_ParameterSet_allowedValues_h
0002 #define FWCore_ParameterSet_allowedValues_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     ParameterSet
0006 // Function:    allowedValues
0007 //
0008 /**\function allowedValues allowedValues.h FWCore/ParameterSet/interface/allowedValues.h
0009 
0010  Description: Used to describe the allowed values in a ParameterSet
0011 
0012  Usage:
0013       The function is used in conjunction with ParameterSetDescription::ifValue to just constrain the allowed values
0014  and not add additional dependent ParameterSet nodes (which is allowed by ifValue).
0015  \code
0016    edm::ParameterSetDescription psetDesc;
0017    psetDesc.ifValue(edm::ParameterDescription<std::string>("sswitch", "a", true),
0018                     edm::allowedValues<std::string>("a", "h", "z") );
0019 \endcode
0020 
0021  Implementation Details:
0022     The node associated with each allowed value is the EmptyGroupDescription which is just a dummy place holder.
0023 
0024 */
0025 //
0026 // Original Author:  Chris Jones
0027 //         Created:  Tue Jul 28 15:18:40 EDT 2020
0028 //
0029 
0030 #include "FWCore/ParameterSet/interface/ParameterDescriptionCases.h"
0031 #include "FWCore/ParameterSet/interface/EmptyGroupDescription.h"
0032 
0033 #include <memory>
0034 
0035 namespace edm {
0036 
0037   template <typename T, typename... ARGS>
0038   std::unique_ptr<edm::ParameterDescriptionCases<T>> allowedValues(ARGS&&... args) {
0039     return (... || (std::forward<ARGS>(args) >> edm::EmptyGroupDescription()));
0040   }
0041 
0042 }  // namespace edm
0043 
0044 #endif