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 #include "common/dumper_parameter.h"
16
17 #include "hilog_wrapper.h"
18 #include "securec.h"
19 namespace OHOS {
20 namespace HiviewDFX {
DumperParameter()21 DumperParameter::DumperParameter()
22 {
23 DUMPER_HILOGD(MODULE_COMMON, "enter|");
24 (void)memset_s(&opts_, sizeof(opts_), 0, sizeof(opts_));
25 opts_.Reset();
26
27 DUMPER_HILOGD(MODULE_COMMON, "leave|");
28 }
29
~DumperParameter()30 DumperParameter::~DumperParameter()
31 {
32 DUMPER_HILOGD(MODULE_COMMON, "enter|");
33
34 opts_.Reset();
35
36 DUMPER_HILOGD(MODULE_COMMON, "leave|");
37 }
38
SetOpts(const DumperOpts & opts)39 void DumperParameter::SetOpts(const DumperOpts &opts)
40 {
41 opts_ = opts;
42 }
43
GetOpts() const44 const DumperOpts &DumperParameter::GetOpts() const
45 {
46 return opts_;
47 }
48
SetOutputFilePath(std::string & path)49 void DumperParameter::SetOutputFilePath(std::string &path)
50 {
51 opts_.path_ = path;
52 }
53
GetOutputFilePath()54 std::string &DumperParameter::GetOutputFilePath()
55 {
56 return opts_.path_;
57 }
58
SetExecutorConfigList(std::vector<std::shared_ptr<DumpCfg>> & list)59 void DumperParameter::SetExecutorConfigList(std::vector<std::shared_ptr<DumpCfg>> &list)
60 {
61 list_ = list;
62 }
63
GetExecutorConfigList()64 std::vector<std::shared_ptr<DumpCfg>> &DumperParameter::GetExecutorConfigList()
65 {
66 return list_;
67 }
68
setClientCallback(const std::shared_ptr<RawParam> & reqCtl)69 void DumperParameter::setClientCallback(const std::shared_ptr<RawParam> &reqCtl)
70 {
71 mPtrReqCtl = reqCtl;
72 }
73
getClientCallback()74 std::shared_ptr<RawParam> DumperParameter::getClientCallback()
75 {
76 return mPtrReqCtl;
77 }
78
Dump() const79 void DumperParameter::Dump() const
80 {
81 opts_.Dump();
82 }
83 } // namespace HiviewDFX
84 } // namespace OHOS
85