39 const std::string& description_index_path,
40 const std::string& description_path,
41 const std::string& actual_description_path,
42 const std::string& library_path,
43 const std::string& actual_library_path)
45 description_index_path_(description_index_path),
46 description_path_(description_path),
47 actual_description_path_(actual_description_path),
48 library_path_(library_path),
49 actual_library_path_(actual_library_path) {}
71 AWARN <<
"plugin index[" << file_path <<
"] name[" << this->
name_
73 <<
"] file not found";
77 tinyxml2::XMLDocument doc;
78 if (doc.LoadFile(this->actual_description_path_.c_str()) !=
79 tinyxml2::XML_SUCCESS) {
80 AWARN <<
"plugin description[" << file_path <<
"] name[" << this->
name_
81 <<
"] invalid, parse description file failed";
84 const tinyxml2::XMLElement* root = doc.RootElement();
87 std::string plugin_name =
88 std::regex_replace(this->
library_path_, std::regex(
"/"),
"__");
89 if (this->
name_.empty()) {
90 this->
name_ = plugin_name;
95 for (
const tinyxml2::XMLElement* class_element =
96 root->FirstChildElement(
"class");
97 class_element !=
nullptr;
98 class_element = class_element->NextSiblingElement(
"class")) {
99 std::string class_name = class_element->Attribute(
"type");
100 std::string base_class_name = class_element->Attribute(
"base_class");
104 AWARN <<
"plugin description[" << file_path <<
"] name[" << this->
name_
105 <<
"] invalid, class name[" << class_name <<
"] duplicated";
109 if (class_name.empty() || base_class_name.empty()) {
110 AWARN <<
"plugin description[" << file_path <<
"] name[" << this->
name_
111 <<
"] invalid, class name[" << class_name <<
"] base class name["
112 << base_class_name <<
"] invalid";
119 "APOLLO_PLUGIN_LIB_PATH",
121 AWARN <<
"plugin description[" << file_path <<
"] name[" << this->
name_
122 <<
"] invalid, library[" << this->
library_path_ <<
"] file not found";