18 std::function<
void(
const std::any&)>&& func,
19 std::function<
void()>&& cleanup)
20 : m_func(
std::move(func)), m_cleanup(
std::move(cleanup))
26 std::function<
void(
const std::any&)>&& func,
27 std::function<
void()>&& cleanup)
29 return Ptr(
new Subscriber(std::move(func), std::move(cleanup)));
38 std::lock_guard<std::mutex> lock(
m_mutex);
47 std::lock_guard<std::mutex> lock(
m_mutex);
56 std::lock_guard<std::mutex> lock(
m_mutex);
std::function< void(const std::any &)> m_func
void cleanupTopic(const std::string &key)
void publish(const std::any &any)
void pub(const std::any &a)
std::shared_ptr< TopicDirectory > Ptr
static Ptr create(std::function< void(const std::any &)> &&func, std::function< void()> &&cleanup)
Subscriber(std::function< void(const std::any &)> &&func, std::function< void()> &&cleanup)
std::function< void()> m_cleanup
std::function< void()> m_cleanup
std::unordered_map< std::string, std::weak_ptr< Topic > > m_mapService
std::shared_ptr< Subscriber > Ptr
void cleanupSubscriber(std::list< std::weak_ptr< Subscriber >>::iterator it)
Serial and networking devices and utilities.
std::list< std::weak_ptr< Subscriber > > m_subs
The central directory of existing topics for pub/sub.
Topic(std::function< void()> &&cleanup)