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 RULES_H 16 #define RULES_H 17 18 #include <list> 19 #include <map> 20 #include <string> 21 22 #include "syntax_rules.h" 23 namespace OHOS { 24 namespace HiviewDFX { 25 class Rule { 26 public: Rule(std::string eventPath,std::string analysisConfig,std::string eventType)27 Rule(std::string eventPath, std::string analysisConfig, std::string eventType) : 28 eventPath_(eventPath), analysisConfig_(analysisConfig), eventType_(eventType) {}; ~Rule()29 ~Rule() {}; 30 Rule(const Rule&) = delete; 31 Rule& operator=(const Rule&) = delete; 32 void ParseRule(); 33 std::map<std::string, FeatureSet> GetExtractRule(); 34 std::list<std::pair<std::string, std::map<std::string, std::string>>> GetComposeRule(); 35 std::map<std::string, std::vector<std::string>> GetSegStatusCfg(); 36 37 private: 38 std::string eventPath_; 39 std::string analysisConfig_; 40 std::string eventType_; 41 std::map<std::string, FeatureSet> extractRule_; 42 std::list<std::pair<std::string, std::map<std::string, std::string>>> composeRule_; 43 std::map<std::string, std::vector<std::string>> segStatusCfg_; 44 }; 45 } // namespace HiviewDFX 46 } // namespace OHOS 47 #endif /* RULES_H */