// EMERGENT GAME TECHNOLOGIES PROPRIETARY INFORMATION // // This software is supplied under the terms of a license agreement or // nondisclosure agreement with Emergent Game Technologies and may not // be copied or disclosed except in accordance with the terms of that // agreement. // // Copyright (c) 1996-2008 Emergent Game Technologies. // All Rights Reserved. // // Emergent Game Technologies, Chapel Hill, North Carolina 27517 // http://www.emergent.net //--------------------------------------------------------------------------- #include "NiUISignalSlotMacros.h" #include "NiUISignal.h" //--------------------------------------------------------------------------- inline NiUIBaseSlot0::NiUIBaseSlot0() { } //--------------------------------------------------------------------------- // All code in NiUIBaseSlot* methods are implemented in the macros defined in // NiUISignalSlotMacros.h. inline NiUIBaseSlot0::~NiUIBaseSlot0() { // Note: None of the pointers in any of these destructors is owned by // this instance: Therefore, it should not delete them NiUnsubscribeFromAll(m_pkSignals); } //--------------------------------------------------------------------------- inline void NiUIBaseSlot0::Subscribe(NiUISignal0* pkSignal) { NiSubscribeToMe(m_pkSignals, pkSignal); } //--------------------------------------------------------------------------- inline void NiUIBaseSlot0::Unsubscribe(NiUISignal0* pkSignal) { NiUnsubscribeToMe(m_pkSignals, pkSignal); } //--------------------------------------------------------------------------- inline bool NiUIBaseSlot0::IsSubscribed(NiUISignal0* pkSignal) const { return NiIsElementInGroup(m_pkSignals, pkSignal); } //--------------------------------------------------------------------------- inline unsigned int NiUIBaseSlot0::NumSubscribed() const { return NiNumElements(m_pkSignals); } //--------------------------------------------------------------------------- inline NiUIStaticSlot0::NiUIStaticSlot0() : NiUIBaseSlot0(), m_pfnCallback(NULL) { } //--------------------------------------------------------------------------- inline NiUIStaticSlot0::NiUIStaticSlot0(void (*pfnCallback)()) : NiUIBaseSlot0(), m_pfnCallback(pfnCallback) { NIASSERT(pfnCallback != NULL); } //--------------------------------------------------------------------------- inline void NiUIStaticSlot0::Initialize(void (*pfnCallback)()) { NIASSERT(pfnCallback != NULL); m_pfnCallback = pfnCallback; } //--------------------------------------------------------------------------- inline NiUIStaticSlot0::~NiUIStaticSlot0() { // Note: None of the pointers in any of these destructors is owned by // this instance: Therefore, it should not delete them m_pfnCallback = NULL; } //--------------------------------------------------------------------------- inline void NiUIStaticSlot0::ReceiveSignal() const { NIASSERT(m_pfnCallback != NULL); (*m_pfnCallback)(); } //--------------------------------------------------------------------------- template inline NiUIMemberSlot0::NiUIMemberSlot0() : NiUIBaseSlot0(), m_pkInstance(NULL), m_pfnCallback(NULL) { } //--------------------------------------------------------------------------- template inline NiUIMemberSlot0::NiUIMemberSlot0(ClassType* pkInstance, void (ClassType::*pfnCallback)()) : NiUIBaseSlot0(), m_pkInstance(pkInstance), m_pfnCallback(pfnCallback) { NIASSERT(pkInstance != NULL); NIASSERT(pfnCallback != NULL); } //--------------------------------------------------------------------------- template inline void NiUIMemberSlot0::Initialize(ClassType* pkInstance, void (ClassType::*pfnCallback)()) { NIASSERT(pkInstance != NULL); NIASSERT(pfnCallback != NULL); m_pkInstance = pkInstance, m_pfnCallback = pfnCallback; } //--------------------------------------------------------------------------- template inline NiUIMemberSlot0::~NiUIMemberSlot0() { // Note: None of the pointers in any of these destructors is owned by // this instance: Therefore, it should not delete them m_pkInstance = NULL; m_pfnCallback = NULL; } //--------------------------------------------------------------------------- template inline void NiUIMemberSlot0::ReceiveSignal() const { NIASSERT(m_pkInstance != NULL); NIASSERT(m_pfnCallback != NULL); (m_pkInstance->*m_pfnCallback)(); } //--------------------------------------------------------------------------- template inline NiUIBaseSlot1::NiUIBaseSlot1() { } //--------------------------------------------------------------------------- // All code in NiUIBaseSlot* methods are implemented in the macros defined in // NiUISignalSlotMacros.h. template inline NiUIBaseSlot1::~NiUIBaseSlot1() { // Note: None of the pointers in any of these destructors is owned by // this instance: Therefore, it should not delete them NiUnsubscribeFromAll(m_pkSignals); } //--------------------------------------------------------------------------- template inline void NiUIBaseSlot1::Subscribe(NiUISignal1* pkSignal) { NiSubscribeToMe(m_pkSignals, pkSignal); } //--------------------------------------------------------------------------- template inline void NiUIBaseSlot1::Unsubscribe(NiUISignal1* pkSignal) { NiUnsubscribeToMe(m_pkSignals, pkSignal); } //--------------------------------------------------------------------------- template inline bool NiUIBaseSlot1::IsSubscribed(NiUISignal1* pkSignal) const { return NiIsElementInGroup(m_pkSignals, pkSignal); } //--------------------------------------------------------------------------- template inline unsigned int NiUIBaseSlot1::NumSubscribed() const { return NiNumElements(m_pkSignals); } //--------------------------------------------------------------------------- template inline NiUIStaticSlot1::NiUIStaticSlot1() : NiUIBaseSlot1(), m_pfnCallback(NULL) { } //--------------------------------------------------------------------------- template inline NiUIStaticSlot1::NiUIStaticSlot1(void (*pfnCallback)(Arg1Type)) : NiUIBaseSlot1(), m_pfnCallback(pfnCallback) { NIASSERT(pfnCallback != NULL); } //--------------------------------------------------------------------------- template inline void NiUIStaticSlot1::Initialize(void (*pfnCallback)(Arg1Type)) { NIASSERT(pfnCallback != NULL); m_pfnCallback = pfnCallback; } //--------------------------------------------------------------------------- template inline NiUIStaticSlot1::~NiUIStaticSlot1() { // Note: None of the pointers in any of these destructors is owned by // this instance: Therefore, it should not delete them m_pfnCallback = NULL; } //--------------------------------------------------------------------------- template inline void NiUIStaticSlot1::ReceiveSignal(Arg1Type Arg1) const { NIASSERT(m_pfnCallback != NULL); (*m_pfnCallback)(Arg1); } //--------------------------------------------------------------------------- template inline NiUIMemberSlot1::NiUIMemberSlot1() : NiUIBaseSlot1(), m_pkInstance(NULL), m_pfnCallback(NULL) { } //--------------------------------------------------------------------------- template inline NiUIMemberSlot1::NiUIMemberSlot1(ClassType* pkInstance, void (ClassType::*pfnCallback)(Arg1Type)) : NiUIBaseSlot1(), m_pkInstance(pkInstance), m_pfnCallback(pfnCallback) { NIASSERT(pkInstance != NULL); NIASSERT(pfnCallback != NULL); } //--------------------------------------------------------------------------- template inline void NiUIMemberSlot1::Initialize(ClassType* pkInstance, void (ClassType::*pfnCallback)(Arg1Type)) { NIASSERT(pkInstance != NULL); NIASSERT(pfnCallback != NULL); m_pkInstance = pkInstance; m_pfnCallback = pfnCallback; } //--------------------------------------------------------------------------- template inline NiUIMemberSlot1::~NiUIMemberSlot1() { // Note: None of the pointers in any of these destructors is owned by // this instance: Therefore, it should not delete them m_pkInstance = NULL; m_pfnCallback = NULL; } //--------------------------------------------------------------------------- template inline void NiUIMemberSlot1::ReceiveSignal(Arg1Type Arg1) const { NIASSERT(m_pkInstance != NULL); NIASSERT(m_pfnCallback != NULL); (m_pkInstance->*m_pfnCallback)(Arg1); } //--------------------------------------------------------------------------- template inline NiUIBaseSlot2::NiUIBaseSlot2() { } //--------------------------------------------------------------------------- // All code in NiUIBaseSlot* methods are implemented in the macros defined in // NiUISignalSlotMacros.h. template inline NiUIBaseSlot2::~NiUIBaseSlot2() { // Note: None of the pointers in any of these destructors is owned by // this instance: Therefore, it should not delete them NiUnsubscribeFromAll(m_pkSignals); } //--------------------------------------------------------------------------- template inline void NiUIBaseSlot2::Subscribe( NiUISignal2* pkSignal) { NiSubscribeToMe(m_pkSignals, pkSignal); } //--------------------------------------------------------------------------- template inline void NiUIBaseSlot2::Unsubscribe( NiUISignal2* pkSignal) { NiUnsubscribeToMe(m_pkSignals, pkSignal); } //--------------------------------------------------------------------------- template inline bool NiUIBaseSlot2::IsSubscribed( NiUISignal2* pkSignal) const { return NiIsElementInGroup(m_pkSignals, pkSignal); } //--------------------------------------------------------------------------- template inline unsigned int NiUIBaseSlot2::NumSubscribed() const { return NiNumElements(m_pkSignals); } //--------------------------------------------------------------------------- template inline NiUIStaticSlot2::NiUIStaticSlot2() : NiUIBaseSlot2(), m_pfnCallback(NULL) { } //--------------------------------------------------------------------------- template inline NiUIStaticSlot2::NiUIStaticSlot2( void (*pfnCallback)(Arg1Type, Arg2Type)) : NiUIBaseSlot2(), m_pfnCallback(pfnCallback) { NIASSERT(pfnCallback != NULL); } //--------------------------------------------------------------------------- template inline void NiUIStaticSlot2::Initialize( void (*pfnCallback)(Arg1Type, Arg2Type)) { NIASSERT(pfnCallback != NULL); m_pfnCallback = pfnCallback; } //--------------------------------------------------------------------------- template inline NiUIStaticSlot2::~NiUIStaticSlot2() { // Note: None of the pointers in any of these destructors is owned by // this instance: Therefore, it should not delete them m_pfnCallback = NULL; } //--------------------------------------------------------------------------- template inline void NiUIStaticSlot2::ReceiveSignal(Arg1Type Arg1, Arg2Type Arg2) const { NIASSERT(m_pfnCallback != NULL); (*m_pfnCallback)(Arg1, Arg2); } //--------------------------------------------------------------------------- template inline NiUIMemberSlot2::NiUIMemberSlot2() : NiUIBaseSlot2(), m_pkInstance(NULL), m_pfnCallback(NULL) { } //--------------------------------------------------------------------------- template inline NiUIMemberSlot2::NiUIMemberSlot2(ClassType* pkInstance, void (ClassType::*pfnCallback)(Arg1Type, Arg2Type)) : NiUIBaseSlot2(), m_pkInstance(pkInstance), m_pfnCallback(pfnCallback) { NIASSERT(m_pkInstance != NULL); NIASSERT(m_pfnCallback != NULL); } //--------------------------------------------------------------------------- template inline void NiUIMemberSlot2::Initialize(ClassType* pkInstance, void (ClassType::*pfnCallback)(Arg1Type, Arg2Type)) { NIASSERT(m_pkInstance != NULL); NIASSERT(m_pfnCallback != NULL); m_pkInstance = pkInstance; m_pfnCallback = pfnCallback; } //--------------------------------------------------------------------------- template inline NiUIMemberSlot2::~NiUIMemberSlot2() { // Note: None of the pointers in any of these destructors is owned by // this instance: Therefore, it should not delete them m_pkInstance = NULL; m_pfnCallback = NULL; } //--------------------------------------------------------------------------- template inline void NiUIMemberSlot2::ReceiveSignal( Arg1Type Arg1, Arg2Type Arg2) const { NIASSERT(m_pkInstance != NULL); NIASSERT(m_pfnCallback != NULL); (m_pkInstance->*m_pfnCallback)(Arg1, Arg2); } //---------------------------------------------------------------------------