CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ProcessDesc.cc
Go to the documentation of this file.
1 
5 
6 namespace edm {
7 
8  ProcessDesc::ProcessDesc(std::shared_ptr<ParameterSet> pset) :
9  pset_(pset), services_(pset_->popVParameterSet(std::string("services")).release()) {
10  }
11 
13  pset_(new ParameterSet),
14  services_(new std::vector<ParameterSet>()) {
15  throw Exception(errors::Configuration,"Old config strings no longer accepted");
16  }
17 
19  }
20 
21  std::shared_ptr<ParameterSet>
23  return pset_;
24  }
25 
26  std::shared_ptr<std::vector<ParameterSet> >
28  return services_;
29  }
30 
32  // The standard services should be initialized first.
33  services_->insert(services_->begin(), pset);
34  }
35 
37  ParameterSet newpset;
38  newpset.addParameter<std::string>("@service_type", service);
39  addService(newpset);
40  }
41 
43  typedef std::vector<ParameterSet>::iterator Iter;
44  for(Iter it = services_->begin(), itEnd = services_->end(); it != itEnd; ++it) {
45  std::string name = it->getParameter<std::string>("@service_type");
46  if (name == service) {
47  // Use the configured service. Don't add a default.
48  // However, the service needs to be moved to the front because it is a standard service.
49  ParameterSet pset = *it;
50  services_->erase(it);
51  addService(pset);
52  return;
53  }
54  }
55  addService(service);
56  }
57 
59  typedef std::vector<ParameterSet>::iterator Iter;
60  for(Iter it = services_->begin(), itEnd = services_->end(); it != itEnd; ++it) {
61  std::string name = it->getParameter<std::string>("@service_type");
62  if (name == service) {
63  // Remove the configured service before adding the default.
64  services_->erase(it);
65  break;
66  }
67  }
68  addService(service);
69  }
70 
71  void ProcessDesc::addServices(std::vector<std::string> const& defaultServices,
72  std::vector<std::string> const& forcedServices) {
73  // Add the default services to services_.
74  for(std::vector<std::string>::const_iterator i = defaultServices.begin(), iEnd = defaultServices.end();
75  i != iEnd; ++i) {
77  }
78  // Add the forced services to services_.
79  for(std::vector<std::string>::const_iterator i = forcedServices.begin(), iEnd = forcedServices.end();
80  i != iEnd; ++i) {
82  }
83  }
84 
86  std::string out = pset_->dump();
87  for (std::vector<ParameterSet>::const_iterator it = services_->begin(), itEnd = services_->end(); it != itEnd; ++it) {
88  out += it->dump();
89  }
90  return out;
91  }
92 } // namespace edm
int i
Definition: DBlmapReader.cc:9
std::shared_ptr< std::vector< ParameterSet > > getServicesPSets() const
get the descriptions of the services
Definition: ProcessDesc.cc:27
void addDefaultService(std::string const &service)
add a service if it&#39;s not already there
Definition: ProcessDesc.cc:42
std::shared_ptr< ParameterSet > pset_
Definition: ProcessDesc.h:41
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:71
void addService(ParameterSet &pset)
Definition: ProcessDesc.cc:31
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:142
void addForcedService(std::string const &service)
add a service and replace it if it&#39;s already there
Definition: ProcessDesc.cc:58
std::shared_ptr< ParameterSet > getProcessPSet() const
get the parameter set
Definition: ProcessDesc.cc:22
tuple out
Definition: dbtoconf.py:99
std::string dump() const
Definition: ProcessDesc.cc:85
ProcessDesc(std::shared_ptr< ParameterSet > pset)
Definition: ProcessDesc.cc:8
std::shared_ptr< std::vector< ParameterSet > > services_
Definition: ProcessDesc.h:42