Click or drag to resize

CCacheEntry<T>::GetValue

Retrieves the value of a cache entry.

bool CCacheEntry<T>::GetValue(T* pValue) const;
Parameters
pValue

[out] Cached value. If the value is not valid, then the value of this parameter is undefined.

Return Value

Returns true if the value is in the cache and is valid, otherwise false.

Example

The following example demonstrates use of the GetValue function.

C++
// CoAcme4321.cpp
STDMETHODIMP Acme4321::get_Bandwidth(double* val)
{
  HRESULT hr = S_OK;

  // Retrieve the cache entry for the Bandwidth property
  CCacheEntry<double>* pEntry = GetOrCreateCacheEntry<double>(_T("IAcme4321.Bandwidth"));

  // If the value is in the cache AND is valid, retrieve the value and return
  if (pEntry->GetValue(val))
     return S_OK;

  // If we get this far, then the cached value is not valid, so we
  // must communicate with the instrument to retrieve the value
  hr = InstrQueryCommand(val);

  return hr;
}
See Also

Download a complete CHM version of this documentation here.