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