forked from byterazor/EventManager
ADD: support connecting additonal participants from participant
This commit is contained in:
parent
437feb597d
commit
8f78070770
@ -135,6 +135,16 @@
|
|||||||
*/
|
*/
|
||||||
bool isScheduledByManager() const {return isScheduledByManager_;}
|
bool isScheduledByManager() const {return isScheduledByManager_;}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief connect a new participant through another participant
|
||||||
|
*/
|
||||||
|
void connect(std::shared_ptr<EventManager::Participant> participant);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief disconnect a participant through another participant
|
||||||
|
*/
|
||||||
|
void disconnect(std::shared_ptr<EventManager::Participant> participant);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor setting the participant up for use
|
* @brief Constructor setting the participant up for use
|
||||||
|
@ -18,6 +18,25 @@ EventManager::Participant::Participant() : manager_(nullptr),
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EventManager::Participant::connect(std::shared_ptr<EventManager::Participant> participant)
|
||||||
|
{
|
||||||
|
if (manager_ == nullptr)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("no event manager set yet");
|
||||||
|
}
|
||||||
|
manager_->connect(participant);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EventManager::Participant::disconnect(std::shared_ptr<EventManager::Participant> participant)
|
||||||
|
{
|
||||||
|
if (manager_ == nullptr)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("no event manager set yet");
|
||||||
|
}
|
||||||
|
manager_->disconnect(participant);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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