diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-08-03 17:10:46 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-03 17:10:46 -0400 |
| commit | e43ef82e288afe486f45ef2736d378e88f40cc90 (patch) | |
| tree | 356841a992263d6a5d03e9d6704868c2cc12190c /source/core/slang-destroyable.h | |
| parent | e81a5fe56f3177fc3c7040e2320ae083e3746eb7 (diff) | |
Improvements around Artifact (#2346)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP with hierarchical enums.
* Some small fixes and improvements around artifact desc related types.
* Improvements around hierarchical enum.
* Fixes to get Artifact types refactor to be able to execute tests.
* Attempt to better categorize PTX.
* Work around for potentially unused function warning.
* Typo fix.
* Simplify Artifact header.
* Small improvements around Artifact kind/payload/style.
* Added IDestroyable/ICastable
* Add IArtifactList.
* First impl of IArtifactUtil.
* Use the ICastable interface for IArtifactRepresentation.
* Added IArtifactRepresentation & IArtifactAssociated.
* Add SLANG_OVERRIDE to avoid gcc/clang warning.
* Fix calling convention issue on win32.
* Fix missing SLANG_OVERRIDE.
Diffstat (limited to 'source/core/slang-destroyable.h')
| -rw-r--r-- | source/core/slang-destroyable.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source/core/slang-destroyable.h b/source/core/slang-destroyable.h new file mode 100644 index 000000000..4e6be2629 --- /dev/null +++ b/source/core/slang-destroyable.h @@ -0,0 +1,41 @@ +#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 to provide a mechanism to cast, that doesn't require ref counting +and doesn't have to return a pointer to a ISlangUnknown derived class */ +class ICastable : public ISlangUnknown +{ + SLANG_COM_INTERFACE(0x87ede0e1, 0x4852, 0x44b0, { 0x8b, 0xf2, 0xcb, 0x31, 0x87, 0x4d, 0xe2, 0x39 } ); + + /// Can be used to cast to interfaces without reference counting. + /// Also provides access to internal implementations, when they provide a guid + /// Can simulate a 'generated' interface as long as kept in scope by cast from. + virtual SLANG_NO_THROW void* SLANG_MCALL castAs(const Guid& guid) = 0; +}; + +/* 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; +}; + +} + +#endif // SLANG_CORE_DESTROYABLE_H |
