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 // $Id: Service.h,v 1.2 2005/09/12 19:09:56 chrjones Exp $
20 //
21 
22 // system include files
23 
24 // user include files
26 
27 // forward declarations
28 
29 namespace edm {
30  template<class T>
31  class Service
32 {
33 
34  public:
35  Service() {}
36  //virtual ~Service();
37 
38  // ---------- const member functions ---------------------
39  T* operator->() const {
40  return &(ServiceRegistry::instance().template get<T>());
41  }
42 
43  T& operator*() const {
44  return ServiceRegistry::instance().template get<T>();
45  }
46 
47  bool isAvailable() const {
48  return ServiceRegistry::instance().template isAvailable<T>();
49  }
50 
51  operator bool() const {
52  return isAvailable();
53  }
54 
55  // ---------- static member functions --------------------
56 
57  // ---------- member functions ---------------------------
58 
59  private:
60 };
61 
62 }
63 
64 #endif
T & operator*() const
Definition: Service.h:43
bool isAvailable() const
Definition: Service.h:47
static ServiceRegistry & instance()
long double T
T * operator->() const
Definition: Service.h:39