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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#ifndef FWCore_ParameterSet_AllowedLabelsDescription_h
#define FWCore_ParameterSet_AllowedLabelsDescription_h
#include "FWCore/ParameterSet/interface/AllowedLabelsDescriptionBase.h"
#include "FWCore/ParameterSet/interface/ParameterDescriptionNode.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescriptionTraits.h"
#include "FWCore/Utilities/interface/value_ptr.h"
#include <string>
#include <set>
#include <vector>
#include <iosfwd>
namespace edm {
class VParameterSetEntry;
class ParameterSetDescription;
class DocFormatHelper;
template <class T>
class AllowedLabelsDescription : public AllowedLabelsDescriptionBase {
public:
AllowedLabelsDescription(std::string const& label, bool isTracked)
: AllowedLabelsDescriptionBase(label, ParameterTypeToEnum::toEnum<T>(), isTracked) {}
AllowedLabelsDescription(char const* label, bool isTracked)
: AllowedLabelsDescriptionBase(label, ParameterTypeToEnum::toEnum<T>(), isTracked) {}
~AllowedLabelsDescription() override {}
ParameterDescriptionNode* clone() const override { return new AllowedLabelsDescription(*this); }
private:
void validateAllowedLabel_(std::string const& allowedLabel,
ParameterSet& pset,
std::set<std::string>& validatedLabels) const override {
if (pset.existsAs<T>(allowedLabel, isTracked())) {
validatedLabels.insert(allowedLabel);
}
}
};
template <>
class AllowedLabelsDescription<ParameterSetDescription> : public AllowedLabelsDescriptionBase {
public:
AllowedLabelsDescription(std::string const& label, bool isTracked);
AllowedLabelsDescription(char const* label, bool isTracked);
AllowedLabelsDescription(std::string const& label, ParameterSetDescription const& value, bool isTracked);
AllowedLabelsDescription(char const* label, ParameterSetDescription const& value, bool isTracked);
~AllowedLabelsDescription() override;
ParameterDescriptionNode* clone() const override;
private:
void printNestedContent_(std::ostream& os, bool optional, DocFormatHelper& helper) const override;
void validateAllowedLabel_(std::string const& allowedLabel,
ParameterSet& pset,
std::set<std::string>& validatedLabels) const override;
value_ptr<ParameterSetDescription> psetDesc_;
};
template <>
class AllowedLabelsDescription<std::vector<ParameterSet> > : public AllowedLabelsDescriptionBase {
public:
AllowedLabelsDescription(std::string const& label, bool isTracked);
AllowedLabelsDescription(char const* label, bool isTracked);
AllowedLabelsDescription(std::string const& label, ParameterSetDescription const& value, bool isTracked);
AllowedLabelsDescription(char const* label, ParameterSetDescription const& value, bool isTracked);
~AllowedLabelsDescription() override;
ParameterDescriptionNode* clone() const override;
private:
void printNestedContent_(std::ostream& os, bool optional, DocFormatHelper& helper) const override;
void validateAllowedLabel_(std::string const& allowedLabel,
ParameterSet& pset,
std::set<std::string>& validatedLabels) const override;
value_ptr<ParameterSetDescription> psetDesc_;
};
} // namespace edm
#endif
|