28 using namespace edm::serviceregistry;
38 registry_(&iRegistry),
46 wasAdded_ = maker_->make(*pset_, *
registry_, oManager);
47 if(wasAdded_ && maker_->saveConfiguration()) {
48 pset_->addUntrackedParameter(
"@save_config",
true);
71 std::vector<edm::ParameterSet>& iConfiguration):
72 associatedManager_(iToken.manager_),
78 typedef std::set< TypeIDBase> TypeSet;
83 configTypes.insert(itType->first);
92 tokenTypes.insert(itType->first);
95 typedef std::set<TypeIDBase> IntersectionType;
96 IntersectionType intersection;
97 std::set_intersection(configTypes.begin(), configTypes.end(),
98 tokenTypes.begin(), tokenTypes.end(),
99 inserter(intersection, intersection.end()));
103 if(!intersection.empty()) {
105 <<
"the Service "<<(*type2Maker_).find(*(intersection.begin()))->second.pset_->getParameter<std::string>(
"@service_type")
106 <<
" already has an instance of that type of Service";
117 for(IntersectionType::iterator itType = intersection.begin(), itTypeEnd = intersection.end();
120 Type2Maker::iterator itFound =
type2Maker_->find(*itType);
122 if(itFound->second.maker_->saveConfiguration()) {
123 itFound->second.pset_->addUntrackedParameter(
"@save_config",
true);
133 for(IntersectionType::iterator itType = intersection.begin(), itTypeEnd = intersection.end();
166 Type2Service::iterator itService =
type2Service_.find(*idIter);
172 itService->second.reset();
220 for(std::vector<edm::ParameterSet>::iterator itParam = iConfiguration.begin(),
221 itParamEnd = iConfiguration.end();
222 itParam != itParamEnd;
224 boost::shared_ptr<ServiceMakerBase>
base(
227 if(0 == base.get()) {
229 <<
"could not find a service named "
230 << itParam->getParameter<std::string>(
"@service_type")
231 <<
". Please check spelling.";
236 <<
" the service "<< itParam->getParameter<std::string>(
"@service_type")
237 <<
" provides the same service as "
238 << itFound->second.pset_->getParameter<std::string>(
"@service_type")
239 <<
"\n Please reconfigure job to only use one of these services.";
262 boost::shared_ptr<ServicesManager> shareThis(
this, NoOp());
277 Type2Maker::iterator itMaker =
type2Maker_->find(*idIter);
283 std::string serviceType = itMaker->second.pset_->getParameter<std::string>(
"@service_type");
284 std::auto_ptr<edm::ParameterSetDescriptionFillerBase> filler(
289 filler->fill(descriptions);
293 toThrow <<
"\nService plugin name is \"" << serviceType <<
"\"\n";
294 toThrow.
append(iException);
299 descriptions.validate(*(itMaker->second.pset_), serviceType);
303 toThrow <<
"\nService plugin name is \"" << serviceType <<
"\"\n";
304 toThrow.
append(iException);
310 itMaker->second.add(*
this);
314 toThrow<<itMaker->second.pset_->getParameter<std::string>(
"@service_type")<<
"\n";
315 toThrow.
append(iException);
Type2Service type2Service_
ServicesManager(std::vector< edm::ParameterSet > &iConfiguration)
void append(Exception const &another)
void copySlotsTo(ActivityRegistry &)
copy our Service's slots to the argument's signals
edm::ActivityRegistry registry_
void copySlotsFrom(ActivityRegistry &iOther)
Container::value_type value_type
std::auto_ptr< Type2Maker > type2Maker_
void fillListOfMakers(std::vector< edm::ParameterSet > &)
MakerHolder(boost::shared_ptr< ServiceMakerBase > iMaker, edm::ParameterSet &iPSet, edm::ActivityRegistry &)
std::vector< TypeIDBase > actualCreationOrder_
void connectTo(ActivityRegistry &iOther)
causes iOther's signals to be forward to us
std::map< TypeIDBase, MakerHolder > Type2Maker
boost::shared_ptr< ServicesManager > associatedManager_
bool add(ServicesManager &) const
void copySlotsFrom(ActivityRegistry &)
the copy the argument's slots to the our signals
std::vector< TypeIDBase > requestedCreationOrder_
void connect(ActivityRegistry &iOther)
causes our ActivityRegistry's signals to be forwarded to iOther
T get(const Candidate &c)
void connect(ActivityRegistry &iOther)
forwards our signals to slots connected to iOther