test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::auto_ptr< T > iService)
 create a service token that holds the service defined by iService More...
 
template<typename T >
static ServiceToken createContaining (std::auto_ptr< T > iService, ServiceToken iToken, serviceregistry::ServiceLegacy iLegacy)
 
template<typename T >
static ServiceToken createContaining (boost::shared_ptr< serviceregistry::ServiceWrapper< T > > iWrapper)
 create a service token that holds the service held by iWrapper More...
 
template<typename T >
static ServiceToken createContaining (boost::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 &)
 
 ServiceRegistry ()
 
 ServiceRegistry (ServiceRegistry const &)
 
ServiceToken setContext (ServiceToken const &iNewToken)
 
void unsetContext (ServiceToken const &iOldToken)
 

Private Attributes

boost::shared_ptr
< serviceregistry::ServicesManager
manager_
 

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 &  )
private

Member Function Documentation

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

create a service token that holds the service defined by iService

Definition at line 100 of file ServiceRegistry.h.

References HDQMDatabaseProducer::config, and wrapper.

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

100  {
101  std::vector<edm::ParameterSet> config;
102  boost::shared_ptr<serviceregistry::ServicesManager> manager(new serviceregistry::ServicesManager(config));
103  boost::shared_ptr<serviceregistry::ServiceWrapper<T> >
104  wrapper(new serviceregistry::ServiceWrapper<T>(iService));
105  manager->put(wrapper);
106  return manager;
107  }
static HepMC::HEPEVT_Wrapper wrapper
template<typename T >
static ServiceToken edm::ServiceRegistry::createContaining ( std::auto_ptr< T iService,
ServiceToken  iToken,
serviceregistry::ServiceLegacy  iLegacy 
)
inlinestatic

Definition at line 109 of file ServiceRegistry.h.

References HDQMDatabaseProducer::config, and wrapper.

111  {
112  std::vector<edm::ParameterSet> config;
113  boost::shared_ptr<serviceregistry::ServicesManager> manager(new serviceregistry::ServicesManager(iToken,
114  iLegacy,
115  config));
116  boost::shared_ptr<serviceregistry::ServiceWrapper<T> >
117  wrapper(new serviceregistry::ServiceWrapper<T>(iService));
118  manager->put(wrapper);
119  return manager;
120  }
static HepMC::HEPEVT_Wrapper wrapper
template<typename T >
static ServiceToken edm::ServiceRegistry::createContaining ( boost::shared_ptr< serviceregistry::ServiceWrapper< T > >  iWrapper)
inlinestatic

create a service token that holds the service held by iWrapper

Definition at line 123 of file ServiceRegistry.h.

References HDQMDatabaseProducer::config.

123  {
124  std::vector<edm::ParameterSet> config;
125  boost::shared_ptr<serviceregistry::ServicesManager> manager(new serviceregistry::ServicesManager(config));
126  manager->put(iWrapper);
127  return manager;
128  }
template<typename T >
static ServiceToken edm::ServiceRegistry::createContaining ( boost::shared_ptr< serviceregistry::ServiceWrapper< T > >  iWrapper,
ServiceToken  iToken,
serviceregistry::ServiceLegacy  iLegacy 
)
inlinestatic

Definition at line 130 of file ServiceRegistry.h.

References HDQMDatabaseProducer::config.

132  {
133  std::vector<edm::ParameterSet> config;
134  boost::shared_ptr<serviceregistry::ServicesManager> manager(new serviceregistry::ServicesManager(iToken,
135  iLegacy,
136  config));
137  manager->put(iWrapper);
138  return manager;
139  }
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  boost::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  }
static ServiceToken createSet(std::vector< ParameterSet > &)
void makeParameterSets(std::string const &configtext, boost::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(), cond::FWIncantation::FWIncantation(), edm::ScheduleItems::initServices(), and cond::Utilities::run().

90  {
91  using namespace serviceregistry;
92  boost::shared_ptr<ServicesManager> returnValue(new 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  boost::shared_ptr<ServicesManager> returnValue(new ServicesManager(iToken, iLegacy, iPS, associate));
103  return ServiceToken(returnValue);
104  }
template<typename T >
T& edm::ServiceRegistry::get ( void  ) const
inline

Definition at line 63 of file ServiceRegistry.h.

References manager_, 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(), rrapi.RRApi::report(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), and rrapi.RRApi::workspaces().

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

Definition at line 73 of file ServiceRegistry.h.

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

73  {
74  if(0 == manager_.get()) {
76  "Service"
77  " no ServiceRegistry has been set for this thread");
78  }
79  return manager_-> template isAvailable<T>();
80  }
boost::shared_ptr< serviceregistry::ServicesManager > manager_
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
ServiceRegistry const& edm::ServiceRegistry::operator= ( ServiceRegistry const &  )
private
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 evf::EvFBuildingThrottle::start().

71  {
72  return manager_;
73  }
boost::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  }
boost::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  }
boost::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 }
EventID const & min(EventID const &lh, EventID const &rh)
Definition: EventID.h:132
tuple argc
Definition: dir2webdir.py:38
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
tuple size
Write out results.
EventID const & max(EventID const &lh, EventID const &rh)
Definition: EventID.h:137
friend class Operate
friend

Definition at line 57 of file ServiceRegistry.h.

Member Data Documentation

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

Definition at line 152 of file ServiceRegistry.h.

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