CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Service.h
Go to the documentation of this file.
1 #ifndef ServiceRegistry_Service_h
2 #define ServiceRegistry_Service_h
3 // -*- C++ -*-
4 //
5 // Package: ServiceRegistry
6 // Class : Service
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Wed Sep 7 15:17:17 EDT 2005
19 //
20 
21 // system include files
22 
23 // user include files
25 
26 // forward declarations
27 
28 namespace edm {
29  template <class T>
30  class Service {
31  public:
32  Service() {}
33  //virtual ~Service();
34 
35  // ---------- const member functions ---------------------
36  T* operator->() const { return &(ServiceRegistry::instance().template get<T>()); }
37 
38  T& operator*() const { return ServiceRegistry::instance().template get<T>(); }
39 
40  bool isAvailable() const { return ServiceRegistry::instance().template isAvailable<T>(); }
41 
42  operator bool() const { return isAvailable(); }
43 
44  // ---------- static member functions --------------------
45 
46  // ---------- member functions ---------------------------
47 
48  private:
49  };
50 
51 } // namespace edm
52 
53 #endif
T & operator*() const
Definition: Service.h:38
bool isAvailable() const
Definition: Service.h:40
static ServiceRegistry & instance()
long double T
T * operator->() const
Definition: Service.h:36