diff options
Diffstat (limited to 'intern/memutil/MEM_RefCounted.h')
-rw-r--r-- | intern/memutil/MEM_RefCounted.h | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/intern/memutil/MEM_RefCounted.h b/intern/memutil/MEM_RefCounted.h index 0dccf790caa..28b24d04586 100644 --- a/intern/memutil/MEM_RefCounted.h +++ b/intern/memutil/MEM_RefCounted.h @@ -34,71 +34,70 @@ * The default destructor of this object has been made protected on purpose. * This disables the creation of shared objects on the stack. * - * @author Maarten Gribnau - * @date March 31, 2001 + * @author Maarten Gribnau + * @date March 31, 2001 */ class MEM_RefCounted { -public: - /** - * Constructs a a shared object. - */ - MEM_RefCounted() : m_refCount(1) - { - } + public: + /** + * Constructs a a shared object. + */ + MEM_RefCounted() : m_refCount(1) + { + } - /** - * Returns the reference count of this object. - * @return the reference count. - */ - inline virtual int getRef() const; + /** + * Returns the reference count of this object. + * @return the reference count. + */ + inline virtual int getRef() const; - /** - * Increases the reference count of this object. - * @return the new reference count. - */ - inline virtual int incRef(); + /** + * Increases the reference count of this object. + * @return the new reference count. + */ + inline virtual int incRef(); - /** - * Decreases the reference count of this object. - * If the reference count reaches zero, the object self-destructs. - * @return the new reference count. - */ - inline virtual int decRef(); + /** + * Decreases the reference count of this object. + * If the reference count reaches zero, the object self-destructs. + * @return the new reference count. + */ + inline virtual int decRef(); -protected: - /** - * Destructs a shared object. - * The destructor is protected to force the use of incRef and decRef. - */ - virtual ~MEM_RefCounted() - { - } + protected: + /** + * Destructs a shared object. + * The destructor is protected to force the use of incRef and decRef. + */ + virtual ~MEM_RefCounted() + { + } -protected: - /// The reference count. - int m_refCount; + protected: + /// The reference count. + int m_refCount; }; - inline int MEM_RefCounted::getRef() const { - return m_refCount; + return m_refCount; } inline int MEM_RefCounted::incRef() { - return ++m_refCount; + return ++m_refCount; } inline int MEM_RefCounted::decRef() { - m_refCount--; - if (m_refCount == 0) { - delete this; - return 0; - } - return m_refCount; + m_refCount--; + if (m_refCount == 0) { + delete this; + return 0; + } + return m_refCount; } -#endif // __MEM_REFCOUNTED_H__ +#endif // __MEM_REFCOUNTED_H__ |