removed namespace interface
This commit is contained in:
@@ -14,7 +14,7 @@ std::type_index message::type() const {
|
||||
return type_;
|
||||
}
|
||||
|
||||
const void * message::msg_ptr() const {
|
||||
const void * message::raw_ptr() const {
|
||||
return owner_ ? owner_.get() : ptr_;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ bool subscription::valid() const {
|
||||
return bus_ != nullptr;
|
||||
}
|
||||
|
||||
message_bus::message_bus()
|
||||
: next_id_{1} {}
|
||||
|
||||
void message_bus::unsubscribe(const std::type_index type, HandlerId id) {
|
||||
std::unique_lock writeLock(mutex_);
|
||||
const auto it = handlers_.find(type);
|
||||
@@ -89,7 +92,7 @@ void message_bus::publish(const message &msg) const {
|
||||
}
|
||||
snapshot = it->second;
|
||||
}
|
||||
const void* p = msg.msg_ptr();
|
||||
const void* p = msg.raw_ptr();
|
||||
for (const auto &e : snapshot) {
|
||||
if (!e.filter || e.filter(p)) e.handler(p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user