1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 // ============================================================
11 // Defines the FailureCache class
13 // ============================================================
15 #ifndef __BINDER__FAILURE_CACHE_HASH_TRAITS_HPP__
16 #define __BINDER__FAILURE_CACHE_HASH_TRAITS_HPP__
18 #include "bindertypes.hpp"
23 namespace BINDER_SPACE
25 class FailureCacheEntry
28 inline FailureCacheEntry()
30 m_hrBindingResult = S_OK;
32 inline ~FailureCacheEntry()
38 inline SString &GetAssemblyNameOrPath()
40 return m_assemblyNameOrPath;
42 inline HRESULT GetBindingResult()
44 return m_hrBindingResult;
46 inline void SetBindingResult(HRESULT hrBindingResult)
48 m_hrBindingResult = hrBindingResult;
52 SString m_assemblyNameOrPath;
53 HRESULT m_hrBindingResult;
56 class FailureCacheHashTraits : public DefaultSHashTraits<FailureCacheEntry *>
59 typedef SString& key_t;
61 // GetKey, Equals, and Hash can throw due to SString
62 static const bool s_NoThrow = false;
64 static key_t GetKey(element_t pFailureCacheEntry)
66 return pFailureCacheEntry->GetAssemblyNameOrPath();
68 static BOOL Equals(key_t pAssemblyNameOrPath1, key_t pAssemblyNameOrPath2)
70 return EqualsCaseInsensitive(pAssemblyNameOrPath1, pAssemblyNameOrPath2);
72 static count_t Hash(key_t pAssemblyNameOrPath)
74 return HashCaseInsensitive(pAssemblyNameOrPath);
76 static const element_t Null()
80 static bool IsNull(const element_t &propertyEntry)
82 return (propertyEntry == NULL);