|
template<typename Dependency > |
void | put (typename Key< Dependency >::Ptr pointer) |
| Insert a dependency into the cache. More...
|
|
template<typename Dependency > |
bool | get (typename Key< Dependency >::Ptr &out) const |
| Probe the cache for a dependency. More...
|
|
◆ ScopeCache()
sauce::internal::ScopeCache::ScopeCache |
( |
| ) |
|
|
inline |
◆ get()
template<typename Dependency >
bool sauce::internal::ScopeCache::get |
( |
typename Key< Dependency >::Ptr & |
out | ) |
const |
|
inline |
Probe the cache for a dependency.
The return value indicates if a hit was found. On a hit, the out argument will be overwritten with the discovered value.
66 {
68 typedef typename Key<Normalized>::Ptr SmartPtr;
69
70 Cache::const_iterator cachedPtr = cache.find(typeIdOf<Normalized>());
71 if (cachedPtr == cache.end()) {
72 return false;
73 }
74
75 out = *static_cast<SmartPtr *>(cachedPtr->second.get());
76 return true;
77 }
Named< Dependency, Unnamed > Normalized
Note Normalized is not Iface, but Named<Iface, Unnamed>.
Definition: key.h:27
◆ put()
template<typename Dependency >
void sauce::internal::ScopeCache::put |
( |
typename Key< Dependency >::Ptr |
pointer | ) |
|
|
inline |
Insert a dependency into the cache.
34 {
36 typedef typename Key<Normalized>::Ptr SmartPtr;
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 CachedPtr cachedPtr(
53 static_cast<void *>(new SmartPtr(pointer)),
54 ScopeCacheLineDeleter<Normalized>());
55
56 cache.insert(std::make_pair(typeIdOf<Normalized>(), cachedPtr));
57 }
The documentation for this class was generated from the following file: