100600bfbSopenharmony_ci/*
200600bfbSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
300600bfbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
400600bfbSopenharmony_ci * you may not use this file except in compliance with the License.
500600bfbSopenharmony_ci * You may obtain a copy of the License at
600600bfbSopenharmony_ci *
700600bfbSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
800600bfbSopenharmony_ci *
900600bfbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1000600bfbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1100600bfbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1200600bfbSopenharmony_ci * See the License for the specific language governing permissions and
1300600bfbSopenharmony_ci * limitations under the License.
1400600bfbSopenharmony_ci */
1500600bfbSopenharmony_ci#include "common/dumper_parameter.h"
1600600bfbSopenharmony_ci
1700600bfbSopenharmony_ci#include "hilog_wrapper.h"
1800600bfbSopenharmony_ci#include "securec.h"
1900600bfbSopenharmony_cinamespace OHOS {
2000600bfbSopenharmony_cinamespace HiviewDFX {
2100600bfbSopenharmony_ciDumperParameter::DumperParameter()
2200600bfbSopenharmony_ci{
2300600bfbSopenharmony_ci    DUMPER_HILOGD(MODULE_COMMON, "enter|");
2400600bfbSopenharmony_ci    (void)memset_s(&opts_, sizeof(opts_), 0, sizeof(opts_));
2500600bfbSopenharmony_ci    opts_.Reset();
2600600bfbSopenharmony_ci
2700600bfbSopenharmony_ci    DUMPER_HILOGD(MODULE_COMMON, "leave|");
2800600bfbSopenharmony_ci}
2900600bfbSopenharmony_ci
3000600bfbSopenharmony_ciDumperParameter::~DumperParameter()
3100600bfbSopenharmony_ci{
3200600bfbSopenharmony_ci    DUMPER_HILOGD(MODULE_COMMON, "enter|");
3300600bfbSopenharmony_ci
3400600bfbSopenharmony_ci    opts_.Reset();
3500600bfbSopenharmony_ci
3600600bfbSopenharmony_ci    DUMPER_HILOGD(MODULE_COMMON, "leave|");
3700600bfbSopenharmony_ci}
3800600bfbSopenharmony_ci
3900600bfbSopenharmony_civoid DumperParameter::SetOpts(const DumperOpts &opts)
4000600bfbSopenharmony_ci{
4100600bfbSopenharmony_ci    opts_ = opts;
4200600bfbSopenharmony_ci}
4300600bfbSopenharmony_ci
4400600bfbSopenharmony_ciconst DumperOpts &DumperParameter::GetOpts() const
4500600bfbSopenharmony_ci{
4600600bfbSopenharmony_ci    return opts_;
4700600bfbSopenharmony_ci}
4800600bfbSopenharmony_ci
4900600bfbSopenharmony_civoid DumperParameter::SetOutputFilePath(std::string &path)
5000600bfbSopenharmony_ci{
5100600bfbSopenharmony_ci    opts_.path_ = path;
5200600bfbSopenharmony_ci}
5300600bfbSopenharmony_ci
5400600bfbSopenharmony_cistd::string &DumperParameter::GetOutputFilePath()
5500600bfbSopenharmony_ci{
5600600bfbSopenharmony_ci    return opts_.path_;
5700600bfbSopenharmony_ci}
5800600bfbSopenharmony_ci
5900600bfbSopenharmony_civoid DumperParameter::SetExecutorConfigList(std::vector<std::shared_ptr<DumpCfg>> &list)
6000600bfbSopenharmony_ci{
6100600bfbSopenharmony_ci    list_ = list;
6200600bfbSopenharmony_ci}
6300600bfbSopenharmony_ci
6400600bfbSopenharmony_cistd::vector<std::shared_ptr<DumpCfg>> &DumperParameter::GetExecutorConfigList()
6500600bfbSopenharmony_ci{
6600600bfbSopenharmony_ci    return list_;
6700600bfbSopenharmony_ci}
6800600bfbSopenharmony_ci
6900600bfbSopenharmony_civoid DumperParameter::setClientCallback(const std::shared_ptr<RawParam> &reqCtl)
7000600bfbSopenharmony_ci{
7100600bfbSopenharmony_ci    mPtrReqCtl = reqCtl;
7200600bfbSopenharmony_ci}
7300600bfbSopenharmony_ci
7400600bfbSopenharmony_cistd::shared_ptr<RawParam> DumperParameter::getClientCallback()
7500600bfbSopenharmony_ci{
7600600bfbSopenharmony_ci    return mPtrReqCtl;
7700600bfbSopenharmony_ci}
7800600bfbSopenharmony_ci} // namespace HiviewDFX
7900600bfbSopenharmony_ci} // namespace OHOS
80