You.i Engine
YiSignalBase.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_SIGNAL_BASE_H_
3 #define _YI_SIGNAL_BASE_H_
4 
8 
21 {
22  friend class CYISignalHandler;
23 
24 public:
27 
36  virtual bool IsConnected() const override;
37 
58  virtual bool IsConnected(const CYISignalBase &rSignal) const override;
59 
68  bool IsConnected(const CYISignalHandler &rSignalHandler) const;
69 
77  bool IsConnected(CYISignalConnectionID connectionID) const;
78 
91  void Disconnect(CYISignalHandler &rSignalHandler);
92 
99  void Disconnect(CYISignalConnectionID connectionID);
100 
110  void Disconnect(CYISignalBase &rSignal);
111 
112 protected:
114  {
115  SignalObjects();
116 
121 
122 #ifdef YI_DEBUG
123 
126  bool m_emitting;
127 #endif
128 
133 
138  };
139 
140  CYISignalBase();
141  CYISignalBase(const CYISignalBase &rSignal);
142  virtual ~CYISignalBase();
143  CYISignalBase &operator=(const CYISignalBase &rSignal);
144 
154  void RemoveConnection(CYISignalHandler &rSignalHandler, NotifyFlag notifyHandler);
155 
162  void RemoveAllConnections(NotifyFlag notifyHandler);
163 
169  void RegisterToSignalHandler(const CYISignalHandler &rSignalHandler);
170 
176  void UnregisterFromSignalHandler(CYISignalHandler &rSignalHandler);
177 
187  void ExclusiveLock(CYIRecursiveSpinLock &signalMutex) const;
188 
198  void ExclusiveLock(const CYISignalHandler &rSignalHandler, CYIRecursiveSpinLock &signalMutex) const;
199 
205  void ExclusiveUnlock(CYIRecursiveSpinLock &signalMutex) const;
206 
212  void ExclusiveUnlock(const CYISignalHandler &rSignalHandler, CYIRecursiveSpinLock &rSignalMutex) const;
213 
219  bool HasConnection(const CYISignalHandler &rSignalHandler) const;
220 
222 
223 protected:
225 
226 private:
227  void DisconnectFromAllSlots();
228  size_t FindConnectionIndex(CYISignalConnectionID connectionID) const;
229  void CloneConnections(const CYISignalHandler &rSourceSignalHandler, CYISignalHandler &rDestinationSignalHandler);
230  void CopySignal(const CYISignalBase &rSignal);
231  void CloneConnectionAndConnect(const CYISignalConnectionWrapper &connection);
232 };
233 
238 #endif /* _YI_SIGNAL_BASE_H_ */
virtual bool IsConnected() const override
void RegisterToSignalHandler(const CYISignalHandler &rSignalHandler)
CYILazy< SignalObjects > m_signalObjects
Definition: YiSignalBase.h:221
void ExclusiveUnlock(CYIRecursiveSpinLock &signalMutex) const
void ExclusiveLock(CYIRecursiveSpinLock &signalMutex) const
Provides access serialization between threads, where a thread trying to acquire the lock waits in a l...
Definition: YiRecursiveSpinLock.h:33
CYIRecursiveSpinLock m_signalMutex
Definition: YiSignalBase.h:120
bool HasConnection(const CYISignalHandler &rSignalHandler) const
virtual ~CYISignalBase()
void Disconnect(CYISignalHandler &rSignalHandler)
void CloneConnectionAndConnectTo(CYISignalBase &signal, const CYISignalConnectionWrapper &connection)
CYILazy is a thread-safe lazy initializer of a class. The instance pointer remains null until CYILazy...
Definition: YiLazy.h:47
void RemoveAllConnections(NotifyFlag notifyHandler)
The base abstract class for CYISignal.
Definition: YiSignalBase.h:20
An object used to identify a specific CYISignal connection.
Definition: YiSignalConnectionID.h:19
Definition: YiSignalConnectionWrapper.h:7
void RemoveConnection(CYISignalHandler &rSignalHandler, NotifyFlag notifyHandler)
void Disconnect(CYISignalBase &rSignal)
void UnregisterFromSignalHandler(CYISignalHandler &rSignalHandler)
Definition: YiSignalHandler.h:175
CYISmallVector< CYISignalConnectionWrapper, 4 > m_connectionList
Definition: YiSignalBase.h:137
CYISignalBase & operator=(const CYISignalBase &rSignal)
virtual bool IsConnected() const
size_t m_emitCurrentConnectionIndex
Definition: YiSignalBase.h:132
Definition: YiSignalBase.h:113