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 OBJECT_CALLBACK_IMPL_H
17 #define OBJECT_CALLBACK_IMPL_H
18 
19 #include "object_callback_stub.h"
20 
21 namespace OHOS {
22 namespace ObjectStore {
23 using namespace DistributedObject;
24 class ObjectSaveCallback : public ObjectSaveCallbackStub {
25 public:
26     ObjectSaveCallback(const std::function<void(const std::map<std::string, int32_t> &)> &callback);
27     void Completed(const std::map<std::string, int32_t> &results) override;
28 
29 private:
30     const std::function<void(const std::map<std::string, int32_t> &)> callback_;
31 };
32 
33 class ObjectRevokeSaveCallback : public ObjectRevokeSaveCallbackStub {
34 public:
35     ObjectRevokeSaveCallback(const std::function<void(int32_t)> &callback);
36     void Completed(int32_t) override;
37 
38 private:
39     const std::function<void(int32_t status)> callback_;
40 };
41 
42 class ObjectRetrieveCallback : public ObjectRetrieveCallbackStub {
43 public:
44     ObjectRetrieveCallback(
45         const std::function<void(const std::map<std::string, std::vector<uint8_t>> &, bool)> &callback);
46     void Completed(const std::map<std::string, std::vector<uint8_t>> &results, bool allReady) override;
47 
48 private:
49     const std::function<void(const std::map<std::string, std::vector<uint8_t>> &, bool)> callback_;
50 };
51 
52 class ObjectChangeCallback : public ObjectChangeCallbackStub {
53 public:
54     ObjectChangeCallback(
55         const std::function<void(const std::map<std::string, std::vector<uint8_t>> &, bool)> &callback);
56     void Completed(const std::map<std::string, std::vector<uint8_t>> &results, bool allReady) override;
57 
58 private:
59     const std::function<void(const std::map<std::string, std::vector<uint8_t>> &, bool)> callback_;
60 };
61 } // namespace ObjectStore
62 } // namespace OHOS
63 
64 #endif // OBJECT_CALLBACK_IMPL_H
65