• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 OHOS_DISTRIBUTED_DATA_FRAMEWORKS_KVDB_KV_TYPES_UTIL_H
17 #define OHOS_DISTRIBUTED_DATA_FRAMEWORKS_KVDB_KV_TYPES_UTIL_H
18 #include "change_notification.h"
19 #include "kvdb_service.h"
20 #include "itypes_util.h"
21 #include "types.h"
22 namespace OHOS::ITypesUtil {
23 using Blob = DistributedKv::Blob;
24 using Key = DistributedKv::Key;
25 using Value = DistributedKv::Value;
26 using Entry = DistributedKv::Entry;
27 using AppId = DistributedKv::AppId;
28 using StoreId = DistributedKv::StoreId;
29 using DeviceInfo = DistributedKv::DeviceInfo;
30 using ChangeNotification = DistributedKv::ChangeNotification;
31 using Options = DistributedKv::Options;
32 using SyncPolicy = DistributedKv::SyncPolicy;
33 using DevBrief = DistributedKv::KVDBService::DevBrief;
34 template<>
35 API_EXPORT bool Marshalling(const Blob &input, MessageParcel &data);
36 template<>
37 API_EXPORT bool Unmarshalling(Blob &output, MessageParcel &data);
38 
39 template<>
40 API_EXPORT bool Marshalling(const AppId &input, MessageParcel &data);
41 template<>
42 API_EXPORT bool Unmarshalling(AppId &output, MessageParcel &data);
43 
44 template<>
45 API_EXPORT bool Marshalling(const StoreId &input, MessageParcel &data);
46 template<>
47 API_EXPORT bool Unmarshalling(StoreId &output, MessageParcel &data);
48 
49 template<>
50 API_EXPORT bool Marshalling(const Entry &input, MessageParcel &data);
51 template<>
52 API_EXPORT bool Unmarshalling(Entry &output, MessageParcel &data);
53 
54 template<>
55 API_EXPORT bool Marshalling(const DeviceInfo &input, MessageParcel &data);
56 template<>
57 API_EXPORT bool Unmarshalling(DeviceInfo &output, MessageParcel &data);
58 
59 template<>
60 API_EXPORT bool Marshalling(const ChangeNotification &notification, MessageParcel &parcel);
61 template<>
62 API_EXPORT bool Unmarshalling(ChangeNotification &output, MessageParcel &parcel);
63 
64 template<>
65 API_EXPORT bool Marshalling(const Options &input, MessageParcel &data);
66 template<>
67 API_EXPORT bool Unmarshalling(Options &output, MessageParcel &data);
68 
69 template<>
70 API_EXPORT bool Marshalling(const SyncPolicy &input, MessageParcel &data);
71 template<>
72 API_EXPORT bool Unmarshalling(SyncPolicy &output, MessageParcel &data);
73 
74 template<>
75 API_EXPORT bool Marshalling(const DevBrief &input, MessageParcel &data);
76 template<>
77 API_EXPORT bool Unmarshalling(DevBrief &output, MessageParcel &data);
78 
79 int64_t GetTotalSize(const std::vector<Entry> &entries);
80 int64_t GetTotalSize(const std::vector<Key> &entries);
81 } // namespace OHOS::ITypesUtil
82 #endif // OHOS_DISTRIBUTED_DATA_FRAMEWORKS_KVDB_KV_TYPES_UTIL_H
83