去除所有访问级别
This commit is contained in:
@@ -211,14 +211,8 @@ public:
|
||||
};
|
||||
template <class Schema, std::size_t Index, class Category, class Fallback>
|
||||
using effective_attribute_t = typename Effective_Attribute<Schema, Index, Category, Fallback>::type;
|
||||
using Default_Access_Attribute = External_Access_Attribute<External_Access::none>;
|
||||
using Default_Persistence_Attribute = Persistence_Access_Attribute<Persistence_Access::none>;
|
||||
using Default_Sensitive_Attribute = Sensitive_Attribute<false>;
|
||||
template <class Schema, std::size_t Index>
|
||||
inline constexpr External_Access effective_external_access_v = effective_attribute_t<Schema, Index, Access_Category, Default_Access_Attribute>::value;
|
||||
template <class Schema, std::size_t Index>
|
||||
inline constexpr Persistence_Access effective_persistence_access_v = effective_attribute_t<Schema, Index, Persistence_Category, Default_Persistence_Attribute>::value;
|
||||
template <class Schema, std::size_t Index>
|
||||
inline constexpr bool effective_sensitive_v = effective_attribute_t<Schema, Index, Sensitive_Category, Default_Sensitive_Attribute>::value;
|
||||
template <class Schema, std::size_t Index, class Category>
|
||||
using property_declared_attribute_t = typename Schema::template property_type<Index>::template attribute_type<Category>;
|
||||
@@ -236,37 +230,18 @@ constexpr decltype(auto) declared_effective_attribute(const Schema& schema) requ
|
||||
return std::get<default_attribute>(schema.object_defaults().attributes);
|
||||
}
|
||||
}
|
||||
template <class Schema, std::size_t Index>
|
||||
inline constexpr bool external_readable_v = effective_external_access_v<Schema, Index> == External_Access::read || effective_external_access_v<Schema, Index> == External_Access::read_write;
|
||||
template <class Schema, std::size_t Index>
|
||||
inline constexpr bool external_writable_v = effective_external_access_v<Schema, Index> == External_Access::write || effective_external_access_v<Schema, Index> == External_Access::read_write;
|
||||
template <class Schema, std::size_t Index>
|
||||
inline constexpr bool persistence_loadable_v = effective_persistence_access_v<Schema, Index> == Persistence_Access::load || effective_persistence_access_v<Schema, Index> == Persistence_Access::load_store;
|
||||
template <class Schema, std::size_t Index>
|
||||
inline constexpr bool persistence_storable_v = effective_persistence_access_v<Schema, Index> == Persistence_Access::store || effective_persistence_access_v<Schema, Index> == Persistence_Access::load_store;
|
||||
template <class Schema, std::size_t Index>
|
||||
consteval bool property_capability_semantics_valid() {
|
||||
using property_type = typename Schema::template property_type<Index>;
|
||||
if constexpr ((external_readable_v<Schema, Index> || persistence_storable_v<Schema, Index>) && !property_type::readable) {
|
||||
return false;
|
||||
}
|
||||
if constexpr ((external_writable_v<Schema, Index> || persistence_loadable_v<Schema, Index>) && !property_type::writable) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
template <class Schema, std::size_t... Index>
|
||||
consteval bool schema_capability_semantics_valid_impl(std::index_sequence<Index...>) {
|
||||
return (property_capability_semantics_valid<Schema, Index>() && ...);
|
||||
}
|
||||
template <class Schema>
|
||||
consteval bool schema_capability_semantics_valid() {
|
||||
return schema_capability_semantics_valid_impl<Schema>(std::make_index_sequence<Schema::property_count>{});
|
||||
}
|
||||
template <class Schema>
|
||||
concept Valid_Property_Schema = Property_Schema<Schema> && requires {
|
||||
requires schema_capability_semantics_valid<Schema>();
|
||||
};
|
||||
concept Valid_Property_Schema = Property_Schema<Schema>;
|
||||
template <class Schema, std::size_t Index>
|
||||
inline constexpr bool property_requires_synchronization_v = Schema::template property_type<Index>::writable || Schema::template property_type<Index>::synchronized_view_read;
|
||||
template <class Schema, auto Member>
|
||||
concept Schema_Readable_Property_Member = Schema_Property_Member<Schema, Member> && Schema::template property_type<schema_member_property_index_v<Schema, Member>>::readable;
|
||||
template <class Schema, auto Member>
|
||||
concept Schema_Writable_Property_Member = Schema_Property_Member<Schema, Member> && Schema::template property_type<schema_member_property_index_v<Schema, Member>>::writable;
|
||||
template <class Schema, Fixed_String Key>
|
||||
concept Schema_Readable_Property_Key = Schema_Property_Key<Schema, Key> && Schema::template property_type<schema_property_index_v<Schema, Key>>::readable;
|
||||
template <class Schema, Fixed_String Key>
|
||||
concept Schema_Writable_Property_Key = Schema_Property_Key<Schema, Key> && Schema::template property_type<schema_property_index_v<Schema, Key>>::writable;
|
||||
template <Valid_Property_Schema Schema>
|
||||
Resolved_Synchronization_Plan<Schema::property_count> resolve_synchronization_plan(const Schema&, const Synchronization_Plan& plan) {
|
||||
using resolved_type = Resolved_Synchronization_Plan<Schema::property_count>;
|
||||
@@ -318,6 +293,14 @@ Resolved_Synchronization_Plan<Schema::property_count> resolve_synchronization_pl
|
||||
logical[index] = token;
|
||||
}
|
||||
}
|
||||
constexpr auto requires_synchronization = []<std::size_t... Index>(std::index_sequence<Index...>) {
|
||||
return std::array<bool, Schema::property_count>{property_requires_synchronization_v<Schema, Index>...};
|
||||
}(std::make_index_sequence<Schema::property_count>{});
|
||||
for (std::size_t index = 0; index < Schema::property_count; ++index) {
|
||||
if (!requires_synchronization[index]) {
|
||||
logical[index] = unsynchronized_slot;
|
||||
}
|
||||
}
|
||||
resolved_type resolved;
|
||||
resolved.lock_slots.fill(unsynchronized_slot);
|
||||
std::vector<std::pair<std::size_t, std::size_t>> token_slots;
|
||||
|
||||
Reference in New Issue
Block a user