CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
edm::ServiceRegistry Class Reference

#include <ServiceRegistry.h>

Classes

class  Operate
 

Public Member Functions

template<typename T >
Tget () const
 
template<typename T >
bool isAvailable () const
 
ServiceToken presentToken () const
 
virtual ~ServiceRegistry ()
 

Static Public Member Functions

template<typename T >
static ServiceToken createContaining (std::unique_ptr< T > iService)
 create a service token that holds the service defined by iService More...
 
template<typename T >
static ServiceToken createContaining (std::unique_ptr< T > iService, ServiceToken iToken, serviceregistry::ServiceLegacy iLegacy)
 
template<typename T >
static ServiceToken createContaining (std::shared_ptr< serviceregistry::ServiceWrapper< T > > iWrapper)
 create a service token that holds the service held by iWrapper More...
 
template<typename T >
static ServiceToken createContaining (std::shared_ptr< serviceregistry::ServiceWrapper< T > > iWrapper, ServiceToken iToken, serviceregistry::ServiceLegacy iLegacy)
 
static ServiceToken createServicesFromConfig (std::string const &config)
 
static ServiceToken createSet (std::vector< ParameterSet > &)
 
static ServiceToken createSet (std::vector< ParameterSet > &, ServiceToken, serviceregistry::ServiceLegacy, bool associate=true)
 
static ServiceRegistryinstance ()
 

Private Member Functions

ServiceRegistry const & operator= (ServiceRegistry const &)=delete
 
 ServiceRegistry ()
 
 ServiceRegistry (ServiceRegistry const &)=delete
 
ServiceToken setContext (ServiceToken const &iNewToken)
 
void unsetContext (ServiceToken const &iOldToken)
 

Private Attributes

std::shared_ptr< serviceregistry::ServicesManagermanager_
 

Friends

class edm::FwkImpl
 
int main (int argc, char *argv[])
 
class Operate
 

Detailed Description

Definition at line 37 of file ServiceRegistry.h.

Constructor & Destructor Documentation

ServiceRegistry::~ServiceRegistry ( )
virtual

Definition at line 38 of file ServiceRegistry.cc.

38  {
39  }
ServiceRegistry::ServiceRegistry ( )
private

Definition at line 31 of file ServiceRegistry.cc.

31  {
32  }
edm::ServiceRegistry::ServiceRegistry ( ServiceRegistry const &  )
privatedelete

Member Function Documentation

template<typename T >
static ServiceToken edm::ServiceRegistry::createContaining ( std::unique_ptr< T iService)
inlinestatic

create a service token that holds the service defined by iService

Definition at line 100 of file ServiceRegistry.h.

References looper::config, eostools::move(), and wrapper.

Referenced by edm::ScheduleItems::addCPRandTNS(), main(), and topLevelPSet().

100  {
101  std::vector<edm::ParameterSet> config;
102  auto manager = std::make_shared<serviceregistry::ServicesManager>(config);
103  auto wrapper = std::make_shared<serviceregistry::ServiceWrapper<T> >(std::move(iService));
104  manager->put(wrapper);
105  return manager;
106  }
config
Definition: looper.py:287
def move(src, dest)
Definition: eostools.py:510
static HepMC::HEPEVT_Wrapper wrapper
template<typename T >
static ServiceToken edm::ServiceRegistry::createContaining ( std::unique_ptr< T iService,
ServiceToken  iToken,
serviceregistry::ServiceLegacy  iLegacy 
)
inlinestatic

Definition at line 108 of file ServiceRegistry.h.

References looper::config, eostools::move(), and wrapper.

110  {
111  std::vector<edm::ParameterSet> config;
112  auto manager = std::make_shared<serviceregistry::ServicesManager>(iToken, iLegacy, config);
113  auto wrapper = std::make_shared<serviceregistry::ServiceWrapper<T> >(std::move(iService));
114  manager->put(wrapper);
115  return manager;
116  }
config
Definition: looper.py:287
def move(src, dest)
Definition: eostools.py:510
static HepMC::HEPEVT_Wrapper wrapper
template<typename T >
static ServiceToken edm::ServiceRegistry::createContaining ( std::shared_ptr< serviceregistry::ServiceWrapper< T > >  iWrapper)
inlinestatic

create a service token that holds the service held by iWrapper

Definition at line 119 of file ServiceRegistry.h.

References looper::config.

119  {
120  std::vector<edm::ParameterSet> config;
121  auto manager = std::make_shared<serviceregistry::ServicesManager>(config);
122  manager->put(iWrapper);
123  return manager;
124  }
config
Definition: looper.py:287
template<typename T >
static ServiceToken edm::ServiceRegistry::createContaining ( std::shared_ptr< serviceregistry::ServiceWrapper< T > >  iWrapper,
ServiceToken  iToken,
serviceregistry::ServiceLegacy  iLegacy 
)
inlinestatic

Definition at line 126 of file ServiceRegistry.h.

References looper::config.

128  {
129  std::vector<edm::ParameterSet> config;
130  auto manager = std::make_shared<serviceregistry::ServicesManager>(iToken, iLegacy, config);
131  manager->put(iWrapper);
132  return manager;
133  }
config
Definition: looper.py:287
ServiceToken ServiceRegistry::createServicesFromConfig ( std::string const &  config)
static

Definition at line 80 of file ServiceRegistry.cc.

References createSet(), edm::makeParameterSets(), and AlCaHLTBitMon_QueryRunRegistry::string.

80  {
81  std::shared_ptr<ParameterSet> params;
82  makeParameterSets(config, params);
83 
84  auto serviceSets = params->popVParameterSet(std::string("services"));
85  //create the services
86  return ServiceToken(ServiceRegistry::createSet(serviceSets));
87  }
Definition: config.py:1
static ServiceToken createSet(std::vector< ParameterSet > &)
void makeParameterSets(std::string const &configtext, std::shared_ptr< ParameterSet > &main)
essentially the same as the previous method
ServiceToken ServiceRegistry::createSet ( std::vector< ParameterSet > &  iPS)
static

Definition at line 90 of file ServiceRegistry.cc.

Referenced by createServicesFromConfig(), edm::ScheduleItems::initServices(), cond::payloadInspector::PlotBase::process(), and cond::Utilities::run().

90  {
91  using namespace serviceregistry;
92  auto returnValue = std::make_shared<ServicesManager>(iPS);
93  return ServiceToken(returnValue);
94  }
ServiceToken ServiceRegistry::createSet ( std::vector< ParameterSet > &  iPS,
ServiceToken  iToken,
serviceregistry::ServiceLegacy  iLegacy,
bool  associate = true 
)
static

Definition at line 97 of file ServiceRegistry.cc.

100  {
101  using namespace serviceregistry;
102  auto returnValue = std::make_shared<ServicesManager>(iToken, iLegacy, iPS, associate);
103  return ServiceToken(returnValue);
104  }
template<typename T >
T& edm::ServiceRegistry::get ( ) const
inline

Definition at line 63 of file ServiceRegistry.h.

References edm::errors::NotFound, and edm::Exception::throwThis().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), rrapi.RRApi::columns(), rrapi.RRApi::count(), rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), edm::ScheduleItems::initSchedule(), rrapi.RRApi::report(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), and rrapi.RRApi::workspaces().

63  {
64  if(nullptr == manager_.get()) {
66  "Service"
67  " no ServiceRegistry has been set for this thread");
68  }
69  return manager_-> template get<T>();
70  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
std::shared_ptr< serviceregistry::ServicesManager > manager_
ServiceRegistry & ServiceRegistry::instance ( )
static
template<typename T >
bool edm::ServiceRegistry::isAvailable ( ) const
inline

Definition at line 73 of file ServiceRegistry.h.

References instance, edm::errors::NotFound, AlCaHLTBitMon_QueryRunRegistry::string, and edm::Exception::throwThis().

73  {
74  if(nullptr == manager_.get()) {
76  "Service"
77  " no ServiceRegistry has been set for this thread");
78  }
79  return manager_-> template isAvailable<T>();
80  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
std::shared_ptr< serviceregistry::ServicesManager > manager_
ServiceRegistry const& edm::ServiceRegistry::operator= ( ServiceRegistry const &  )
privatedelete
ServiceToken ServiceRegistry::presentToken ( ) const

The token can be passed to another thread in order to have the same services available in the other thread.

Definition at line 71 of file ServiceRegistry.cc.

References manager_.

Referenced by edm::Worker::doWork(), edm::WorkerManager::processOneOccurrence(), edm::ReducedProvenanceReader::ReducedProvenanceReader(), evf::EvFBuildingThrottle::start(), edm::OutputModuleCommunicatorT< T >::writeLumiAsync(), and edm::OutputModuleCommunicatorT< T >::writeRunAsync().

71  {
72  return manager_;
73  }
std::shared_ptr< serviceregistry::ServicesManager > manager_
ServiceToken ServiceRegistry::setContext ( ServiceToken const &  iNewToken)
private

Definition at line 56 of file ServiceRegistry.cc.

References edm::ServiceToken::manager_, and manager_.

56  {
57  ServiceToken returnValue(manager_);
58  manager_ = iNewToken.manager_;
59  return returnValue;
60  }
std::shared_ptr< serviceregistry::ServicesManager > manager_
void ServiceRegistry::unsetContext ( ServiceToken const &  iOldToken)
private

Definition at line 63 of file ServiceRegistry.cc.

References edm::ServiceToken::manager_, and manager_.

Referenced by edm::ServiceRegistry::Operate::~Operate().

63  {
64  manager_ = iOldToken.manager_;
65  }
std::shared_ptr< serviceregistry::ServicesManager > manager_

Friends And Related Function Documentation

friend class edm::FwkImpl
friend

Definition at line 55 of file ServiceRegistry.h.

int main ( int  argc,
char *  argv[] 
)
friend

CALO JETS


PF JETS

Definition at line 9 of file print_TrackerMap.cc.

9  {
10 
11  if(argc>=4) {
12 
13  int size=4500;
14  float min = 10.;
15  float max = -1.;
16  std::string logscale = "False";
17  std::string withpixel = "False";
18 
19  char* filename =argv[1];
20  char* title = argv[2];
21  char* outfile = argv[3];
22  std::cout << "ready to use file " << filename << " to create the map " << title << " and save it in " <<outfile << std::endl;
23 
24  if(argc>=5) {
25  size = atoi(argv[4]);
26  }
27  if(argc>=6) {
28  logscale = argv[5];
29  withpixel = argv[6];
30  }
31  if(argc>=9) {
32  min = atof(argv[7]);
33  max = atof(argv[8]);
34  }
35 
36  printTrackerMap(filename,title,outfile,size,logscale,withpixel,min,max);
37 
38  }
39  else { std::cout << "Wrong number of arguments: " << argc << std::endl; return -1; }
40 
41  return 0;
42 }
size
Write out results.
EventID const & min(EventID const &lh, EventID const &rh)
Definition: EventID.h:137
EventID const & max(EventID const &lh, EventID const &rh)
Definition: EventID.h:142
friend class Operate
friend

Definition at line 57 of file ServiceRegistry.h.

Member Data Documentation

std::shared_ptr<serviceregistry::ServicesManager> edm::ServiceRegistry::manager_
private

Definition at line 146 of file ServiceRegistry.h.

Referenced by presentToken(), setContext(), and unsetContext().