Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / platform / qpg6100 / KeyValueStoreManagerImpl.h
1 /*
2  *
3  *    Copyright (c) 2021 Project CHIP Authors
4  *    All rights reserved.
5  *
6  *    Licensed under the Apache License, Version 2.0 (the "License");
7  *    you may not use this file except in compliance with the License.
8  *    You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *    Unless required by applicable law or agreed to in writing, software
13  *    distributed under the License is distributed on an "AS IS" BASIS,
14  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *    See the License for the specific language governing permissions and
16  *    limitations under the License.
17  */
18
19 /**
20  *    @file
21  *          Platform-specific key value storage implementation for QPG6100.
22  */
23
24 #pragma once
25
26 namespace chip {
27 namespace DeviceLayer {
28 namespace PersistedStorage {
29
30 class KeyValueStoreManagerImpl final : public KeyValueStoreManager
31 {
32     // Allow the KeyValueStoreManager interface class to delegate method calls to
33     // the implementation methods provided by this class.
34     friend class KeyValueStoreManager;
35
36 public:
37     // NOTE: Currently this platform does not support partial and offset reads
38     //       these will return CHIP_ERROR_NOT_IMPLEMENTED.
39     CHIP_ERROR _Get(const char * key, void * value, size_t value_size, size_t * read_bytes_size = nullptr, size_t offset = 0)
40     {
41         return CHIP_ERROR_NOT_IMPLEMENTED;
42     }
43
44     CHIP_ERROR _Delete(const char * key) { return CHIP_ERROR_NOT_IMPLEMENTED; }
45
46     CHIP_ERROR _Put(const char * key, const void * value, size_t value_size) { return CHIP_ERROR_NOT_IMPLEMENTED; }
47
48 private:
49     // ===== Members for internal use by the following friends.
50     friend KeyValueStoreManager & KeyValueStoreMgr();
51     friend KeyValueStoreManagerImpl & KeyValueStoreMgrImpl();
52
53     static KeyValueStoreManagerImpl sInstance;
54 };
55
56 /**
57  * Returns the public interface of the KeyValueStoreManager singleton object.
58  *
59  * Chip applications should use this to access features of the KeyValueStoreManager object
60  * that are common to all platforms.
61  */
62 inline KeyValueStoreManager & KeyValueStoreMgr(void)
63 {
64     return KeyValueStoreManagerImpl::sInstance;
65 }
66
67 /**
68  * Returns the platform-specific implementation of the KeyValueStoreManager singleton object.
69  *
70  * Chip applications can use this to gain access to features of the KeyValueStoreManager
71  * that are specific to the ESP32 platform.
72  */
73 inline KeyValueStoreManagerImpl & KeyValueStoreMgrImpl(void)
74 {
75     return KeyValueStoreManagerImpl::sInstance;
76 }
77
78 } // namespace PersistedStorage
79 } // namespace DeviceLayer
80 } // namespace chip