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 HIDUMPER_SERVICES_DUMPER_PARAMETER_H 16 #define HIDUMPER_SERVICES_DUMPER_PARAMETER_H 17 #include <mutex> 18 #include <queue> 19 #include <vector> 20 #include "raw_param.h" 21 #include "common/dumper_constant.h" 22 #include "common/dump_cfg.h" 23 #include "common/dumper_opts.h" 24 namespace OHOS { 25 namespace HiviewDFX { 26 class DumperParameter { 27 public: 28 DumperParameter(); 29 ~DumperParameter(); 30 public: 31 void SetOpts(const DumperOpts &opts); 32 const DumperOpts &GetOpts() const; 33 // set output file path 34 void SetOutputFilePath(std::string& path); 35 // get output file path 36 std::string& GetOutputFilePath(); 37 // set config list 38 void SetExecutorConfigList(std::vector<std::shared_ptr<DumpCfg>>& list); 39 // get config list 40 std::vector<std::shared_ptr<DumpCfg>>& GetExecutorConfigList(); 41 // set client callback 42 void setClientCallback(const std::shared_ptr<RawParam>& reqCtl); 43 // get client callback 44 std::shared_ptr<RawParam> getClientCallback(); 45 // set IPC flag 46 // check IPC flag SetUid(int uid)47 void SetUid(int uid) 48 { 49 uid_ = uid; 50 } GetUid()51 int GetUid() const 52 { 53 return uid_; 54 } SetPid(int pid)55 void SetPid(int pid) 56 { 57 pid_ = pid; 58 } GetPid()59 int GetPid() const 60 { 61 return pid_; 62 }; 63 void Dump() const; 64 private: 65 int uid_ {-1}; 66 int pid_ {-1}; 67 DumperOpts opts_; 68 std::vector<std::shared_ptr<DumpCfg>> list_; // list 69 std::shared_ptr<RawParam> mPtrReqCtl; 70 }; 71 } // namespace HiviewDFX 72 } // namespace OHOS 73 #endif // HIDUMPER_SERVICES_DUMPER_PARAMETER_H 74