18bf80f4bSopenharmony_ci/* 28bf80f4bSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 38bf80f4bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 48bf80f4bSopenharmony_ci * you may not use this file except in compliance with the License. 58bf80f4bSopenharmony_ci * You may obtain a copy of the License at 68bf80f4bSopenharmony_ci * 78bf80f4bSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 88bf80f4bSopenharmony_ci * 98bf80f4bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 108bf80f4bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 118bf80f4bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 128bf80f4bSopenharmony_ci * See the License for the specific language governing permissions and 138bf80f4bSopenharmony_ci * limitations under the License. 148bf80f4bSopenharmony_ci */ 158bf80f4bSopenharmony_ci 168bf80f4bSopenharmony_ci#include "PropertyTools/property_data.h" 178bf80f4bSopenharmony_ci 188bf80f4bSopenharmony_ci#include <PropertyTools/property_value.h> 198bf80f4bSopenharmony_ci#include <algorithm> 208bf80f4bSopenharmony_ci#include <climits> 218bf80f4bSopenharmony_ci#include <cstdlib> 228bf80f4bSopenharmony_ci 238bf80f4bSopenharmony_ci#include <base/containers/array_view.h> 248bf80f4bSopenharmony_ci#include <base/containers/iterator.h> 258bf80f4bSopenharmony_ci#include <base/containers/string.h> 268bf80f4bSopenharmony_ci#include <base/containers/string_view.h> 278bf80f4bSopenharmony_ci#include <base/util/compile_time_hashes.h> 288bf80f4bSopenharmony_ci#include <core/log.h> 298bf80f4bSopenharmony_ci#include <core/property/intf_property_api.h> 308bf80f4bSopenharmony_ci#include <core/property/intf_property_handle.h> 318bf80f4bSopenharmony_ci#include <core/property/property.h> 328bf80f4bSopenharmony_ci 338bf80f4bSopenharmony_ciusing namespace CORE_NS; 348bf80f4bSopenharmony_ciusing BASE_NS::array_view; 358bf80f4bSopenharmony_ciusing BASE_NS::FNV1aHash; 368bf80f4bSopenharmony_ciusing BASE_NS::string; 378bf80f4bSopenharmony_ciusing BASE_NS::string_view; 388bf80f4bSopenharmony_ci 398bf80f4bSopenharmony_cinamespace { 408bf80f4bSopenharmony_cibool ParseIndex(const string_view name, const uintptr_t baseOffset, const Property& property, 418bf80f4bSopenharmony_ci array_view<const Property>& properties, size_t& pos, PropertyData::PropertyOffset& ret) 428bf80f4bSopenharmony_ci{ 438bf80f4bSopenharmony_ci // there needs to be at least three characters to be a valid array index. the propery must also be an 448bf80f4bSopenharmony_ci // array. 458bf80f4bSopenharmony_ci if (((name.size() - pos) < 3U) || !property.metaData.containerMethods) { // 3: min length e.g. [0] 468bf80f4bSopenharmony_ci ret = {}; 478bf80f4bSopenharmony_ci return false; 488bf80f4bSopenharmony_ci } 498bf80f4bSopenharmony_ci ret.propertyPath = name.substr(0, pos); 508bf80f4bSopenharmony_ci ++pos; 518bf80f4bSopenharmony_ci 528bf80f4bSopenharmony_ci const char* start = name.substr(pos).data(); 538bf80f4bSopenharmony_ci char* end = nullptr; 548bf80f4bSopenharmony_ci const unsigned long index = strtoul(start, &end, 10); // 10: base 558bf80f4bSopenharmony_ci // check that conversion stopped at the closing square bracket 568bf80f4bSopenharmony_ci if (!end || *end != ']') { 578bf80f4bSopenharmony_ci ret = {}; 588bf80f4bSopenharmony_ci return false; 598bf80f4bSopenharmony_ci } 608bf80f4bSopenharmony_ci // move past the closing square bracket and store the path so far 618bf80f4bSopenharmony_ci pos = static_cast<size_t>(end - name.data()) + 1U; 628bf80f4bSopenharmony_ci ret.propertyPath = name.substr(0, pos); 638bf80f4bSopenharmony_ci 648bf80f4bSopenharmony_ci auto* containerMethods = property.metaData.containerMethods; 658bf80f4bSopenharmony_ci 668bf80f4bSopenharmony_ci // calculate offset to the index. for arrays a direct offset, but for containers need to get the addess 678bf80f4bSopenharmony_ci // inside the container and compensate the base and member offsets. 688bf80f4bSopenharmony_ci ptrdiff_t offset = PTRDIFF_MAX; 698bf80f4bSopenharmony_ci if (property.type.isArray && (index < property.count)) { 708bf80f4bSopenharmony_ci offset = static_cast<ptrdiff_t>(index * containerMethods->property.size); 718bf80f4bSopenharmony_ci } else if (!property.type.isArray && baseOffset) { 728bf80f4bSopenharmony_ci if (index < containerMethods->size(property.offset + baseOffset)) { 738bf80f4bSopenharmony_ci offset = static_cast<ptrdiff_t>( 748bf80f4bSopenharmony_ci containerMethods->get(property.offset + baseOffset, index) - baseOffset - ret.offset); 758bf80f4bSopenharmony_ci } 768bf80f4bSopenharmony_ci } 778bf80f4bSopenharmony_ci 788bf80f4bSopenharmony_ci if (offset != PTRDIFF_MAX) { 798bf80f4bSopenharmony_ci ret.property = &containerMethods->property; 808bf80f4bSopenharmony_ci ret.offset = static_cast<uintptr_t>(static_cast<ptrdiff_t>(ret.offset) + offset); 818bf80f4bSopenharmony_ci ret.index = index; 828bf80f4bSopenharmony_ci 838bf80f4bSopenharmony_ci if (pos < name.size() && name[pos] == '.') { 848bf80f4bSopenharmony_ci ++pos; 858bf80f4bSopenharmony_ci // continue search from the member properties. 868bf80f4bSopenharmony_ci properties = containerMethods->property.metaData.memberProperties; 878bf80f4bSopenharmony_ci } 888bf80f4bSopenharmony_ci } else { 898bf80f4bSopenharmony_ci ret = {}; 908bf80f4bSopenharmony_ci return false; 918bf80f4bSopenharmony_ci } 928bf80f4bSopenharmony_ci return true; 938bf80f4bSopenharmony_ci} 948bf80f4bSopenharmony_ci 958bf80f4bSopenharmony_ciPropertyData::PropertyOffset FindProperty( 968bf80f4bSopenharmony_ci array_view<const Property> properties, const string_view name, const uintptr_t baseOffset) 978bf80f4bSopenharmony_ci{ 988bf80f4bSopenharmony_ci PropertyData::PropertyOffset ret { nullptr, 0U, 0U, {} }; 998bf80f4bSopenharmony_ci 1008bf80f4bSopenharmony_ci // trim down to name without array index or member variable. 1018bf80f4bSopenharmony_ci constexpr const string_view delimiters = ".["; 1028bf80f4bSopenharmony_ci 1038bf80f4bSopenharmony_ci size_t pos = 0U; 1048bf80f4bSopenharmony_ci while (pos < name.size()) { 1058bf80f4bSopenharmony_ci const auto delimPos = name.find_first_of(delimiters, pos); 1068bf80f4bSopenharmony_ci auto baseName = name.substr(pos, delimPos - pos); 1078bf80f4bSopenharmony_ci pos = delimPos; 1088bf80f4bSopenharmony_ci if (baseName.empty()) { 1098bf80f4bSopenharmony_ci ret = {}; 1108bf80f4bSopenharmony_ci break; 1118bf80f4bSopenharmony_ci } 1128bf80f4bSopenharmony_ci 1138bf80f4bSopenharmony_ci auto property = std::find_if( 1148bf80f4bSopenharmony_ci properties.cbegin(), properties.cend(), [baseName](const Property& p) { return p.name == baseName; }); 1158bf80f4bSopenharmony_ci if (property != properties.cend()) { 1168bf80f4bSopenharmony_ci // remember what property this was 1178bf80f4bSopenharmony_ci ret.property = &*property; 1188bf80f4bSopenharmony_ci ret.offset += property->offset; 1198bf80f4bSopenharmony_ci ret.index = static_cast<size_t>(std::distance(properties.cbegin(), property)); 1208bf80f4bSopenharmony_ci 1218bf80f4bSopenharmony_ci // if we have only a name we are done 1228bf80f4bSopenharmony_ci if (pos == string_view::npos) { 1238bf80f4bSopenharmony_ci ret.propertyPath = name; 1248bf80f4bSopenharmony_ci } else if (name[pos] == '.') { 1258bf80f4bSopenharmony_ci // there needs to be at least one character to be a valid name. 1268bf80f4bSopenharmony_ci if ((name.size() - pos) < 2U) { 1278bf80f4bSopenharmony_ci ret = {}; 1288bf80f4bSopenharmony_ci break; 1298bf80f4bSopenharmony_ci } 1308bf80f4bSopenharmony_ci ret.propertyPath = name.substr(0, pos); 1318bf80f4bSopenharmony_ci ++pos; 1328bf80f4bSopenharmony_ci // continue search from the member properties. 1338bf80f4bSopenharmony_ci properties = property->metaData.memberProperties; 1348bf80f4bSopenharmony_ci } else if (name[pos] == '[') { 1358bf80f4bSopenharmony_ci if (!ParseIndex(name, baseOffset, *property, properties, pos, ret)) { 1368bf80f4bSopenharmony_ci break; 1378bf80f4bSopenharmony_ci } 1388bf80f4bSopenharmony_ci } 1398bf80f4bSopenharmony_ci } else if (!properties.empty()) { 1408bf80f4bSopenharmony_ci ret = {}; 1418bf80f4bSopenharmony_ci break; 1428bf80f4bSopenharmony_ci } else { 1438bf80f4bSopenharmony_ci break; 1448bf80f4bSopenharmony_ci } 1458bf80f4bSopenharmony_ci } 1468bf80f4bSopenharmony_ci return ret; 1478bf80f4bSopenharmony_ci} 1488bf80f4bSopenharmony_ci} // namespace 1498bf80f4bSopenharmony_ci 1508bf80f4bSopenharmony_ciPropertyData::PropertyData() 1518bf80f4bSopenharmony_ci{ 1528bf80f4bSopenharmony_ci Reset(); 1538bf80f4bSopenharmony_ci} 1548bf80f4bSopenharmony_ci 1558bf80f4bSopenharmony_cibool PropertyData::WLock(IPropertyHandle& handle) // no-copy direct-access (Locks the datahandle); 1568bf80f4bSopenharmony_ci{ 1578bf80f4bSopenharmony_ci CORE_ASSERT(dataHandle_ == nullptr); 1588bf80f4bSopenharmony_ci CORE_ASSERT(dataHandleW_ == nullptr); 1598bf80f4bSopenharmony_ci dataHandleW_ = &handle; 1608bf80f4bSopenharmony_ci dataHandle_ = dataHandleW_; 1618bf80f4bSopenharmony_ci owner_ = dataHandleW_->Owner(); 1628bf80f4bSopenharmony_ci size_ = dataHandleW_->Size(); 1638bf80f4bSopenharmony_ci dataW_ = static_cast<uint8_t*>(dataHandleW_->WLock()); 1648bf80f4bSopenharmony_ci data_ = dataW_; 1658bf80f4bSopenharmony_ci return true; 1668bf80f4bSopenharmony_ci} 1678bf80f4bSopenharmony_ci 1688bf80f4bSopenharmony_ciPropertyData::PropertyOffset PropertyData::WLock(IPropertyHandle& handle, const string_view propertyPath) 1698bf80f4bSopenharmony_ci{ 1708bf80f4bSopenharmony_ci if (WLock(handle)) { 1718bf80f4bSopenharmony_ci const uintptr_t baseOffset = reinterpret_cast<uintptr_t>(dataW_); 1728bf80f4bSopenharmony_ci if (auto po = FindProperty(Owner()->MetaData(), propertyPath, baseOffset); po) { 1738bf80f4bSopenharmony_ci return po; 1748bf80f4bSopenharmony_ci } 1758bf80f4bSopenharmony_ci } 1768bf80f4bSopenharmony_ci WUnlock(handle); 1778bf80f4bSopenharmony_ci return { nullptr, 0U, 0U, {} }; 1788bf80f4bSopenharmony_ci} 1798bf80f4bSopenharmony_ci 1808bf80f4bSopenharmony_cibool PropertyData::WUnlock(const IPropertyHandle& handle) // (releases the datahandle lock, and removes ref) 1818bf80f4bSopenharmony_ci{ 1828bf80f4bSopenharmony_ci CORE_ASSERT(dataHandleW_); 1838bf80f4bSopenharmony_ci CORE_ASSERT(dataHandleW_ == dataHandle_); 1848bf80f4bSopenharmony_ci CORE_ASSERT(dataHandleW_ == &handle); 1858bf80f4bSopenharmony_ci if (dataHandleW_ == &handle) { 1868bf80f4bSopenharmony_ci if (dataHandleW_) { 1878bf80f4bSopenharmony_ci dataHandleW_->WUnlock(); 1888bf80f4bSopenharmony_ci Reset(); 1898bf80f4bSopenharmony_ci } 1908bf80f4bSopenharmony_ci return true; 1918bf80f4bSopenharmony_ci } 1928bf80f4bSopenharmony_ci return false; 1938bf80f4bSopenharmony_ci} 1948bf80f4bSopenharmony_ci 1958bf80f4bSopenharmony_cibool PropertyData::RLock(const IPropertyHandle& handle) // no-copy direct-access (Locks the datahandle); 1968bf80f4bSopenharmony_ci{ 1978bf80f4bSopenharmony_ci CORE_ASSERT(dataHandle_ == nullptr); 1988bf80f4bSopenharmony_ci CORE_ASSERT(dataHandleW_ == nullptr); 1998bf80f4bSopenharmony_ci dataHandleW_ = nullptr; 2008bf80f4bSopenharmony_ci dataHandle_ = &handle; 2018bf80f4bSopenharmony_ci owner_ = dataHandle_->Owner(); 2028bf80f4bSopenharmony_ci size_ = dataHandle_->Size(); 2038bf80f4bSopenharmony_ci data_ = dataHandle_->RLock(); 2048bf80f4bSopenharmony_ci dataW_ = nullptr; 2058bf80f4bSopenharmony_ci return true; 2068bf80f4bSopenharmony_ci} 2078bf80f4bSopenharmony_ci 2088bf80f4bSopenharmony_ciPropertyData::PropertyOffset PropertyData::RLock(const IPropertyHandle& handle, const string_view propertyPath) 2098bf80f4bSopenharmony_ci{ 2108bf80f4bSopenharmony_ci if (RLock(handle)) { 2118bf80f4bSopenharmony_ci const uintptr_t baseOffset = reinterpret_cast<uintptr_t>(data_); 2128bf80f4bSopenharmony_ci if (auto po = FindProperty(Owner()->MetaData(), propertyPath, baseOffset); po) { 2138bf80f4bSopenharmony_ci return po; 2148bf80f4bSopenharmony_ci } 2158bf80f4bSopenharmony_ci } 2168bf80f4bSopenharmony_ci RUnlock(handle); 2178bf80f4bSopenharmony_ci return { nullptr, 0U, 0U, {} }; 2188bf80f4bSopenharmony_ci} 2198bf80f4bSopenharmony_ci 2208bf80f4bSopenharmony_cibool PropertyData::RUnlock(const IPropertyHandle& handle) // (releases the datahandle lock, and removes ref) 2218bf80f4bSopenharmony_ci{ 2228bf80f4bSopenharmony_ci CORE_ASSERT(dataHandle_); 2238bf80f4bSopenharmony_ci CORE_ASSERT(dataHandleW_ == nullptr); 2248bf80f4bSopenharmony_ci CORE_ASSERT(dataHandle_ == &handle); 2258bf80f4bSopenharmony_ci if (dataHandle_ == &handle) { 2268bf80f4bSopenharmony_ci if (dataHandle_) { 2278bf80f4bSopenharmony_ci dataHandle_->RUnlock(); 2288bf80f4bSopenharmony_ci Reset(); 2298bf80f4bSopenharmony_ci } 2308bf80f4bSopenharmony_ci return true; 2318bf80f4bSopenharmony_ci } 2328bf80f4bSopenharmony_ci return false; 2338bf80f4bSopenharmony_ci} 2348bf80f4bSopenharmony_ci 2358bf80f4bSopenharmony_ciPropertyData::PropertyOffset PropertyData::FindProperty( 2368bf80f4bSopenharmony_ci const array_view<const Property> properties, const string_view propertyPath, const uintptr_t baseOffset) 2378bf80f4bSopenharmony_ci{ 2388bf80f4bSopenharmony_ci PropertyData::PropertyOffset offset = ::FindProperty(properties, propertyPath, baseOffset); 2398bf80f4bSopenharmony_ci if (offset) { 2408bf80f4bSopenharmony_ci offset.offset += baseOffset; 2418bf80f4bSopenharmony_ci } 2428bf80f4bSopenharmony_ci return offset; 2438bf80f4bSopenharmony_ci} 2448bf80f4bSopenharmony_ci 2458bf80f4bSopenharmony_ciPropertyData::PropertyOffset PropertyData::FindProperty( 2468bf80f4bSopenharmony_ci const array_view<const Property> properties, const string_view propertyPath) 2478bf80f4bSopenharmony_ci{ 2488bf80f4bSopenharmony_ci return ::FindProperty(properties, propertyPath, 0U); 2498bf80f4bSopenharmony_ci} 2508bf80f4bSopenharmony_ci 2518bf80f4bSopenharmony_ciPropertyData::~PropertyData() 2528bf80f4bSopenharmony_ci{ 2538bf80f4bSopenharmony_ci if (dataHandleW_) { 2548bf80f4bSopenharmony_ci WUnlock(*dataHandleW_); 2558bf80f4bSopenharmony_ci } 2568bf80f4bSopenharmony_ci if (dataHandle_) { 2578bf80f4bSopenharmony_ci RUnlock(*dataHandle_); 2588bf80f4bSopenharmony_ci } 2598bf80f4bSopenharmony_ci} 2608bf80f4bSopenharmony_ci 2618bf80f4bSopenharmony_civoid PropertyData::Reset() 2628bf80f4bSopenharmony_ci{ 2638bf80f4bSopenharmony_ci size_ = 0; 2648bf80f4bSopenharmony_ci data_ = nullptr; 2658bf80f4bSopenharmony_ci dataW_ = nullptr; 2668bf80f4bSopenharmony_ci owner_ = nullptr; 2678bf80f4bSopenharmony_ci dataHandle_ = nullptr; 2688bf80f4bSopenharmony_ci dataHandleW_ = nullptr; 2698bf80f4bSopenharmony_ci} 2708bf80f4bSopenharmony_ci 2718bf80f4bSopenharmony_ciarray_view<const Property> PropertyData::MetaData() const 2728bf80f4bSopenharmony_ci{ 2738bf80f4bSopenharmony_ci if (owner_) { 2748bf80f4bSopenharmony_ci return owner_->MetaData(); 2758bf80f4bSopenharmony_ci } 2768bf80f4bSopenharmony_ci return {}; 2778bf80f4bSopenharmony_ci} 2788bf80f4bSopenharmony_ci 2798bf80f4bSopenharmony_ciconst Property* PropertyData::MetaData(size_t index) const 2808bf80f4bSopenharmony_ci{ 2818bf80f4bSopenharmony_ci if (owner_) { 2828bf80f4bSopenharmony_ci const auto& meta = owner_->MetaData(); 2838bf80f4bSopenharmony_ci if (index < meta.size()) { 2848bf80f4bSopenharmony_ci return &meta[index]; 2858bf80f4bSopenharmony_ci } 2868bf80f4bSopenharmony_ci } 2878bf80f4bSopenharmony_ci return nullptr; 2888bf80f4bSopenharmony_ci} 2898bf80f4bSopenharmony_ci 2908bf80f4bSopenharmony_ciPropertyValue PropertyData::Get(size_t index) 2918bf80f4bSopenharmony_ci{ 2928bf80f4bSopenharmony_ci if (owner_ && dataW_) { 2938bf80f4bSopenharmony_ci const auto& props = owner_->MetaData(); 2948bf80f4bSopenharmony_ci if (index < props.size()) { 2958bf80f4bSopenharmony_ci const auto& meta = props[index]; 2968bf80f4bSopenharmony_ci return PropertyValue(&meta, static_cast<void*>(dataW_ + meta.offset), meta.count); 2978bf80f4bSopenharmony_ci } 2988bf80f4bSopenharmony_ci } 2998bf80f4bSopenharmony_ci return PropertyValue(); 3008bf80f4bSopenharmony_ci} 3018bf80f4bSopenharmony_ci 3028bf80f4bSopenharmony_ciPropertyValue PropertyData::Get(size_t index) const 3038bf80f4bSopenharmony_ci{ 3048bf80f4bSopenharmony_ci if (owner_ && data_) { 3058bf80f4bSopenharmony_ci const auto& props = owner_->MetaData(); 3068bf80f4bSopenharmony_ci if (index < props.size()) { 3078bf80f4bSopenharmony_ci const auto& meta = props[index]; 3088bf80f4bSopenharmony_ci return PropertyValue(&meta, 3098bf80f4bSopenharmony_ci const_cast<void*>(static_cast<const void*>(static_cast<const uint8_t*>(data_) + meta.offset)), 3108bf80f4bSopenharmony_ci meta.count); 3118bf80f4bSopenharmony_ci } 3128bf80f4bSopenharmony_ci } 3138bf80f4bSopenharmony_ci return PropertyValue(); 3148bf80f4bSopenharmony_ci} 3158bf80f4bSopenharmony_ci 3168bf80f4bSopenharmony_cisize_t PropertyData::PropertyCount() const 3178bf80f4bSopenharmony_ci{ 3188bf80f4bSopenharmony_ci if (owner_) { 3198bf80f4bSopenharmony_ci const auto& props = owner_->MetaData(); 3208bf80f4bSopenharmony_ci return props.size(); 3218bf80f4bSopenharmony_ci } 3228bf80f4bSopenharmony_ci return 0; 3238bf80f4bSopenharmony_ci} 3248bf80f4bSopenharmony_ci 3258bf80f4bSopenharmony_ciPropertyValue PropertyData::Get(const string_view name) 3268bf80f4bSopenharmony_ci{ 3278bf80f4bSopenharmony_ci if (owner_ && dataW_) { 3288bf80f4bSopenharmony_ci const auto& props = owner_->MetaData(); 3298bf80f4bSopenharmony_ci if (!props.empty()) { 3308bf80f4bSopenharmony_ci const auto nameHash = FNV1aHash(name.data(), name.size()); 3318bf80f4bSopenharmony_ci for (const auto& meta : props) { 3328bf80f4bSopenharmony_ci if (meta.hash == nameHash && meta.name == name) { 3338bf80f4bSopenharmony_ci return PropertyValue(&meta, static_cast<void*>(dataW_ + meta.offset), meta.count); 3348bf80f4bSopenharmony_ci } 3358bf80f4bSopenharmony_ci } 3368bf80f4bSopenharmony_ci } 3378bf80f4bSopenharmony_ci } 3388bf80f4bSopenharmony_ci return PropertyValue(); 3398bf80f4bSopenharmony_ci} 3408bf80f4bSopenharmony_ci 3418bf80f4bSopenharmony_ciPropertyValue PropertyData::Get(const string_view name) const 3428bf80f4bSopenharmony_ci{ 3438bf80f4bSopenharmony_ci if (owner_ && data_) { 3448bf80f4bSopenharmony_ci const auto& props = owner_->MetaData(); 3458bf80f4bSopenharmony_ci if (!props.empty()) { 3468bf80f4bSopenharmony_ci const auto nameHash = FNV1aHash(name.data(), name.size()); 3478bf80f4bSopenharmony_ci for (const auto& meta : props) { 3488bf80f4bSopenharmony_ci if (meta.hash == nameHash && meta.name == name) { 3498bf80f4bSopenharmony_ci return PropertyValue(&meta, 3508bf80f4bSopenharmony_ci const_cast<void*>(static_cast<const void*>(static_cast<const uint8_t*>(data_) + meta.offset)), 3518bf80f4bSopenharmony_ci meta.count); 3528bf80f4bSopenharmony_ci } 3538bf80f4bSopenharmony_ci } 3548bf80f4bSopenharmony_ci } 3558bf80f4bSopenharmony_ci } 3568bf80f4bSopenharmony_ci return PropertyValue(); 3578bf80f4bSopenharmony_ci} 3588bf80f4bSopenharmony_ci 3598bf80f4bSopenharmony_ciPropertyValue PropertyData::operator[](size_t index) 3608bf80f4bSopenharmony_ci{ 3618bf80f4bSopenharmony_ci return Get(index); 3628bf80f4bSopenharmony_ci} 3638bf80f4bSopenharmony_ci 3648bf80f4bSopenharmony_ciPropertyValue PropertyData::operator[](size_t index) const 3658bf80f4bSopenharmony_ci{ 3668bf80f4bSopenharmony_ci return Get(index); 3678bf80f4bSopenharmony_ci} 3688bf80f4bSopenharmony_ci 3698bf80f4bSopenharmony_ciPropertyValue PropertyData::operator[](const string_view& name) 3708bf80f4bSopenharmony_ci{ 3718bf80f4bSopenharmony_ci return Get(name); 3728bf80f4bSopenharmony_ci} 3738bf80f4bSopenharmony_ci 3748bf80f4bSopenharmony_ciPropertyValue PropertyData::operator[](const string_view& name) const 3758bf80f4bSopenharmony_ci{ 3768bf80f4bSopenharmony_ci return Get(name); 3778bf80f4bSopenharmony_ci} 3788bf80f4bSopenharmony_ci 3798bf80f4bSopenharmony_ciconst IPropertyApi* PropertyData::Owner() const 3808bf80f4bSopenharmony_ci{ 3818bf80f4bSopenharmony_ci return owner_; 3828bf80f4bSopenharmony_ci} 3838bf80f4bSopenharmony_ci 3848bf80f4bSopenharmony_cisize_t PropertyData::Size() const 3858bf80f4bSopenharmony_ci{ 3868bf80f4bSopenharmony_ci return size_; 3878bf80f4bSopenharmony_ci} 3888bf80f4bSopenharmony_ci 3898bf80f4bSopenharmony_ciconst void* PropertyData::RLock() const 3908bf80f4bSopenharmony_ci{ 3918bf80f4bSopenharmony_ci return data_; 3928bf80f4bSopenharmony_ci} 3938bf80f4bSopenharmony_ci 3948bf80f4bSopenharmony_civoid* PropertyData::WLock() 3958bf80f4bSopenharmony_ci{ 3968bf80f4bSopenharmony_ci return dataW_; 3978bf80f4bSopenharmony_ci} 3988bf80f4bSopenharmony_ci 3998bf80f4bSopenharmony_civoid PropertyData::RUnlock() const {} 4008bf80f4bSopenharmony_ci 4018bf80f4bSopenharmony_civoid PropertyData::WUnlock() {} 402