CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 {
32 
33  public:
34  Service() {}
35  //virtual ~Service();
36 
37  // ---------- const member functions ---------------------
38  T* operator->() const {
39  return &(ServiceRegistry::instance().template get<T>());
40  }
41 
42  T& operator*() const {
43  return ServiceRegistry::instance().template get<T>();
44  }
45 
46  bool isAvailable() const {
47  return ServiceRegistry::instance().template isAvailable<T>();
48  }
49 
50  operator bool() const {
51  return isAvailable();
52  }
53 
54  // ---------- static member functions --------------------
55 
56  // ---------- member functions ---------------------------
57 
58  private:
59 };
60 
61 }
62 
63 #endif
T & operator*() const
Definition: Service.h:42
bool isAvailable() const
Definition: Service.h:46
static ServiceRegistry & instance()
long double T
T * operator->() const
Definition: Service.h:38