• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_(std::move(eventPath)), analysisConfig_(std::move(analysisConfig)),
29         eventType_(std::move(eventType)) {};
30     ~Rule() = default;
31     Rule(const Rule&) = delete;
32     Rule& operator=(const Rule&) = delete;
33     void ParseRule();
34     const std::map<std::string, FeatureSet>& GetExtractRule();
35     const std::list<std::pair<std::string, std::map<std::string, std::string>>>& GetComposeRule();
36     const std::map<std::string, std::vector<std::string>>& GetSegStatusCfg();
37 
38 private:
39     std::string eventPath_;
40     std::string analysisConfig_;
41     std::string eventType_;
42     std::map<std::string, FeatureSet> extractRule_;
43     std::list<std::pair<std::string, std::map<std::string, std::string>>> composeRule_;
44     std::map<std::string, std::vector<std::string>> segStatusCfg_;
45 };
46 } // namespace HiviewDFX
47 } // namespace OHOS
48 #endif /* RULES_H */
49