forked from byterazor/EventManager
ADD: Adds class function to participant to disconnect itself from the event manager.
This commit is contained in:
parent
3dc92bde5f
commit
4f7f58a60c
@ -162,6 +162,11 @@
|
|||||||
*/
|
*/
|
||||||
void disconnect(std::shared_ptr<EventManager::Participant> participant);
|
void disconnect(std::shared_ptr<EventManager::Participant> participant);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief disconnect this participant from the event manager
|
||||||
|
*/
|
||||||
|
void disconnect();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor setting the participant up for use
|
* @brief Constructor setting the participant up for use
|
||||||
|
@ -40,6 +40,16 @@ void EventManager::Participant::disconnect(std::shared_ptr<EventManager::Partici
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EventManager::Participant::disconnect()
|
||||||
|
{
|
||||||
|
if (manager_ == nullptr)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("no event manager set yet");
|
||||||
|
}
|
||||||
|
manager_->disconnect(shared_from_this());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void EventManager::Participant::emit(std::shared_ptr<EventManager::Event> event)
|
void EventManager::Participant::emit(std::shared_ptr<EventManager::Event> event)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user