17 #ifndef CYBER_DATA_DATA_NOTIFIER_H_ 18 #define CYBER_DATA_DATA_NOTIFIER_H_ 47 void AddNotifier(uint64_t channel_id,
48 const std::shared_ptr<Notifier>& notifier);
50 bool Notify(
const uint64_t channel_id);
53 std::mutex notifies_map_mutex_;
59 inline DataNotifier::DataNotifier() {}
62 uint64_t channel_id,
const std::shared_ptr<Notifier>& notifier) {
63 std::lock_guard<std::mutex> lock(notifies_map_mutex_);
65 if (notifies_map_.Get(channel_id, ¬ifies)) {
66 notifies->emplace_back(notifier);
69 notifies_map_.Set(channel_id, new_notify);
75 if (notifies_map_.Get(channel_id, ¬ifies)) {
76 for (
auto& notifier : *notifies) {
77 if (notifier && notifier->callback) {
90 #endif // CYBER_DATA_DATA_NOTIFIER_H_ ::apollo::cyber::Time Time
Definition: racobit_radar_message_manager.h:41
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: data_notifier.h:38
~DataNotifier()
Definition: data_notifier.h:45
#define DECLARE_SINGLETON(classname)
Definition: macros.h:52
A implementation of lock-free fixed size hash map.
Definition: atomic_hash_map.h:40
Definition: data_notifier.h:42
std::vector< std::shared_ptr< Notifier > > NotifyVector
Definition: data_notifier.h:44
std::function< void()> callback
Definition: data_notifier.h:39
Definition: perf_event_cache.h:36
void AddNotifier(uint64_t channel_id, const std::shared_ptr< Notifier > ¬ifier)
Definition: data_notifier.h:61
bool Notify(const uint64_t channel_id)
Definition: data_notifier.h:73