diff options
Diffstat (limited to 'src/binder/inc/assemblyhashtraits.hpp')
-rw-r--r-- | src/binder/inc/assemblyhashtraits.hpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/binder/inc/assemblyhashtraits.hpp b/src/binder/inc/assemblyhashtraits.hpp new file mode 100644 index 0000000000..285368f687 --- /dev/null +++ b/src/binder/inc/assemblyhashtraits.hpp @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// ============================================================ +// +// AssemblyHashTraits.hpp +// + + +// +// Defines the AssemblyHashTraits template class +// +// ============================================================ + +#ifndef __BINDER__ASSEMBLY_HASH_TRAITS_HPP__ +#define __BINDER__ASSEMBLY_HASH_TRAITS_HPP__ + +#include "bindertypes.hpp" +#include "assemblyentry.hpp" +#include "shash.h" + +namespace BINDER_SPACE +{ + template<typename HashEntry, DWORD dwAssemblyNameFlags> + class AssemblyHashTraits : public NoRemoveSHashTraits<DefaultSHashTraits<HashEntry> > + { + public: + typedef typename NoRemoveSHashTraits<DefaultSHashTraits<HashEntry> >::element_t element_t; + typedef typename NoRemoveSHashTraits<DefaultSHashTraits<HashEntry> >::count_t count_t; + + typedef AssemblyName* key_t; + + // GetKey, Equals and Hash can throw due to SString + static const bool s_NoThrow = false; + + static key_t GetKey(element_t pAssemblyEntry) + { + return pAssemblyEntry->GetAssemblyName(); + } + static BOOL Equals(key_t pAssemblyName1, key_t pAssemblyName2) + { + return pAssemblyName1->Equals(pAssemblyName2, dwAssemblyNameFlags); + } + static count_t Hash(key_t pAssemblyName) + { + return pAssemblyName->Hash(dwAssemblyNameFlags); + } + static const element_t Null() + { + return NULL; + } + static bool IsNull(const element_t &assemblyEntry) + { + return (assemblyEntry == NULL); + } + }; +}; + +#endif |