1 /*
2  * Copyright (c) 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 
16 #ifndef HIVIEWDFX_CAUTION_H
17 #define HIVIEWDFX_CAUTION_H
18 
19 #include <string>
20 
21 namespace OHOS {
22 namespace HiviewDFX {
23 class Caution {
24 public:
Caution()25     Caution() : triggerRule_(0ULL) {}
Caution(uint64_t triggerRule,const std::string & cautionMsg)26     Caution(uint64_t triggerRule, const std::string& cautionMsg): triggerRule_(triggerRule),
27         cautionMsg_(cautionMsg) {}
Caution(uint64_t triggerRule,const std::string & cautionMsg,const std::string & stackTrace)28     Caution(uint64_t triggerRule, const std::string& cautionMsg, const std::string& stackTrace)
29         : triggerRule_(triggerRule), cautionMsg_(cautionMsg), stackTrace_(stackTrace) {}
~Caution()30     ~Caution() {}
31     Caution(const Caution&) = default;
32     Caution& operator = (Caution&) = default;
33     void SetTriggerRule(uint64_t rule);
34     void SetCautionMsg(const std::string& cautionMsg);
35     void SetStackTrace(const std::string& stackTrace);
36     uint64_t GetTriggerRule() const;
37     std::string GetCautionMsg() const;
38     std::string GetStackTrace() const;
39 private:
40     uint64_t triggerRule_;
41     std::string cautionMsg_;
42     std::string stackTrace_;
43 };
44 } // HiviewDFX
45 } // OHOS
46 #endif // HIVIEWDFX_CAUTION_H