• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 DFX_FRAME_FORMAT_H
16 #define DFX_FRAME_FORMAT_H
17 
18 #include <memory>
19 #include <string>
20 #include <vector>
21 #include "dfx_frame.h"
22 
23 namespace OHOS {
24 namespace HiviewDFX {
25 class DfxFrameFormat {
26 public:
27     DfxFrameFormat() = default;
28     ~DfxFrameFormat() = default;
29 
30     /**
31      * @brief Get the Frame Str object
32      *
33      * @param frame native frame object
34      * @return std::string native frame string
35      */
36     static std::string GetFrameStr(const DfxFrame& frame);
37 
38     /**
39      * @brief Get the Frame Str object
40      *
41      * @param frame native frame pointer object
42      * @return std::string native frame string
43      */
44     static std::string GetFrameStr(const std::shared_ptr<DfxFrame>& frame);
45 
46     /**
47      * @brief Get the Frames Str object
48      *
49      * @param frames native frame object list
50      * @return std::string native frames string
51      */
52     static std::string GetFramesStr(const std::vector<DfxFrame>& frames);
53 
54     /**
55      * @brief Get the Frames Str object
56      *
57      * @param frames native frame pointer list
58      * @return std::string native frames string
59      */
60     static std::string GetFramesStr(const std::vector<std::shared_ptr<DfxFrame>>& frames);
61 
62     /**
63      * @brief Convert native frame object lists to native frame pointer list
64      *
65      * @param frames native frame object list
66      * @return std::vector<std::shared_ptr<DfxFrame>> native frame pointer list
67      */
68     static std::vector<std::shared_ptr<DfxFrame>> ConvertFrames(const std::vector<DfxFrame>& frames);
69 };
70 } // namespace HiviewDFX
71 } // namespace OHOS
72 #endif
73