diff options
Diffstat (limited to 'LibOVR/Src/Kernel/OVR_RefCount.h')
-rw-r--r-- | LibOVR/Src/Kernel/OVR_RefCount.h | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/LibOVR/Src/Kernel/OVR_RefCount.h b/LibOVR/Src/Kernel/OVR_RefCount.h index 8f2e3ad..775e24c 100644 --- a/LibOVR/Src/Kernel/OVR_RefCount.h +++ b/LibOVR/Src/Kernel/OVR_RefCount.h @@ -6,16 +6,16 @@ Content : Reference counting implementation headers Created : September 19, 2012 Notes : -Copyright : Copyright 2013 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. -Licensed under the Oculus VR SDK License Version 2.0 (the "License"); -you may not use the Oculus VR SDK except in compliance with the License, +Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License"); +you may not use the Oculus VR Rift SDK except in compliance with the License, which is provided at the time of installation or download, or which otherwise accompanies this software in either electronic or hard copy form. You may obtain a copy of the License at -http://www.oculusvr.com/licenses/LICENSE-2.0 +http://www.oculusvr.com/licenses/LICENSE-3.1 Unless required by applicable law or agreed to in writing, the Oculus VR SDK distributed under the License is distributed on an "AS IS" BASIS, @@ -62,7 +62,7 @@ class RefCountNTSImpl; class RefCountImplCore { protected: - volatile int RefCount; + volatile int RefCount; public: // RefCountImpl constructor always initializes RefCount to 1 by default. @@ -145,7 +145,7 @@ public: // RefCountVImpl provides Thread-Safe implementation of reference counting, plus, // virtual AddRef and Release. -class RefCountVImpl : public RefCountImplCore +class RefCountVImpl : virtual public RefCountImplCore { public: // Thread-Safe Ref-Count Implementation. @@ -194,6 +194,8 @@ public: // Redefine all new & delete operators. OVR_MEMORY_REDEFINE_NEW_IMPL(Base, OVR_REFCOUNTALLOC_CHECK_DELETE) +#undef OVR_REFCOUNTALLOC_CHECK_DELETE + #ifdef OVR_DEFINE_NEW #define new OVR_DEFINE_NEW #endif @@ -202,6 +204,35 @@ public: }; +template<class Base> +class RefCountBaseStatVImpl : virtual public Base +{ +public: + RefCountBaseStatVImpl() { } + + // *** Override New and Delete + + // DOM-IGNORE-BEGIN + // Undef new temporarily if it is being redefined +#ifdef OVR_DEFINE_NEW +#undef new +#endif + +#define OVR_REFCOUNTALLOC_CHECK_DELETE(class_name, p) + + // Redefine all new & delete operators. + OVR_MEMORY_REDEFINE_NEW_IMPL(Base, OVR_REFCOUNTALLOC_CHECK_DELETE) + +#undef OVR_REFCOUNTALLOC_CHECK_DELETE + +#ifdef OVR_DEFINE_NEW +#define new OVR_DEFINE_NEW +#endif + // OVR_BUILD_DEFINE_NEW + // DOM-IGNORE-END +}; + + //----------------------------------------------------------------------------------- // *** End user RefCountBase<> classes @@ -225,11 +256,11 @@ public: // RefCountBaseV is the same as RefCountBase but with virtual AddRef/Release template<class C> -class RefCountBaseV : public RefCountBaseStatImpl<RefCountVImpl> +class RefCountBaseV : virtual public RefCountBaseStatVImpl<RefCountVImpl> { public: // Constructor. - OVR_FORCE_INLINE RefCountBaseV() : RefCountBaseStatImpl<RefCountVImpl>() { } + OVR_FORCE_INLINE RefCountBaseV() : RefCountBaseStatVImpl<RefCountVImpl>() { } }; |