1 /* 2 * Copyright (c) 2021 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; 26 bool isEventSource; 27 int32_t loadDelay; 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; 42 }; 43 44 explicit PluginConfig(const std::string& file); ~PluginConfig()45 ~PluginConfig(){}; 46 bool StartParse(); 47 const std::list<PluginConfig::PluginInfo>& GetPluginInfoList() const; 48 const std::list<PluginConfig::PipelineInfo>& GetPipelineInfoList() const; 49 50 private: 51 void ParsePlugin(const std::string& pluginStr); 52 void ParsePipeline(const std::string& pipelineStr); 53 void ParsePipelineGroup(const std::string& pipelineGroup); 54 std::string configPath_; 55 std::map<std::string, WorkPoolInfo> workPoolInfoMap_; 56 std::list<PluginInfo> pluginInfoList_; 57 std::list<PipelineInfo> pipelineInfoList_; 58 }; 59 } // namespace HiviewDFX 60 } // namespace OHOS 61 #endif // BASE_HIVIEWDFX_HIVIEW_CORE_PLUGIN_CONFIG_H