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 COMPOSE_RULE_H 16#define COMPOSE_RULE_H 17#include <list> 18#include <map> 19#include <string> 20#include <vector> 21 22#include <json/json.h> 23namespace OHOS { 24namespace HiviewDFX { 25class ComposeRule { 26public: 27 ComposeRule() {}; 28 ~ComposeRule() {}; 29 void ParseComposeRule(const std::string& config, const std::string& type, 30 std::vector<std::string> featureIds); 31 std::list<std::pair<std::string, std::map<std::string, std::string>>> GetComposeRule() const; 32 33private: 34 void ParseRule(const Json::Value& jsonRoot, const std::string& type, std::vector<std::string>& featureIds); 35 static bool ComparePrio(const std::string& featureIdOne, const std::string& featureIdTwo); 36 std::map<std::string, std::string> GetMapFromJson(const Json::Value& json, const std::string& featureId); 37 38private: 39 std::list<std::pair<std::string, std::map<std::string, std::string>>> composeRules_; 40}; 41} // namespace HiviewDFX 42} // namespace OHOS 43#endif /* COMPOSE_RULE_H */ 44