| 85 | } |
| 86 | |
| 87 | bool AFCBusModule::LoadBusRelationConfig() |
| 88 | { |
| 89 | // load bus relation files |
| 90 | AFXml xml_doc(BUS_RELATION_CONFIG_FILE_PATH); |
| 91 | |
| 92 | auto root_node = xml_doc.GetRootNode(); |
| 93 | ARK_ASSERT_RET_VAL(root_node.IsValid(), false); |
| 94 | |
| 95 | auto application_nodes = root_node.FindNode("applications"); |
| 96 | ARK_ASSERT_RET_VAL(application_nodes.IsValid(), false); |
| 97 | for (auto app_node = application_nodes.FindNode("application"); app_node.IsValid(); app_node.NextNode()) |
| 98 | { |
| 99 | std::string app_name = app_node.GetString("name"); |
| 100 | uint32_t app_type = app_node.GetUint32("type"); |
| 101 | |
| 102 | app_config_.name2types.insert(std::make_pair(app_name, static_cast<ARK_APP_TYPE>(app_type))); |
| 103 | app_config_.type2names.insert(std::make_pair(static_cast<ARK_APP_TYPE>(app_type), app_name)); |
| 104 | } |
| 105 | |
| 106 | auto relation_nodes = root_node.FindNode("relations"); |
| 107 | for (auto relation_node = relation_nodes.FindNode("relation"); relation_node.IsValid(); relation_node.NextNode()) |
| 108 | { |
| 109 | std::string source_app = relation_node.GetString("source"); |
| 110 | std::string target_app = relation_node.GetString("target"); |
| 111 | |
| 112 | const ARK_APP_TYPE source_type = GetAppType(source_app); |
| 113 | const ARK_APP_TYPE target_type = GetAppType(target_app); |
| 114 | |
| 115 | ARK_ASSERT_CONTINUE(source_type > ARK_APP_TYPE::ARK_APP_DEFAULT && source_type < ARK_APP_TYPE::ARK_APP_MAX); |
| 116 | ARK_ASSERT_CONTINUE(target_type > ARK_APP_TYPE::ARK_APP_DEFAULT && target_type < ARK_APP_TYPE::ARK_APP_MAX); |
| 117 | |
| 118 | auto iter = app_config_.connection_relations.find(source_type); |
| 119 | if (iter != app_config_.connection_relations.end()) |
| 120 | { |
| 121 | iter->second.emplace_back(target_type); |
| 122 | } |
| 123 | else |
| 124 | { |
| 125 | std::vector<ARK_APP_TYPE> target_list; |
| 126 | target_list.emplace_back(target_type); |
| 127 | app_config_.connection_relations.insert(std::make_pair(source_type, target_list)); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | return true; |
| 132 | } |
| 133 | |
| 134 | bool AFCBusModule::LoadRegCenterConfig() |
| 135 | { |
nothing calls this directly
no test coverage detected