// ExclusiveHolder.tli // #pragma once #include "ExclusiveHolder.tlh" template ExclusiveHolder ::ExclusiveHolder () { m_pObject = NULL; } template ExclusiveHolder ::~ExclusiveHolder () { LockHolder Lock (this); delete m_pObject; } template ExclusiveHolder ::ExclusiveHolder (T * object) { m_pObject = object; } template void ExclusiveHolder ::Attach (T * object) { LockHolder Lock (this); delete m_pObject; m_pObject = object; } template T * ExclusiveHolder ::Detach () { LockHolder Lock (this); T * old = m_pObject; m_pObject = NULL; Release (); return old; } template void ExclusiveHolder ::Release () { LockHolder Lock (this); delete m_pObject; m_pObject = NULL; } template ExclusiveHolder & ExclusiveHolder ::operator = (T * object) { Attach (object); return *this; } template bool ExclusiveHolder ::IsEmpty () const { LockHolder Lock (this); return (m_pObject == NULL); }