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-destroyable.h | 68 ----------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 source/core/slang-destroyable.h (limited to 'source/core/slang-destroyable.h') diff --git a/source/core/slang-destroyable.h b/source/core/slang-destroyable.h deleted file mode 100644 index f2c967071..000000000 --- a/source/core/slang-destroyable.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef SLANG_CORE_DESTROYABLE_H -#define SLANG_CORE_DESTROYABLE_H - -#include "slang-string.h" - -#include "../../slang-com-helper.h" -#include "../../slang-com-ptr.h" - -namespace Slang -{ - -/* An interface that allows for an object to implement 'destruction'. A destroyed -interface/object should release any other contained references. -Behavior of an interface that is IDestroyed should be defined on the interface. Typically -it will produce an assert on debug builds. -Calling destroy/isDestroyed can always be performed. */ -class IDestroyable : public ICastable -{ - SLANG_COM_INTERFACE(0x99c6228e, 0xa82, 0x43eb, { 0x8f, 0xd1, 0xf3, 0x54, 0x3e, 0x2e, 0x86, 0xc0 } ); - - /// Destroy. Can call on destroyed - is a no op. - virtual SLANG_NO_THROW void SLANG_MCALL destroy() = 0; - /// Once destroyed *no* functionality is supported other than IUnknown and destroy/isDestroyed - virtual SLANG_NO_THROW bool SLANG_MCALL isDestroyed() = 0; -}; - -// Dynamic cast of ICastable derived types -template -SLANG_FORCE_INLINE T* dynamicCast(ICastable* castable) -{ - if (castable) - { - void* obj = castable->castAs(T::getTypeGuid()); - return obj ? reinterpret_cast(obj) : ((T*)nullptr); - } - return nullptr; -} - -// as style cast -template -SLANG_FORCE_INLINE T* as(ICastable* castable) -{ - if (castable) - { - void* obj = castable->castAs(T::getTypeGuid()); - return obj ? reinterpret_cast(obj) : ((T*)nullptr); - } - return nullptr; -} - -// A way to clone an interface (that derives from IClonable) such that it returns an interface -// of the same type. -template -SLANG_FORCE_INLINE ComPtr cloneInterface(T* in) -{ - SLANG_ASSERT(in); - // Must be derivable from clonable - IClonable* clonable = in; - // We can clone with the same interface - T* clone = (T*)clonable->clone(T::getTypeGuid()); - // Clone must exist - SLANG_ASSERT(clone); - return ComPtr(clone); -} - -} - -#endif // SLANG_CORE_DESTROYABLE_H -- cgit v1.2.3