• 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 SMART_PARSER_SEGMENT_H
16 #define SMART_PARSER_SEGMENT_H
17 #include <map>
18 #include <string>
19 #include <vector>
20 namespace OHOS {
21 namespace HiviewDFX {
22 namespace {
23 static const std::string SEGMENT_ID = "v_id";
24 static const std::string SEGMENT_NAME = "v_name";
25 static const std::string SEGMENT_SYSTID = "v_sysTid";
26 static const std::string SEGMENT_PARENT_NAME = "parentName";
27 }
28 // describe a segment in log file
29 class Segment {
30 public:
Segment()31     Segment() {}
~Segment()32     ~Segment() {}
33     Segment(const Segment&) = delete;
34     Segment& operator=(const Segment&) = delete;
35     Segment(Segment&&) = delete;
36     Segment& operator=(Segment&&) = delete;
37     int GetId(void) const;
38     int GetSysTid(void) const;
39     const std::string GetName(void) const;
40     void SetValue(const std::string& name, const std::string& value);
41     const std::string GetValue(const std::string& name) const;
42     const std::string GetFullName(void) const;
43     const std::string GetDesc(const std::map<std::string, std::vector<std::string>>& segStatusCfg) const;
44 
45 private:
46     std::map<std::string, std::string> bundle_;
47 };
48 } // namespace HiviewDFX
49 } // namespace OHOS
50 #endif /* SMART_PARSER_SEGMENT_H */
51