Sauce-0.10.1 A C++ Dependency Injection Framework

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
sauce::internal::ScopeCache Class Reference

## Public Member Functions
template<typename Dependency >
void | put (typename Key< Dependency >::Ptr pointer)
| Insert a dependency into the cache.
template<typename Dependency >
bool | get (typename Key< Dependency >::Ptr &out) const
| Probe the cache for a dependency. More...

## Member Function Documentation

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 {
67 typedef typename Key<Dependency>::Normalized Normalized;
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 }
sauce::internal::Key< Dependency >::Normalized
Named< Dependency, Unnamed > Normalized
Note Normalized is not Iface, but Named.
Definition: key.h:27

The documentation for this class was generated from the following file:

- sauce/internal/scope_cache.h