• 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 DISTRIBUTED_OBJECT_IMPL_H
17 #define DISTRIBUTED_OBJECT_IMPL_H
18 #include <string>
19 
20 #include "distributed_object.h"
21 #include "flat_object_store.h"
22 
23 namespace OHOS::ObjectStore {
24 class DistributedObjectImpl : public DistributedObject {
25 public:
26     DistributedObjectImpl(const std::string &sessionId, FlatObjectStore *flatObjectStore);
27     ~DistributedObjectImpl();
28     uint32_t PutDouble(const std::string &key, double value) override;
29     uint32_t PutBoolean(const std::string &key, bool value) override;
30     uint32_t PutString(const std::string &key, const std::string &value) override;
31     uint32_t GetDouble(const std::string &key, double &value) override;
32     uint32_t GetBoolean(const std::string &key, bool &value) override;
33     uint32_t GetString(const std::string &key, std::string &value) override;
34     uint32_t PutComplex(const std::string &key, const std::vector<uint8_t> &value) override;
35     uint32_t GetComplex(const std::string &key, std::vector<uint8_t> &value) override;
36     std::string &GetSessionId() override;
37     uint32_t Save(const std::string &deviceId) override;
38     uint32_t RevokeSave() override;
39     uint32_t GetType(const std::string &key, Type &type) override;
40 
41 private:
42     std::string sessionId_;
43     FlatObjectStore *flatObjectStore_ = nullptr;
44 };
45 } // namespace OHOS::ObjectStore
46 
47 #endif // DISTRIBUTED_OBJECT_IMPL_H
48