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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
#ifndef MessageLogger_MessageLoggerDefaults_h
#define MessageLogger_MessageLoggerDefaults_h
// -*- C++ -*-
//
// Package: MessageLogger
// Class : MessageLoggerDefaults
//
/**\class MessageLoggerDefaults MessageLoggerDefaults.h
Description: Structure holding defaults for MessageLogger service configuration
Usage:
#include "FWCore/Utilities/interface/JobMode.h"
edm::JobMode mode = somehowObtainJobMode();
MessageLoggerDefaults mlDefaults (mode);
...
PSet p;
std::string threshold =
p.getUntrackedParameter<std::string>("threshold", mlDefaults.threshold);
*/
//
// Original Author: M. Fischler
// Created: Tues Jun 14 10:38:19 CST 2007
//
// Framework include files
#include "FWCore/Utilities/interface/JobMode.h"
// system include files
#include <string>
#include <vector>
#include <map>
#include <cassert>
// Change log
//
// 6/15/07 mf Original version
//
// -------------------------------------------------------
// user include files
// ----------------
// Maintenance Tips
// ----------------
//
// When default values change for one job mode of operation or another,
// implement that change in the appropriate member function implemented
// in HardwiredDefaults.cc. For example, hardwireGridJobMode().
//
// When a new default is needed, add the item to the struct, and then place
// the default value into the appropriate sections of the various member
// functions in HardwiredDefaults.cc.
// It may be necessary to supply values of that default for each of the modes,
// even though the ErrorLogger default is suitable for all the modes but one.
//
// When the new default is of a type not already being accessed, also add
// the accessor method in this header, and implement it in
// MessageLoggerDefaults.cc following the pattern shown for existing items
namespace edm {
namespace service {
struct MessageLoggerDefaults {
public:
static const int NO_VALUE_SET = -45654;
struct Category {
std::string threshold;
int limit;
int reportEvery;
int timespan;
Category() : threshold(""), limit(NO_VALUE_SET), reportEvery(NO_VALUE_SET), timespan(NO_VALUE_SET) {}
};
struct Destination {
std::string threshold;
std::map<std::string, Category> category;
std::map<std::string, Category> sev;
std::string output;
};
// publicly available collections and structures
std::vector<std::string> categories;
std::vector<std::string> destinations;
std::vector<std::string> statistics;
std::map<std::string, Destination> destination;
// access to values set
std::string threshold(std::string const& dest) const;
std::string output(std::string const& dest) const;
int limit(std::string const& dest, std::string const& cat) const;
int reportEvery(std::string const& dest, std::string const& cat) const;
int timespan(std::string const& dest, std::string const& cat) const;
int sev_limit(std::string const& dest, std::string const& sev) const;
int sev_reportEvery(std::string const& dest, std::string const& sev) const;
int sev_timespan(std::string const& dest, std::string const& sev) const;
// Modes with hardwired defaults
void hardwireGridJobMode();
void hardwireReleaseValidationJobMode();
void hardwireAnalysisJobMode();
void hardwireNilJobMode();
static edm::JobMode mode(std::string const& jm);
// ctor
explicit MessageLoggerDefaults(edm::JobMode mode = GridJobMode) {
// mode-independent defaults
// mode-dependent defaults
switch (mode) {
// GridJobMode: Intended for automated batch-like processing, in which
// the output stream for cerr is routed to an apropro
// file. LogInfo messages are enabled, and at least
// one such message is delivered from the framework per
// event, so this mode is not suitable for many-Hz light
// event processing.
case GridJobMode:
hardwireGridJobMode();
break;
case ReleaseValidationJobMode:
hardwireReleaseValidationJobMode();
break;
case AnalysisJobMode:
hardwireAnalysisJobMode();
break;
case NilJobMode:
hardwireNilJobMode();
break;
default:
// this should never happen! No user error can get here.
bool Invalid_JobMode_in_ctor_of_MessageLoggerDefaults = false;
assert(Invalid_JobMode_in_ctor_of_MessageLoggerDefaults);
} // end of switch on mode
}
};
} // end of namespace service
} // end of namespace edm
#endif // MessageLogger_MessageLoggerDefaults_h
|