From 20ea33f3321738e7c1b4cad7bdcaedcdb54dd0f0 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 11 Apr 2023 10:18:18 -0400 Subject: Artifact simplification (#2781) * #include an absolute path didn't work - because paths were taken to always be relative. * WIP simplifying artifact interface. * Use ContainedKind. * Remove LazyCastableList. Use ContainedKind for find. * Remove ICastableList. * Remove need for ICastableList. * Remove IArtifactContainer. * Small fixes. * Small improvements around Artifact. * Make explicit find is for *representations* that can cast. Fix bug in handling casting in lookup. * Made associated items artifacts too. * Small fixes. * Small improvements around writing a container. --- source/core/slang-castable-util.h | 58 --------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 source/core/slang-castable-util.h (limited to 'source/core/slang-castable-util.h') diff --git a/source/core/slang-castable-util.h b/source/core/slang-castable-util.h deleted file mode 100644 index 4d3c3900c..000000000 --- a/source/core/slang-castable-util.h +++ /dev/null @@ -1,58 +0,0 @@ -// slang-castable-util.h -#ifndef SLANG_CASTABLE_UTIL_H -#define SLANG_CASTABLE_UTIL_H - -#include "slang-castable-list.h" - -#include "../../slang-com-helper.h" -#include "../../slang-com-ptr.h" - -#include "../core/slang-com-object.h" - -namespace Slang -{ - -/* An adapter such that types which aren't derived from ICastable, can be used as such. - -With the following caveats. -* the interfaces/objects of the adapter are checked *first*, so IUnknown will always be for the adapter -* assumes when doing a queryInterface on the contained item, it will remain in scope when released (this is *not* strict COM) -*/ -class UnknownCastableAdapter : public ComBaseObject, public IUnknownCastableAdapter -{ -public: - SLANG_COM_BASE_IUNKNOWN_ALL - - // ICastable - SLANG_NO_THROW void* SLANG_MCALL castAs(const Guid& guid) SLANG_OVERRIDE; - - // IUnknownCastableAdapter - virtual SLANG_NO_THROW ISlangUnknown* SLANG_MCALL getContained() SLANG_OVERRIDE { return m_contained; } - - UnknownCastableAdapter(ISlangUnknown* unk): - m_contained(unk) - { - SLANG_ASSERT(unk); - } - -protected: - void* getInterface(const Guid& guid); - void* getObject(const Guid& guid); - - ComPtr m_contained; - - // We hold a cache for a single lookup to make things a little faster - void* m_found = nullptr; - Guid m_foundGuid; -}; - -struct CastableUtil -{ - /// Given an ISlangUnkown return as a castable interface. - /// Can use UnknownCastableAdapter if can't queryInterface unk to ICastable - static ComPtr getCastable(ISlangUnknown* unk); -}; - -} // namespace Slang - -#endif -- cgit v1.2.3