File indexing completed on 2024-04-06 12:13:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
0015
0016
0017
0018 namespace edm {
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 ServiceRegistry::ServiceRegistry() {}
0031
0032
0033
0034
0035
0036 ServiceRegistry::~ServiceRegistry() {}
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 ServiceToken ServiceRegistry::setContext(ServiceToken const& iNewToken) {
0053 ServiceToken returnValue(manager_);
0054 manager_ = iNewToken.manager_;
0055 return returnValue;
0056 }
0057
0058 void ServiceRegistry::unsetContext(ServiceToken const& iOldToken) { manager_ = iOldToken.manager_; }
0059
0060
0061
0062
0063 ServiceToken ServiceRegistry::presentToken() const { return manager_; }
0064
0065
0066
0067
0068
0069 ServiceToken ServiceRegistry::createServicesFromConfig(std::unique_ptr<ParameterSet> params) {
0070 auto serviceSets = params->popVParameterSet(std::string("services"));
0071
0072 return ServiceToken(ServiceRegistry::createSet(serviceSets));
0073 }
0074
0075 ServiceToken ServiceRegistry::createSet(std::vector<ParameterSet>& iPS) {
0076 using namespace serviceregistry;
0077 auto returnValue = std::make_shared<ServicesManager>(iPS);
0078 return ServiceToken(returnValue);
0079 }
0080
0081 ServiceToken ServiceRegistry::createSet(std::vector<ParameterSet>& iPS,
0082 ServiceToken iToken,
0083 serviceregistry::ServiceLegacy iLegacy,
0084 bool associate) {
0085 using namespace serviceregistry;
0086 auto returnValue = std::make_shared<ServicesManager>(iToken, iLegacy, iPS, associate);
0087 return ServiceToken(returnValue);
0088 }
0089
0090 ServiceRegistry& ServiceRegistry::instance() {
0091 static thread_local ServiceRegistry s_registry;
0092 return s_registry;
0093 }
0094 }