CMS 3D CMS Logo

ProcessDesc.cc
Go to the documentation of this file.
4 
5 namespace edm {
6 
7  ProcessDesc::ProcessDesc(std::shared_ptr<ParameterSet> pset) :
8  pset_(pset), services_(pset_->popVParameterSet(std::string("services"))) {
9  }
10 
11  ProcessDesc::ProcessDesc(std::unique_ptr<ParameterSet> pset) :
12  pset_(std::move(pset)), services_(pset_->popVParameterSet(std::string("services"))) {
13  }
14 
16  pset_(new ParameterSet),
17  services_{} {
18  throw Exception(errors::Configuration,"Old config strings no longer accepted");
19  }
20 
22  }
23 
25  // The standard services should be initialized first.
26  services_.insert(services_.begin(), pset);
27  }
28 
30  ParameterSet newpset;
31  newpset.addParameter<std::string>("@service_type", service);
32  addService(newpset);
33  }
34 
36  for(auto it = services_.begin(), itEnd = services_.end(); it != itEnd; ++it) {
37  std::string name = it->getParameter<std::string>("@service_type");
38  if (name == service) {
39  // Use the configured service. Don't add a default.
40  // However, the service needs to be moved to the front because it is a standard service.
41  ParameterSet pset = *it;
42  services_.erase(it);
43  addService(pset);
44  return;
45  }
46  }
47  addService(service);
48  }
49 
51  for(auto it = services_.begin(), itEnd = services_.end(); it != itEnd; ++it) {
52  std::string name = it->getParameter<std::string>("@service_type");
53  if (name == service) {
54  // Remove the configured service before adding the default.
55  services_.erase(it);
56  break;
57  }
58  }
59  addService(service);
60  }
61 
62  void ProcessDesc::addServices(std::vector<std::string> const& defaultServices,
63  std::vector<std::string> const& forcedServices) {
64  // Add the default services to services_.
65  for(auto const& service: defaultServices) {
67  }
68  // Add the forced services to services_.
69  for(auto const& service : forcedServices) {
71  }
72  }
73 
75  std::string out = pset_->dump();
76  for (auto const& service : services_) {
77  out += service.dump();
78  }
79  return out;
80  }
81 } // namespace edm
void addDefaultService(std::string const &service)
add a service if it&#39;s not already there
Definition: ProcessDesc.cc:35
edm::propagate_const< std::shared_ptr< ParameterSet > > pset_
Definition: ProcessDesc.h:46
void addServices(std::vector< std::string > const &defaultServices, std::vector< std::string > const &forcedServices=std::vector< std::string >())
add some default services and forced services
Definition: ProcessDesc.cc:62
void addService(ParameterSet &pset)
Definition: ProcessDesc.cc:24
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:143
void addForcedService(std::string const &service)
add a service and replace it if it&#39;s already there
Definition: ProcessDesc.cc:50
HLT enums.
std::string dump() const
Definition: ProcessDesc.cc:74
ProcessDesc(std::shared_ptr< ParameterSet > pset)
Definition: ProcessDesc.cc:7
std::vector< ParameterSet > services_
Definition: ProcessDesc.h:47
def move(src, dest)
Definition: eostools.py:511