You.i Engine
CYISignalBase Class Reference

Detailed Description

The base abstract class for CYISignal.

See also
CYISignal
CYISignalHandler

#include <signal/YiSignalBase.h>

Inheritance diagram for CYISignalBase:

Classes

struct  SignalObjects
 

Public Member Functions

virtual bool IsConnected () const override
 
virtual bool IsConnected (const CYISignalBase &rSignal) const override
 
bool IsConnected (const CYISignalHandler &rSignalHandler) const
 
bool IsConnected (CYISignalConnectionID connectionID) const
 
void Disconnect (CYISignalHandler &rSignalHandler)
 
void Disconnect (CYISignalConnectionID connectionID)
 
void Disconnect (CYISignalBase &rSignal)
 
- Public Member Functions inherited from CYISignalHandler
 CYISignalHandler ()
 
 CYISignalHandler (const CYISignalHandler &rSignalHandler)
 
virtual ~CYISignalHandler ()
 
CYISignalHandleroperator= (const CYISignalHandler &rSignalHandler)
 
void MoveToThread (CYIThread *pThread)
 This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More...
 
CYIThreadHandle GetThreadAffinity () const
 
void SetThreadAffinity (const CYIThreadHandle &rThreadAffinity)
 
void Disconnect (CYISignalBase &rSignal)
 
void DisconnectFromAllSignals ()
 
- Public Member Functions inherited from CYIThread::Listener
 Listener ()
 
virtual ~Listener ()
 
virtual void OnThreadStarted (CYIThread *)
 
virtual void OnThreadTerminated (CYIThread *)
 
virtual void OnThreadFinished (CYIThread *)
 

Protected Member Functions

 CYISignalBase ()
 
 CYISignalBase (const CYISignalBase &rSignal)
 
virtual ~CYISignalBase ()
 
CYISignalBaseoperator= (const CYISignalBase &rSignal)
 
void RemoveConnection (CYISignalHandler &rSignalHandler, NotifyFlag notifyHandler)
 
void RemoveAllConnections (NotifyFlag notifyHandler)
 
void RegisterToSignalHandler (const CYISignalHandler &rSignalHandler)
 
void UnregisterFromSignalHandler (CYISignalHandler &rSignalHandler)
 
void ExclusiveLock (CYIRecursiveSpinLock &signalMutex) const
 
void ExclusiveLock (const CYISignalHandler &rSignalHandler, CYIRecursiveSpinLock &signalMutex) const
 
void ExclusiveUnlock (CYIRecursiveSpinLock &signalMutex) const
 
void ExclusiveUnlock (const CYISignalHandler &rSignalHandler, CYIRecursiveSpinLock &rSignalMutex) const
 
bool HasConnection (const CYISignalHandler &rSignalHandler) const
 
void CloneConnectionAndConnectTo (CYISignalBase &signal, const CYISignalConnectionWrapper &connection)
 

Protected Attributes

CYILazy< SignalObjectsm_signalObjects
 

Friends

class CYISignalHandler
 

Constructor & Destructor Documentation

◆ CYISignalBase() [1/2]

CYISignalBase::CYISignalBase ( )
protected

◆ CYISignalBase() [2/2]

CYISignalBase::CYISignalBase ( const CYISignalBase rSignal)
protected

◆ ~CYISignalBase()

virtual CYISignalBase::~CYISignalBase ( )
protectedvirtual

Member Function Documentation

◆ CloneConnectionAndConnectTo()

void CYISignalBase::CloneConnectionAndConnectTo ( CYISignalBase signal,
const CYISignalConnectionWrapper connection 
)
protected

◆ Disconnect() [1/3]

void CYISignalBase::Disconnect ( CYISignalHandler rSignalHandler)

Disconnects every connection between a CYISignal and the given CYISignalHandler. All daisy-chained signals will also be disconnected.

Note
This is done automatically when the CYISignal goes out of scope or is deleted.
If the connection doesn't exists with a given slot, it won't have any effect.
This function is thread-safe.
See also
CYISignalHandler::Disconnect(CYISignalBase &rSignal)

◆ Disconnect() [2/3]

void CYISignalBase::Disconnect ( CYISignalConnectionID  connectionID)

Disconnects a single connection identified by connectionID. If no such connection exists, this function has no effect.

Note
This function is thread-safe.

◆ Disconnect() [3/3]

void CYISignalBase::Disconnect ( CYISignalBase rSignal)

Disconnects every daisy-chained connections between this signal and the given signal.

Note
This is done automatically when the CYISignal goes out of scope or is deleted.
This function is thread-safe.
See also
CYISignalHandler::Disconnect(CYISignalBase &rSignalHandler)

◆ ExclusiveLock() [1/2]

void CYISignalBase::ExclusiveLock ( CYIRecursiveSpinLock signalMutex) const
protected

Obtains exclusive lock with this CYISignalBase and every CYISignalHandler found in the connection list. This function will keep trying to acquire the locks until every objects are locked. The purpose of this function is to avoid deadlocks.

Note
This function must be followed by ExclusiveUnlock();
This function is thread-safe.

◆ ExclusiveLock() [2/2]

void CYISignalBase::ExclusiveLock ( const CYISignalHandler rSignalHandler,
CYIRecursiveSpinLock signalMutex 
) const
protected

Obtains exclusive lock with this CYISignalBase and every CYISignalHandler found in the connection list. This function will keep trying to acquire the locks until every objects are locked. The purpose of this function is to avoid deadlocks.

Note
This function must be followed by ExclusiveUnlock(rSignalHandler);
This function is thread-safe.

◆ ExclusiveUnlock() [1/2]

void CYISignalBase::ExclusiveUnlock ( CYIRecursiveSpinLock signalMutex) const
protected

Unlocks every CYISignalHandler found in the connection and unlocks this CYISignalBase.

Note
This function is thread-safe.

◆ ExclusiveUnlock() [2/2]

void CYISignalBase::ExclusiveUnlock ( const CYISignalHandler rSignalHandler,
CYIRecursiveSpinLock rSignalMutex 
) const
protected

Unlocks a specific CYISignalHandler found in the connection list and unlocks this CYISignalBase.

Note
This function is thread-safe.

◆ HasConnection()

bool CYISignalBase::HasConnection ( const CYISignalHandler rSignalHandler) const
protected

Checks if this instance has a connection to a given CYISignalHandler.

Warning
This function is not thread-safe.

◆ IsConnected() [1/4]

virtual bool CYISignalBase::IsConnected ( ) const
overridevirtual

Checks if at least one connection has been established with any CYISignalHandler (or to any static functions).

Note
This function is thread-safe.
See also
IsConnected(const CYISignalBase &rSignal) const
IsConnected(const CYISignalHandler &rSignalHandler) const

Reimplemented from CYISignalHandler.

◆ IsConnected() [2/4]

virtual bool CYISignalBase::IsConnected ( const CYISignalBase rSignal) const
overridevirtual

Checks if a CYISignal is connected to another via a daisy chain connection.

Example:

bool ConnectMySignalToMyHandlerAndCheck()
{
MySignal1.Connect(MySignal2); // daisy-chain
return MySignal1.IsConnected(MySignal2) && MySignal2.IsConnected(MySignal1);
}
Note
This function is thread-safe.
See also
IsConnected() const
IsConnected(const CYISignalHandler &rSignalHandler) const

Reimplemented from CYISignalHandler.

◆ IsConnected() [3/4]

bool CYISignalBase::IsConnected ( const CYISignalHandler rSignalHandler) const

Checks if at least one connection has been established with a given CYISignalHandler.

Note
This function is thread-safe.
See also
IsConnected() const
IsConnected(const CYISignalBase &rSignal) const

◆ IsConnected() [4/4]

bool CYISignalBase::IsConnected ( CYISignalConnectionID  connectionID) const

Checks if a connection has been established and is identified by connectionID.

Note
This function is thread-safe.
See also
IsConnected() const

◆ operator=()

CYISignalBase& CYISignalBase::operator= ( const CYISignalBase rSignal)
protected

◆ RegisterToSignalHandler()

void CYISignalBase::RegisterToSignalHandler ( const CYISignalHandler rSignalHandler)
protected

Adds this CYISignalBase instance into the signal list of a CYISignalHandler.

Warning
This function is not thread-safe.

◆ RemoveAllConnections()

void CYISignalBase::RemoveAllConnections ( NotifyFlag  notifyHandler)
protected

Disconnects every connection from every CYISignalHandler and from every static functions. All daisy-chained signals will also be disconnected.

Warning
This function is not thread-safe.

◆ RemoveConnection()

void CYISignalBase::RemoveConnection ( CYISignalHandler rSignalHandler,
NotifyFlag  notifyHandler 
)
protected

Disconnects every connection between a CYISignal and the given CYISignalHandler without severing the connection from the CYISignalHandler to this instance.

This function is meant to be used by the CYISignalHandler only, when the connection termination occurs on the CYISignalHandler first.

Warning
This function is not thread-safe.

◆ UnregisterFromSignalHandler()

void CYISignalBase::UnregisterFromSignalHandler ( CYISignalHandler rSignalHandler)
protected

Removes this CYISignalBase instance from the signal list of an CYISignalHandler.

Warning
This function is not thread-safe.

Friends And Related Function Documentation

◆ CYISignalHandler

friend class CYISignalHandler
friend

Member Data Documentation

◆ m_signalObjects

CYILazy<SignalObjects> CYISignalBase::m_signalObjects
protected

The documentation for this class was generated from the following file: