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