[in] Value to check.
CCacheEntry<T>::ContainsValue
Indicates if the specified entry is in the cache and is valid.
Syntax
Section titled “Syntax”bool CCacheEntry<T>::ContainsValue(T value, const CString& strModel);Parameters
Section titled “Parameters”value
strModel
[in] The current instrument model.
Return value
Section titled “Return value”Returns true if the specified value is in the cache and is valid, otherwise false.
Example
Section titled “Example”The following example demonstrates use of the ContainsValue function.
STDMETHODIMP Acme4321::put_Bandwidth(double Bandwidth){ 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, simply return since we don't need to send the instrument command if (pEntry->ContainsValue(Bandwidth, GetModel())) return S_OK;
// If we get this far, then the new value is not in the cache, so we // must communicate with the instrument to set the value HRESULT hr = io.Printf(_T("SENSE:BAND %.15g"), Bandwidth);
if (SUCCEEDED(hr)) { // The new value was successfully sent to the instrument, so update the cache pEntry->UpdateValue(Bandwidth); }
return hr;}