diff --git a/kernel/kernel/include/concurrent/Concurrent.hpp b/kernel/kernel/include/concurrent/Concurrent.hpp new file mode 100644 index 0000000..54a1e6d --- /dev/null +++ b/kernel/kernel/include/concurrent/Concurrent.hpp @@ -0,0 +1,35 @@ +#pragma once +#include +#include +namespace aethera { +namespace detail { +struct Builder_Set_Probe { + template void operator()(Value&) const; +}; +} +template +concept Concurrent_Internal = requires(Attachment& attachment) { + attachment.internal.advance(); + attachment.internal.use(); + attachment.internal.builder_set(detail::Builder_Set_Probe{}); +}; +template +concept Concurrent_External_Set = requires(Attachment& attachment, Args&&... args) { + attachment.set(std::forward(args)...); +}; +template +concept Concurrent_External_Get = requires(const Attachment& attachment, Args&&... args) { + attachment.get(std::forward(args)...); +}; +template +concept Concurrent_Attachment = Concurrent_Internal && (Concurrent_External_Set || Concurrent_External_Get); +} +namespace aethera::detail { + +/* 默认推进钩子:不记录状态;参数是 advance 入口捕获的交换前角色。 */ +struct No_Concurrent_Hooks { + template void before_advance(const Values*... before) noexcept; + template void after_advance(const Values*... before) noexcept; +}; +} +#include "Concurrent.ipp" diff --git a/kernel/kernel/include/concurrent/Concurrent.ipp b/kernel/kernel/include/concurrent/Concurrent.ipp new file mode 100644 index 0000000..5875791 --- /dev/null +++ b/kernel/kernel/include/concurrent/Concurrent.ipp @@ -0,0 +1,5 @@ +#pragma once +namespace aethera::detail { +template void No_Concurrent_Hooks::before_advance(const Values*...) noexcept {} +template void No_Concurrent_Hooks::after_advance(const Values*...) noexcept {} +} diff --git a/kernel/kernel/include/concurrent/Concurrent_Advance.hpp b/kernel/kernel/include/concurrent/Concurrent_Advance.hpp deleted file mode 100644 index 55c2771..0000000 --- a/kernel/kernel/include/concurrent/Concurrent_Advance.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once -#include -#include -namespace aethera { -namespace detail { -struct Builder_Set_Probe { - template void operator()(Value&) const; -}; -} -template -concept Internal_Storage = requires(Storage& storage) { - storage.internal.advance(); - storage.internal.use(); - storage.internal.builder_set(detail::Builder_Set_Probe{}); -}; -template -concept External_Set_Storage = requires(Storage& storage, Args&&... args) { - storage.set(std::forward(args)...); -}; -template -concept External_Get_Storage = requires(const Storage& storage, Args&&... args) { - storage.get(std::forward(args)...); -}; -template -concept Concurrent_Storage = Internal_Storage && (External_Set_Storage || External_Get_Storage); -} -namespace aethera::detail { - -/* 默认推进钩子:不记录状态;参数是 advance 入口捕获的交换前角色。 */ -struct No_Storage_Hooks { - template void before_advance(const Values*... before) noexcept; - template void after_advance(const Values*... before) noexcept; -}; -} -#include "Concurrent_Advance.ipp" diff --git a/kernel/kernel/include/concurrent/Concurrent_Advance.ipp b/kernel/kernel/include/concurrent/Concurrent_Advance.ipp deleted file mode 100644 index 9131dce..0000000 --- a/kernel/kernel/include/concurrent/Concurrent_Advance.ipp +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once -namespace aethera::detail { -template void No_Storage_Hooks::before_advance(const Values*...) noexcept {} -template void No_Storage_Hooks::after_advance(const Values*...) noexcept {} -} diff --git a/kernel/kernel/include/concurrent/Concurrent_Registration.hpp b/kernel/kernel/include/concurrent/Concurrent_Registration.hpp new file mode 100644 index 0000000..78a407a --- /dev/null +++ b/kernel/kernel/include/concurrent/Concurrent_Registration.hpp @@ -0,0 +1,58 @@ +#pragma once +#include "Concurrent.hpp" +#include "../model/Model.hpp" +#include +#include +#include +namespace aethera { +namespace detail { +template requires Value_Writer void initialize_concurrent_value(Value& target, Fn&& fn); +template requires std::derived_from && std::assignable_from void initialize_concurrent_value(Value& target, Member Owner::* member, T&& value); +template requires std::assignable_from void initialize_concurrent_value(Value& target, T&& value); +template +concept Concurrent_Value_Initializer = requires(Value& value, Args&&... args) { initialize_concurrent_value(value, std::forward(args)...); }; +template struct Concurrent_Model_API; +template struct Concurrent_Builder_API; +template struct Concurrent_Private_API; +struct Concurrent_Registration_Protocol { + template using Model_API = Concurrent_Model_API; + template using Builder_API = Concurrent_Builder_API; + template using Private_API = Concurrent_Private_API; +}; +template