1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef BASE_HIVIEWDFX_HIVIEW_CORE_PLUGIN_CONFIG_H 16 #define BASE_HIVIEWDFX_HIVIEW_CORE_PLUGIN_CONFIG_H 17 #include <list> 18 #include <map> 19 #include <string> 20 namespace OHOS { 21 namespace HiviewDFX { 22 class PluginConfig { 23 public: 24 struct PluginInfo { 25 bool isStatic = false; 26 bool isEventSource = false; 27 int32_t loadDelay = 0; 28 std::string name; 29 std::string workHandlerType; 30 std::string workHandlerName; 31 std::list<std::string> pipelineNameList; 32 }; 33 34 struct PipelineInfo { 35 std::string name; 36 std::list<std::string> pluginNameList; 37 }; 38 39 struct WorkPoolInfo { 40 std::string name; 41 int32_t threadCount = 0; 42 }; 43 PluginConfig()44 PluginConfig() {}; ~PluginConfig()45 ~PluginConfig() {}; 46 explicit PluginConfig(const std::string& file); 47 bool StartParse(); 48 const std::list<PluginConfig::PluginInfo>& GetPluginInfoList() const; 49 const std::list<PluginConfig::PipelineInfo>& GetPipelineInfoList() const; 50 51 private: 52 void ParsePlugin(const std::string& pluginStr); 53 void ParsePipeline(const std::string& pipelineStr); 54 void ParsePipelineGroup(const std::string& pipelineGroup); 55 std::string configPath_; 56 std::map<std::string, WorkPoolInfo> workPoolInfoMap_; 57 std::list<PluginInfo> pluginInfoList_; 58 std::list<PipelineInfo> pipelineInfoList_; 59 }; 60 } // namespace HiviewDFX 61 } // namespace OHOS 62 #endif // BASE_HIVIEWDFX_HIVIEW_CORE_PLUGIN_CONFIG_H