1 /*
2  * Copyright (c) 2023 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 HISYSEVENT_RECORD_CONVERTOR_H
17 #define HISYSEVENT_RECORD_CONVERTOR_H
18 
19 #include "hisysevent_record.h"
20 #include "hisysevent_record_c.h"
21 
22 namespace OHOS {
23 namespace HiviewDFX {
24 using HiSysEventRecordCls = OHOS::HiviewDFX::HiSysEventRecord;
25 
26 class HiSysEventRecordConvertor {
27 public:
28     static void InitRecord(HiSysEventRecordC& record);
29     static void DeleteRecord(HiSysEventRecordC& record);
30     static void DeleteRecords(HiSysEventRecordC** records, size_t len);
31     static int ConvertRecord(const HiSysEventRecordCls& recordObj, HiSysEventRecordC& recordStruct);
32 
33 private:
34     static int ConvertDomain(const HiSysEventRecordCls& recordObj, HiSysEventRecordC& recordStruct);
35     static int ConvertEventName(const HiSysEventRecordCls& recordObj, HiSysEventRecordC& recordStruct);
36     static int ConvertTimeZone(const HiSysEventRecordCls& recordObj, HiSysEventRecordC& recordStruct);
37     static int ConvertLevel(const HiSysEventRecordCls& recordObj, HiSysEventRecordC& recordStruct);
38     static int ConvertTag(const HiSysEventRecordCls& recordObj, HiSysEventRecordC& recordStruct);
39     static int ConvertJsonStr(const HiSysEventRecordCls& recordObj, HiSysEventRecordC& recordStruct);
40 };
41 
42 }
43 }
44 
45 #endif // HISYSEVENT_RECORD_CONVERTOR_H