17#ifndef CYBER_COMPONENT_COMPONENT_BASE_H_
18#define CYBER_COMPONENT_COMPONENT_BASE_H_
25#include "gflags/gflags.h"
27#include "cyber/proto/component_conf.pb.h"
41class ComponentBase :
public std::enable_shared_from_this<ComponentBase> {
69 virtual void Clear() {
return; }
86 "APOLLO_FLAG_PATH", &flag_file_path)) {
89 AINFO <<
"use flag file: " << flag_file_path;
91 google::SetCommandLineOption(
"flagfile", flag_file_path.c_str());
109 "APOLLO_FLAG_PATH", &flag_file_path)) {
112 AINFO <<
"use flag file: " << flag_file_path;
114 google::SetCommandLineOption(
"flagfile", flag_file_path.c_str());
119 std::shared_ptr<Node>
node_ =
nullptr;
bool GetProtoConfig(T *config) const
virtual bool Initialize(const ComponentConfig &config)
virtual bool Initialize(const TimerComponentConfig &config)
std::vector< std::shared_ptr< ReaderBase > > readers_
std::atomic< bool > is_shutdown_
void LoadConfigFiles(const TimerComponentConfig &config)
const std::string & ConfigFilePath() const
std::shared_ptr< Node > node_
std::string config_file_path_
void LoadConfigFiles(const ComponentConfig &config)
Reader subscribes a channel, it has two main functions:
virtual bool RemoveTask(const std::string &name)=0
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
bool GetFilePathWithEnv(const std::string &path, const std::string &env_var, std::string *file_path)
get file path, judgement priority:
optional string flag_file_path
optional string config_file_path
optional string config_file_path
optional string flag_file_path