ADD: Adds class function to participant to disconnect itself from the event manager.

This commit is contained in:
Christina Sander 2022-11-01 20:03:31 +01:00
parent 3dc92bde5f
commit 4f7f58a60c
Signed by: csander
GPG Key ID: F0B2F0D577D7885B
2 changed files with 15 additions and 0 deletions

View File

@ -162,6 +162,11 @@
*/
void disconnect(std::shared_ptr<EventManager::Participant> participant);
/**
* @brief disconnect this participant from the event manager
*/
void disconnect();
public:
/**
* @brief Constructor setting the participant up for use

View File

@ -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)
{
{