Apollo 10.0
自动驾驶开放平台
apollo::cyber::Component< M0, M1, M2, M3 > 模板类 参考abstract

更多...

#include <component.h>

类 apollo::cyber::Component< M0, M1, M2, M3 > 继承关系图:
apollo::cyber::Component< M0, M1, M2, M3 > 的协作图:

Public 成员函数

 Component ()
 
 ~Component () override
 
bool Initialize (const ComponentConfig &config) override
 init the component by protobuf object.
 
bool Process (const std::shared_ptr< M0 > &msg0, const std::shared_ptr< M1 > &msg1, const std::shared_ptr< M2 > &msg2, const std::shared_ptr< M3 > &msg3)
 
- Public 成员函数 继承自 apollo::cyber::ComponentBase
virtual ~ComponentBase ()
 
virtual bool Initialize (const TimerComponentConfig &config)
 
virtual void Shutdown ()
 
template<typename T >
bool GetProtoConfig (T *config) const
 

额外继承的成员函数

- Public 类型 继承自 apollo::cyber::ComponentBase
template<typename M >
using Reader = cyber::Reader< M >
 
- Protected 成员函数 继承自 apollo::cyber::ComponentBase
virtual bool Init ()=0
 
virtual void Clear ()
 
const std::string & ConfigFilePath () const
 
void LoadConfigFiles (const ComponentConfig &config)
 
void LoadConfigFiles (const TimerComponentConfig &config)
 
- Protected 属性 继承自 apollo::cyber::ComponentBase
std::atomic< bool > is_shutdown_ = {false}
 
std::shared_ptr< Nodenode_ = nullptr
 
std::string config_file_path_ = ""
 
std::vector< std::shared_ptr< ReaderBase > > readers_
 

详细描述

template<typename M0 = NullType, typename M1 = NullType, typename M2 = NullType, typename M3 = NullType>
class apollo::cyber::Component< M0, M1, M2, M3 >

The Component can process up to four channels of messages. The message type is specified when the component is created. The Component is inherited from ComponentBase. Your component can inherit from Component, and implement Init() & Proc(...), They are picked up by the CyberRT. There are 4 specialization implementations.

模板参数
M0the first message.
M1the second message.
M2the third message.
M3the fourth message.
警告
The Init & Proc functions need to be overloaded, but don't want to be called. They are called by the CyberRT Frame.

在文件 component.h60 行定义.

构造及析构函数说明

◆ Component()

template<typename M0 = NullType, typename M1 = NullType, typename M2 = NullType, typename M3 = NullType>
apollo::cyber::Component< M0, M1, M2, M3 >::Component ( )
inline

在文件 component.h62 行定义.

62{}

◆ ~Component()

template<typename M0 = NullType, typename M1 = NullType, typename M2 = NullType, typename M3 = NullType>
apollo::cyber::Component< M0, M1, M2, M3 >::~Component ( )
inlineoverride

在文件 component.h63 行定义.

63{}

成员函数说明

◆ Initialize()

template<typename M0 , typename M1 , typename M2 , typename M3 >
bool apollo::cyber::Component< M0, M1, M2, M3 >::Initialize ( const ComponentConfig config)
inlineoverridevirtual

init the component by protobuf object.

参数
configwhich is defined in 'cyber/proto/component_conf.proto'
返回
returns true if successful, otherwise returns false

重载 apollo::cyber::ComponentBase .

在文件 component.h152 行定义.

153 {
154 node_.reset(new Node(config.name()));
155 LoadConfigFiles(config);
156 if (!Init()) {
157 AERROR << "Component Init() failed." << std::endl;
158 return false;
159 }
160 return true;
161}
Definition node.h:31
std::shared_ptr< Node > node_
void LoadConfigFiles(const ComponentConfig &config)
#define AERROR
Definition log.h:44

◆ Process()

template<typename M0 , typename M1 , typename M2 , typename M3 >
bool apollo::cyber::Component< M0, M1, M2, M3 >::Process ( const std::shared_ptr< M0 > &  msg0,
const std::shared_ptr< M1 > &  msg1,
const std::shared_ptr< M2 > &  msg2,
const std::shared_ptr< M3 > &  msg3 
)

在文件 component.h505 行定义.

508 {
509 if (is_shutdown_.load()) {
510 return true;
511 }
512 return Proc(msg0, msg1, msg2, msg3);
513}
std::atomic< bool > is_shutdown_

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