Sauce-0.10.1
A C++ Dependency Injection Framework
key.h
1 #ifndef SAUCE_INTERNAL_KEY_H_
2 #define SAUCE_INTERNAL_KEY_H_
3 
4 #include <sauce/memory.h>
5 #include <sauce/named.h>
6 #include <sauce/internal/type_id.h>
7 
8 namespace sauce {
9 namespace internal {
10 
14 template<typename Iface_>
15 class Key {
16 public:
17  typedef Iface_ Iface;
18  typedef sauce::shared_ptr<Iface_> Ptr;
19  typedef Unnamed Name;
20 
28 };
29 
33 template<typename Iface_>
34 class Key<Iface_ &> {
35 public:
36  typedef typename Key<Iface_>::Iface Iface;
37  typedef typename Key<Iface_>::Ptr Ptr;
38  typedef typename Key<Iface_>::Name Name;
39  typedef typename Key<Iface_>::Normalized Normalized;
40 };
41 
45 template<typename Iface_>
46 class Key<sauce::shared_ptr<Iface_> > {
47 public:
48  typedef typename Key<Iface_>::Iface Iface;
49  typedef typename Key<Iface_>::Ptr Ptr;
50  typedef typename Key<Iface_>::Name Name;
51  typedef typename Key<Iface_>::Normalized Normalized;
52 };
53 
57 template<typename Iface_, typename Name_>
58 class Key<Named<Iface_, Name_> > {
59 public:
60  typedef Iface_ Iface;
61  typedef sauce::shared_ptr<Iface_> Ptr;
62  typedef Name_ Name;
64 };
65 
66 }
67 
68 namespace i = ::sauce::internal;
69 
70 }
71 
72 #endif // SAUCE_INTERNAL_KEY_H_
The name of all statically unnamed dependencies.
Definition: named.h:17
Definition: binder.h:317
Wrap dependency requests with Named to choose one of several (statically) named alternatives.
Definition: named.h:12
Named< Iface_, Unnamed > Normalized
Note Normalized is not Iface, but Named.
Definition: key.h:27
Definition: binder.h:21
A complete specification of a dependency request.
Definition: key.h:15