17 #ifndef CYBER_BLOCKER_INTRA_WRITER_H_ 18 #define CYBER_BLOCKER_INTRA_WRITER_H_ 29 template <
typename MessageT>
35 explicit IntraWriter(
const proto::RoleAttributes& attr);
41 bool Write(
const MessageT& msg)
override;
48 template <
typename MessageT>
50 :
Writer<MessageT>(attr) {}
52 template <
typename MessageT>
57 template <
typename MessageT>
60 std::lock_guard<std::mutex> g(this->
lock_);
65 blocker_manager_->GetOrCreateBlocker<MessageT>(
72 template <
typename MessageT>
75 std::lock_guard<std::mutex> g(this->
lock_);
81 blocker_manager_ =
nullptr;
84 template <
typename MessageT>
89 return blocker_manager_->Publish<MessageT>(this->
role_attr_.channel_name(),
93 template <
typename MessageT>
98 return blocker_manager_->Publish<MessageT>(this->
role_attr_.channel_name(),
106 #endif // CYBER_BLOCKER_INTRA_WRITER_H_ Definition: intra_writer.h:30
std::mutex lock_
Definition: writer_base.h:99
proto::RoleAttributes role_attr_
Definition: writer_base.h:98
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
bool init_
Definition: writer_base.h:100
static const std::shared_ptr< BlockerManager > & Instance()
Definition: blocker_manager.h:38
bool Write(const MessageT &msg) override
Write a MessageT instance.
Definition: intra_writer.h:85
void Shutdown() override
Shutdown the Writer.
Definition: intra_writer.h:73
bool IsInit() const
Is Writer initialized?
Definition: writer_base.h:92
std::shared_ptr< BlockerManager > BlockerManagerPtr
Definition: intra_writer.h:33
bool Init() override
Init the Writer.
Definition: intra_writer.h:58
IntraWriter(const proto::RoleAttributes &attr)
Definition: intra_writer.h:49
virtual ~IntraWriter()
Definition: intra_writer.h:53
std::shared_ptr< MessageT > MessagePtr
Definition: intra_writer.h:32