CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ParameterSetDescriptionFiller.h
Go to the documentation of this file.
1 #ifndef FWCore_ParameterSet_ParameterSetDescriptionFiller_h
2 #define FWCore_ParameterSet_ParameterSetDescriptionFiller_h
3 // -*- C++ -*-
4 //
5 // Package: ParameterSet
6 // Class : ParameterSetDescriptionFiller
7 //
20 //
21 // Original Author: Chris Jones
22 // Created: Wed Aug 1 16:46:56 EDT 2007
23 //
24 
28 #include "boost/mpl/if.hpp"
29 #include <string>
30 
31 namespace edm {
32  template< typename T>
34  {
35  public:
37 
38  virtual void fill(ConfigurationDescriptions & descriptions) const {
39  T::fillDescriptions(descriptions);
40  }
41 
42  virtual const std::string& baseType() const {
43  return T::baseType();
44  }
45 
46  private:
49  };
50 
51  // We need a special version of this class for Services because there is
52  // no common base class for all Service classes. This means we cannot define
53  // the baseType and fillDescriptions functions for all Service classes without
54  // great difficulty.
55 
56  // First, some template metaprogramming to determining if the class T has
57  // a fillDescriptions function.
58 
59  namespace fillDetails {
60 
61  typedef char (& no_tag)[1]; // type indicating FALSE
62  typedef char (& yes_tag)[2]; // type indicating TRUE
63 
64  template <typename T, void (*)(ConfigurationDescriptions &)> struct fillDescriptions_function;
65  template <typename T> no_tag has_fillDescriptions_helper(...);
67 
68  template<typename T>
70  static bool const value =
71  sizeof(has_fillDescriptions_helper<T>(0)) == sizeof(yes_tag);
72  };
73 
74  template <typename T>
76  void operator()(ConfigurationDescriptions & descriptions) {
77  T::fillDescriptions(descriptions);
78  }
79  };
80 
81  template <typename T>
82  struct DoFillAsUnknown {
83  void operator()(ConfigurationDescriptions & descriptions) {
85  desc.setUnknown();
86  descriptions.addDefault(desc);
87  }
88  };
89  }
90 
91  template< typename T>
93  {
94  public:
96 
97  // If T has a fillDescriptions function then just call that, otherwise
98  // put in an "unknown description" as a default.
99  virtual void fill(ConfigurationDescriptions & descriptions) const {
102  edm::fillDetails::DoFillAsUnknown<T> >::type fill_descriptions;
103  fill_descriptions(descriptions);
104  }
105 
106  virtual const std::string& baseType() const {
107  return kBaseForService;
108  }
109 
110  private:
113  };
114 
115  template<typename T>
117  {
118  public:
120 
121  // If T has a fillDescriptions function then just call that, otherwise
122  // put in an "unknown description" as a default.
123  virtual void fill(ConfigurationDescriptions & descriptions) const {
126  edm::fillDetails::DoFillAsUnknown<T> >::type fill_descriptions;
127  fill_descriptions(descriptions);
128  }
129 
130  virtual const std::string& baseType() const {
131  return kBaseForESSource;
132  }
133 
134  private:
137  };
138 
139  template<typename T>
141  {
142  public:
144 
145  // If T has a fillDescriptions function then just call that, otherwise
146  // put in an "unknown description" as a default.
147  virtual void fill(ConfigurationDescriptions & descriptions) const {
150  edm::fillDetails::DoFillAsUnknown<T> >::type fill_descriptions;
151  fill_descriptions(descriptions);
152  }
153 
154  virtual const std::string& baseType() const {
155  return kBaseForESProducer;
156  }
157 
158  private:
161  };
162 }
163 #endif
type
Definition: HCALResponse.h:22
virtual const std::string & baseType() const
virtual void fill(ConfigurationDescriptions &descriptions) const
virtual const std::string & baseType() const
virtual const std::string & baseType() const
const ParameterSetDescriptionFiller & operator=(const ParameterSetDescriptionFiller &)
no_tag has_fillDescriptions_helper(...)
void addDefault(ParameterSetDescription const &psetDescription)
virtual const std::string & baseType() const
void operator()(ConfigurationDescriptions &descriptions)
const DescriptionFillerForESSources & operator=(const DescriptionFillerForESSources &)
const DescriptionFillerForESProducers & operator=(const DescriptionFillerForESProducers &)
virtual void fill(ConfigurationDescriptions &descriptions) const
virtual void fill(ConfigurationDescriptions &descriptions) const
virtual void fill(ConfigurationDescriptions &descriptions) const
const DescriptionFillerForServices & operator=(const DescriptionFillerForServices &)
void operator()(ConfigurationDescriptions &descriptions)