1 /* 2 * Copyright (c) 2024 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 API_CORE_PROPERTY_IPROPERTY_HANDLE_H 17 #define API_CORE_PROPERTY_IPROPERTY_HANDLE_H 18 19 #include <cstddef> 20 21 #include <core/namespace.h> 22 23 CORE_BEGIN_NAMESPACE() 24 class IPropertyApi; 25 26 /** @ingroup group_property_ipropertyhandle */ 27 /** IProperty handle */ 28 class IPropertyHandle { 29 public: 30 /** Return the IPropertyApi implementation used to create the handle. 31 */ 32 virtual const IPropertyApi* Owner() const = 0; 33 34 /** Return size of this handle. 35 */ 36 virtual size_t Size() const = 0; 37 38 /** Return a read-only data of this handle. 39 */ 40 virtual const void* RLock() const = 0; 41 42 /** Release the read lock 43 */ 44 virtual void RUnlock() const = 0; 45 46 /** Return a modifiable data of this handle. 47 */ 48 virtual void* WLock() = 0; 49 50 /** Release the write lock 51 */ 52 virtual void WUnlock() = 0; 53 54 protected: 55 IPropertyHandle() = default; 56 IPropertyHandle(const IPropertyHandle&) = delete; 57 IPropertyHandle(IPropertyHandle&&) = delete; 58 IPropertyHandle& operator=(const IPropertyHandle&) = delete; 59 virtual ~IPropertyHandle() = default; 60 }; 61 CORE_END_NAMESPACE() 62 #endif // API_CORE_PROPERTY_IPROPERTY_HANDLE_H 63