CMS 3D CMS Logo

ServiceRegistry.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: ServiceRegistry
4 // Class : ServiceRegistry
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Mon Sep 5 13:33:19 EDT 2005
11 //
12 
13 // user include files
15 
16 // system include files
17 
18 namespace edm {
19  //
20  // constants, enums and typedefs
21  //
22 
23  //
24  // static data member definitions
25  //
26 
27  //
28  // constructors and destructor
29  //
31 
32  // ServiceRegistry::ServiceRegistry(ServiceRegistry const& rhs) {
33  // // do actual copying here;
34  // }
35 
37 
38  //
39  // assignment operators
40  //
41  // ServiceRegistry const& ServiceRegistry::operator=(ServiceRegistry const& rhs) {
42  // //An exception safe implementation is
43  // ServiceRegistry temp(rhs);
44  // swap(rhs);
45  //
46  // return *this;
47  // }
48 
49  //
50  // member functions
51  //
53  ServiceToken returnValue(manager_);
54  manager_ = iNewToken.manager_;
55  return returnValue;
56  }
57 
58  void ServiceRegistry::unsetContext(ServiceToken const& iOldToken) { manager_ = iOldToken.manager_; }
59 
60  //
61  // const member functions
62  //
64 
65  //
66  // static member functions
67  //
68 
69  ServiceToken ServiceRegistry::createServicesFromConfig(std::unique_ptr<ParameterSet> params) {
70  auto serviceSets = params->popVParameterSet(std::string("services"));
71  //create the services
72  return ServiceToken(ServiceRegistry::createSet(serviceSets));
73  }
74 
75  ServiceToken ServiceRegistry::createSet(std::vector<ParameterSet>& iPS) {
76  using namespace serviceregistry;
77  auto returnValue = std::make_shared<ServicesManager>(iPS);
78  return ServiceToken(returnValue);
79  }
80 
81  ServiceToken ServiceRegistry::createSet(std::vector<ParameterSet>& iPS,
82  ServiceToken iToken,
84  bool associate) {
85  using namespace serviceregistry;
86  auto returnValue = std::make_shared<ServicesManager>(iToken, iLegacy, iPS, associate);
87  return ServiceToken(returnValue);
88  }
89 
91  static thread_local ServiceRegistry s_registry;
92  return s_registry;
93  }
94 } // namespace edm
ServiceToken setContext(ServiceToken const &iNewToken)
static ServiceToken createServicesFromConfig(std::unique_ptr< ParameterSet > params)
ServiceToken presentToken() const
void unsetContext(ServiceToken const &iOldToken)
static ServiceRegistry & instance()
static ServiceToken createSet(std::vector< ParameterSet > &)
std::shared_ptr< edm::serviceregistry::ServicesManager > manager_
Definition: ServiceToken.h:75
HLT enums.
std::shared_ptr< serviceregistry::ServicesManager > manager_