CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
16 
17 // system include files
18 
19 namespace edm {
20  //
21  // constants, enums and typedefs
22  //
23 
24  //
25  // static data member definitions
26  //
27 
28  //
29  // constructors and destructor
30  //
32  }
33 
34  // ServiceRegistry::ServiceRegistry(ServiceRegistry const& rhs) {
35  // // do actual copying here;
36  // }
37 
39  }
40 
41  //
42  // assignment operators
43  //
44  // ServiceRegistry const& ServiceRegistry::operator=(ServiceRegistry const& rhs) {
45  // //An exception safe implementation is
46  // ServiceRegistry temp(rhs);
47  // swap(rhs);
48  //
49  // return *this;
50  // }
51 
52  //
53  // member functions
54  //
57  ServiceToken returnValue(manager_);
58  manager_ = iNewToken.manager_;
59  return returnValue;
60  }
61 
62  void
64  manager_ = iOldToken.manager_;
65  }
66 
67  //
68  // const member functions
69  //
72  return manager_;
73  }
74 
75  //
76  // static member functions
77  //
78 
81  std::shared_ptr<ParameterSet> params;
82  makeParameterSets(config, params);
83 
84  std::auto_ptr<std::vector<ParameterSet> > serviceSets = params->popVParameterSet(std::string("services"));
85  //create the services
86  return ServiceToken(ServiceRegistry::createSet(*serviceSets));
87  }
88 
90  ServiceRegistry::createSet(std::vector<ParameterSet>& iPS) {
91  using namespace serviceregistry;
92  auto returnValue = std::make_shared<ServicesManager>(iPS);
93  return ServiceToken(returnValue);
94  }
95 
97  ServiceRegistry::createSet(std::vector<ParameterSet>& iPS,
98  ServiceToken iToken,
100  bool associate) {
101  using namespace serviceregistry;
102  auto returnValue = std::make_shared<ServicesManager>(iToken, iLegacy, iPS, associate);
103  return ServiceToken(returnValue);
104  }
105 
108  static thread_local ServiceRegistry s_registry;
109  return s_registry;
110  }
111 }
ServiceToken setContext(ServiceToken const &iNewToken)
ServiceToken presentToken() const
static ServiceToken createServicesFromConfig(std::string const &config)
void unsetContext(ServiceToken const &iOldToken)
static ServiceRegistry & instance()
static ServiceToken createSet(std::vector< ParameterSet > &)
std::shared_ptr< edm::serviceregistry::ServicesManager > manager_
Definition: ServiceToken.h:77
void makeParameterSets(std::string const &configtext, std::shared_ptr< ParameterSet > &main)
essentially the same as the previous method
std::shared_ptr< serviceregistry::ServicesManager > manager_