summaryrefslogtreecommitdiffstats
path: root/source/core/slang-com-object.h
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-10-29 14:49:26 +0800
committerGitHub <noreply@github.com>2024-10-29 14:49:26 +0800
commitf65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch)
treeea1d61342cd29368e19135000ec2948813096205 /source/core/slang-com-object.h
parenta729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff)
format
* format * Minor test fixes * enable checking cpp format in ci
Diffstat (limited to 'source/core/slang-com-object.h')
-rw-r--r--source/core/slang-com-object.h68
1 files changed, 41 insertions, 27 deletions
diff --git a/source/core/slang-com-object.h b/source/core/slang-com-object.h
index 617b7ccca..801af61a4 100644
--- a/source/core/slang-com-object.h
+++ b/source/core/slang-com-object.h
@@ -2,34 +2,35 @@
#define SLANG_COM_OBJECT_H
#include "slang-basic.h"
+
#include <atomic>
namespace Slang
{
-/// A base class for COM interfaces that require atomic ref counting
+/// A base class for COM interfaces that require atomic ref counting
/// and are *NOT* derived from RefObject
class ComBaseObject
{
public:
-
- /// If assigned the the ref count is *NOT* copied
+ /// If assigned the the ref count is *NOT* copied
ComBaseObject& operator=(const ComBaseObject&) { return *this; }
- /// Copy Ctor, does not copy ref count
- ComBaseObject(const ComBaseObject&) :
- m_refCount(0)
- {}
+ /// Copy Ctor, does not copy ref count
+ ComBaseObject(const ComBaseObject&)
+ : m_refCount(0)
+ {
+ }
- /// Default Ctor sets with no refs
+ /// Default Ctor sets with no refs
ComBaseObject()
: m_refCount(0)
- {}
+ {
+ }
- /// Dtor needs to be virtual to avoid needing to
- /// Implement release for all derived types.
- virtual ~ComBaseObject()
- {}
+ /// Dtor needs to be virtual to avoid needing to
+ /// Implement release for all derived types.
+ virtual ~ComBaseObject() {}
protected:
inline uint32_t _releaseImpl();
@@ -50,7 +51,7 @@ inline uint32_t ComBaseObject::_releaseImpl()
return count;
}
-#define SLANG_COM_BASE_IUNKNOWN_QUERY_INTERFACE \
+#define SLANG_COM_BASE_IUNKNOWN_QUERY_INTERFACE \
SLANG_NO_THROW SlangResult SLANG_MCALL queryInterface(SlangUUID const& uuid, void** outObject) \
SLANG_OVERRIDE \
{ \
@@ -63,10 +64,16 @@ inline uint32_t ComBaseObject::_releaseImpl()
} \
return SLANG_E_NO_INTERFACE; \
}
-#define SLANG_COM_BASE_IUNKNOWN_ADD_REF \
- SLANG_NO_THROW uint32_t SLANG_MCALL addRef() SLANG_OVERRIDE { return ++m_refCount; }
-#define SLANG_COM_BASE_IUNKNOWN_RELEASE \
- SLANG_NO_THROW uint32_t SLANG_MCALL release() SLANG_OVERRIDE { return _releaseImpl(); }
+#define SLANG_COM_BASE_IUNKNOWN_ADD_REF \
+ SLANG_NO_THROW uint32_t SLANG_MCALL addRef() SLANG_OVERRIDE \
+ { \
+ return ++m_refCount; \
+ }
+#define SLANG_COM_BASE_IUNKNOWN_RELEASE \
+ SLANG_NO_THROW uint32_t SLANG_MCALL release() SLANG_OVERRIDE \
+ { \
+ return _releaseImpl(); \
+ }
#define SLANG_COM_BASE_IUNKNOWN_ALL \
SLANG_COM_BASE_IUNKNOWN_QUERY_INTERFACE \
SLANG_COM_BASE_IUNKNOWN_ADD_REF \
@@ -82,11 +89,12 @@ protected:
public:
ComObject()
: comRefCount(0)
- {}
- ComObject(const ComObject& rhs) :
- RefObject(rhs),
- comRefCount(0)
- {}
+ {
+ }
+ ComObject(const ComObject& rhs)
+ : RefObject(rhs), comRefCount(0)
+ {
+ }
ComObject& operator=(const ComObject&) { return *this; }
@@ -125,10 +133,16 @@ public:
} \
return SLANG_E_NO_INTERFACE; \
}
-#define SLANG_COM_OBJECT_IUNKNOWN_ADD_REF \
- SLANG_NO_THROW uint32_t SLANG_MCALL addRef() SLANG_OVERRIDE { return addRefImpl(); }
-#define SLANG_COM_OBJECT_IUNKNOWN_RELEASE \
- SLANG_NO_THROW uint32_t SLANG_MCALL release() SLANG_OVERRIDE { return releaseImpl(); }
+#define SLANG_COM_OBJECT_IUNKNOWN_ADD_REF \
+ SLANG_NO_THROW uint32_t SLANG_MCALL addRef() SLANG_OVERRIDE \
+ { \
+ return addRefImpl(); \
+ }
+#define SLANG_COM_OBJECT_IUNKNOWN_RELEASE \
+ SLANG_NO_THROW uint32_t SLANG_MCALL release() SLANG_OVERRIDE \
+ { \
+ return releaseImpl(); \
+ }
#define SLANG_COM_OBJECT_IUNKNOWN_ALL \
SLANG_COM_OBJECT_IUNKNOWN_QUERY_INTERFACE \
SLANG_COM_OBJECT_IUNKNOWN_ADD_REF \