Files
Aethera/kernel/kernel/include/global.hpp
T
2026-09-02 11:09:06 +08:00

88 lines
2.5 KiB
C++

#pragma once
#include <concepts>
#include <functional>
#include <mutex>
#include <ranges>
#include <type_traits>
#include <utility>
#include "proxy/v4/detail/facade_creation.h"
namespace aethera {
using pro::facade_builder;
using pro::proxy;
#define PRO_MEM_DISPATCH(name) PRO_DEF_MEM_DISPATCH(_##name, name)
PRO_MEM_DISPATCH(start);
PRO_MEM_DISPATCH(stop);
PRO_MEM_DISPATCH(create_frame);
PRO_MEM_DISPATCH(advance);
PRO_MEM_DISPATCH(taskflow);
PRO_MEM_DISPATCH(add);
PRO_MEM_DISPATCH(add_condition);
PRO_MEM_DISPATCH(component);
PRO_MEM_DISPATCH(compose);
PRO_MEM_DISPATCH(precede);
PRO_MEM_DISPATCH(describe);
PRO_MEM_DISPATCH(describe_node);
PRO_MEM_DISPATCH(clear);
PRO_MEM_DISPATCH(empty);
PRO_MEM_DISPATCH(run);
PRO_MEM_DISPATCH(run_observed);
PRO_MEM_DISPATCH(use);
PRO_MEM_DISPATCH(now);
PRO_MEM_DISPATCH(render);
PRO_MEM_DISPATCH(schedule_after);
PRO_MEM_DISPATCH(schedule_every);
PRO_MEM_DISPATCH(reschedule);
PRO_MEM_DISPATCH(cancel);
PRO_MEM_DISPATCH(send);
struct Non_Copyable {
protected:
Non_Copyable() = default;
~Non_Copyable() = default;
Non_Copyable(const Non_Copyable&) = delete;
Non_Copyable& operator=(const Non_Copyable&) = delete;
Non_Copyable(Non_Copyable&&) = default;
Non_Copyable& operator=(Non_Copyable&&) = default;
};
struct Immovable {
protected:
Immovable() = default;
~Immovable() = default;
Immovable(const Immovable&) = delete;
Immovable& operator=(const Immovable&) = delete;
Immovable(Immovable&&) = delete;
Immovable& operator=(Immovable&&) = delete;
};
template <class T>
concept Exchange_Value =
std::default_initializable<T> &&
std::copy_constructible<T> &&
std::assignable_from<T&, const T&>;
template <class T>
concept Member_Value = std::is_object_v<T>;
template <class T>
concept Copyable_Member =
Member_Value<T> &&
std::copy_constructible<std::remove_cv_t<T>>;
template <class From, class To>
concept Assignable_To = std::assignable_from<To, From&&>;
template <class Fn, class Arg>
concept Invocable_With = std::invocable<Fn, Arg>;
template <class Fn, class Val>
concept Value_Reader =
Invocable_With<Fn, const Val&> &&
(!std::is_member_object_pointer_v<std::remove_cvref_t<Fn>>);
template <class Fn, class Val>
concept Value_Writer =
Invocable_With<Fn, Val&> &&
(!std::is_member_object_pointer_v<std::remove_cvref_t<Fn>>);
template <class T>
concept Clearable = requires(T& value) {
{ value.clear() } -> std::same_as<void>;
};
template <class T>
concept List_Value =
std::default_initializable<T> &&
std::ranges::range<T> &&
Clearable<T>;
}