Apollo 10.0
自动驾驶开放平台
apollo::cyber::data::fusion::AllLatest< M0, M1, NullType, NullType > 模板类 参考

#include <all_latest.h>

类 apollo::cyber::data::fusion::AllLatest< M0, M1, NullType, NullType > 继承关系图:
apollo::cyber::data::fusion::AllLatest< M0, M1, NullType, NullType > 的协作图:

Public 成员函数

 AllLatest (const ChannelBuffer< M0 > &buffer_0, const ChannelBuffer< M1 > &buffer_1)
 
bool Fusion (uint64_t *index, std::shared_ptr< M0 > &m0, std::shared_ptr< M1 > &m1) override
 
- Public 成员函数 继承自 apollo::cyber::data::fusion::DataFusion< M0, M1 >
virtual ~DataFusion ()
 
virtual bool Fusion (uint64_t *index, std::shared_ptr< M0 > &m0, std::shared_ptr< M1 > &m1, std::shared_ptr< NullType > &m2, std::shared_ptr< NullType > &m3)=0
 

详细描述

template<typename M0, typename M1>
class apollo::cyber::data::fusion::AllLatest< M0, M1, NullType, NullType >

在文件 all_latest.h141 行定义.

构造及析构函数说明

◆ AllLatest()

template<typename M0 , typename M1 >
apollo::cyber::data::fusion::AllLatest< M0, M1, NullType, NullType >::AllLatest ( const ChannelBuffer< M0 > &  buffer_0,
const ChannelBuffer< M1 > &  buffer_1 
)
inline

在文件 all_latest.h145 行定义.

147 : buffer_m0_(buffer_0),
148 buffer_m1_(buffer_1),
149 buffer_fusion_(buffer_m0_.channel_id(),
150 new CacheBuffer<std::shared_ptr<FusionDataType>>(
151 buffer_0.Buffer()->Capacity() - uint64_t(1))) {
152 buffer_m0_.Buffer()->SetFusionCallback(
153 [this](const std::shared_ptr<M0>& m0) {
154 std::shared_ptr<M1> m1;
155 if (!buffer_m1_.Latest(m1)) {
156 return;
157 }
158
159 auto data = std::make_shared<FusionDataType>(m0, m1);
160 std::lock_guard<std::mutex> lg(buffer_fusion_.Buffer()->Mutex());
161 buffer_fusion_.Buffer()->Fill(data);
162 });
163 }
bool Latest(std::shared_ptr< T > &m)
std::shared_ptr< BufferType > Buffer() const

成员函数说明

◆ Fusion()

template<typename M0 , typename M1 >
bool apollo::cyber::data::fusion::AllLatest< M0, M1, NullType, NullType >::Fusion ( uint64_t *  index,
std::shared_ptr< M0 > &  m0,
std::shared_ptr< M1 > &  m1 
)
inlineoverride

在文件 all_latest.h165 行定义.

166 {
167 std::shared_ptr<FusionDataType> fusion_data;
168 if (!buffer_fusion_.Fetch(index, fusion_data)) {
169 return false;
170 }
171 m0 = std::get<0>(*fusion_data);
172 m1 = std::get<1>(*fusion_data);
173 return true;
174 }
bool Fetch(uint64_t *index, std::shared_ptr< T > &m)

该类的文档由以下文件生成: