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 // ============================================================
6 // AssemblyHashTraits.hpp
11 // Defines the AssemblyHashTraits template class
13 // ============================================================
15 #ifndef __BINDER__ASSEMBLY_HASH_TRAITS_HPP__
16 #define __BINDER__ASSEMBLY_HASH_TRAITS_HPP__
18 #include "bindertypes.hpp"
19 #include "assemblyentry.hpp"
22 namespace BINDER_SPACE
24 template<typename HashEntry, DWORD dwAssemblyNameFlags>
25 class AssemblyHashTraits : public NoRemoveSHashTraits<DefaultSHashTraits<HashEntry> >
28 typedef typename NoRemoveSHashTraits<DefaultSHashTraits<HashEntry> >::element_t element_t;
29 typedef typename NoRemoveSHashTraits<DefaultSHashTraits<HashEntry> >::count_t count_t;
31 typedef AssemblyName* key_t;
33 // GetKey, Equals and Hash can throw due to SString
34 static const bool s_NoThrow = false;
36 static key_t GetKey(element_t pAssemblyEntry)
38 return pAssemblyEntry->GetAssemblyName();
40 static BOOL Equals(key_t pAssemblyName1, key_t pAssemblyName2)
42 return pAssemblyName1->Equals(pAssemblyName2, dwAssemblyNameFlags);
44 static count_t Hash(key_t pAssemblyName)
46 return pAssemblyName->Hash(dwAssemblyNameFlags);
48 static element_t Null()
52 static bool IsNull(const element_t &assemblyEntry)
54 return (assemblyEntry == NULL);