| 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 | // ============================================================ |
| 5 | // |
| 6 | // LoadContext.hpp |
| 7 | // |
| 8 | |
| 9 | |
| 10 | // |
| 11 | // Defines the LoadContext template class |
| 12 | // |
| 13 | // ============================================================ |
| 14 | |
| 15 | #ifndef __BINDER__LOAD_CONTEXT_HPP__ |
| 16 | #define __BINDER__LOAD_CONTEXT_HPP__ |
| 17 | |
| 18 | #include "assemblyhashtraits.hpp" |
| 19 | #include "contextentry.hpp" |
| 20 | #include "bindresult.hpp" |
| 21 | |
| 22 | namespace BINDER_SPACE |
| 23 | { |
| 24 | template <DWORD dwIncludeFlags> |
| 25 | class LoadContext : protected SHash<AssemblyHashTraits<ContextEntry *, dwIncludeFlags> > |
| 26 | { |
| 27 | private: |
| 28 | typedef SHash<AssemblyHashTraits<ContextEntry *, dwIncludeFlags> > Hash; |
| 29 | public: |
| 30 | LoadContext(); |
| 31 | ~LoadContext(); |
| 32 | |
| 33 | ULONG AddRef(); |
| 34 | ULONG Release(); |
| 35 | ContextEntry *Lookup(/* in */ AssemblyName *pAssemblyName); |
| 36 | HRESULT Register(BindResult *pBindResult); |
| 37 | |
| 38 | protected: |
| 39 | LONG m_cRef; |
| 40 | }; |
| 41 | |
| 42 | #include "loadcontext.inl" |
| 43 | |
| 44 | class InspectionContext : |
| 45 | public LoadContext<AssemblyName::INCLUDE_VERSION | AssemblyName::INCLUDE_ARCHITECTURE> {}; |
| 46 | class ExecutionContext : public LoadContext<AssemblyName::INCLUDE_DEFAULT> {}; |
| 47 | }; |
| 48 | |
| 49 | #endif |
| 50 |