diff --git a/docs/prj/Chevron_diagrams.drawio b/docs/prj/Chevron_diagrams.drawio index 6f3df7d..e01bcf8 100644 --- a/docs/prj/Chevron_diagrams.drawio +++ b/docs/prj/Chevron_diagrams.drawio @@ -1,4 +1,4 @@ - + @@ -40,1041 +40,2039 @@ - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + - - + + - - + + + + - - - - - - + + + + + + - - + + - - + + - - + + - - - - - - + + + + + + - - + + - - + + - - + + - - - - - - + + + + + + + + + + + + - + + + + - - + + + + - - + + - - + + - - - - - - + + + - - + + - - + + - - + + + + - - - - - - + + + + + + - - + + - - + + - - + + - - - - - - + + + + + + - - + + - - + + - - + + - - - - - - + + + + + + + + + + + + + + + - - + + - - + + + + - - + + - - + + - - + + + + - - + + - - + + - - + + + + - - - - - - + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - - + + + + + + + + + - - + + - - + + + + - - + + - - + + + + + + + - - + + + + - - + + - - - + + + + + + + + + + + + - - + + + + + + + + + + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - + + - - + + + + - - + + - - + + + + - - + + - - + + + + - - + + - - + + - - + + - - + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + - - + + - - + + - - + + + + - - + + - - + + + + - - + + - - + + + + + + + + + + - - + + + + + + + - - + + - - + + - - + + + + - - + + - - + + - - + + - - + + - - + + - - + + + + - - + + + + - - + + - - + + - - + + + + - - + + - - + + - - + + - - + + - - + + - - + + + + - - + + - - + + + + - - + + - - - + + + - - + + - - + + - - - + + + + + + - - - + + + - - + + - - + + - - - + + + - - + + + + + + + + - - - + + + + + + + + + - - + + - - - + + + - - + + - - - + + + - - + + + + + - + - - - + + + - - - + + + - - + + - - - + + + + + + - - + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + - - + + - - - + + + - - + + - - - + + + - - + + + + + + + - - - + + + - - - + + + + + + + + + - - + + - - + + - - - + + + + + + - - + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + + + + + + + + + + + + + + + + + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + + + + - - + + - - + + - - - + + + - - + + + + + + + + + + + - - - + + + + + + + + + - - + + - - - + + + + + + - - + + - - - + + + - - + + + + + - - - + + + - - - + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + + + + + + + + + - - - + + + - - + + + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + + + + - - - + + + - - - + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + - - + + - - - + + + + + + + + + - - + + + + - - - + + + + + + + + + - - + + - - + + + + - - - + + + + + + - - + + - - - + + + - - + + + + + + + - - - + + + - - + + - - - + + + + + + - - + + + + + + + - - + + - - - + + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + + + - - + + - - + + - - + + + + - - + + - - + + + + - - + + - - - + + + - - + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + - - + + - - - + + + + + + - - + + - - - + + + - - + + + + + - - - + + + - - + + - - + + + + - - + + + + + + + + + + + + + + - - + + - - + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - - + + + - - + + - - - + + + - - + + - - + + - - + + + + + + + - - - + + + - - + + + + + + + + + + + + + - - - + + + - - + + - - - + + + + + + + + + + + + + + - - + + + + + - - + + - - + + + + - - + + - - + + - - + + - - - + + + - - + + diff --git a/docs/prj/resources/Correct and Efficient Work-Stealing for Weak Memory Models.pdf b/docs/prj/resources/Correct and Efficient Work-Stealing for Weak Memory Models.pdf new file mode 100644 index 0000000..a1cf767 Binary files /dev/null and b/docs/prj/resources/Correct and Efficient Work-Stealing for Weak Memory Models.pdf differ diff --git a/docs/prj/resources/Dynamic Circular Work-Stealing Deque.pdf b/docs/prj/resources/Dynamic Circular Work-Stealing Deque.pdf new file mode 100644 index 0000000..2945142 Binary files /dev/null and b/docs/prj/resources/Dynamic Circular Work-Stealing Deque.pdf differ diff --git a/docs/prj/resources/Lace - Non-Blocking Split Deque for Work-Stealing.pdf b/docs/prj/resources/Lace - Non-Blocking Split Deque for Work-Stealing.pdf new file mode 100644 index 0000000..7d9682e Binary files /dev/null and b/docs/prj/resources/Lace - Non-Blocking Split Deque for Work-Stealing.pdf differ diff --git a/include/chevron/function.hpp b/include/chevron/function.hpp index 42ffcc3..85ae862 100644 --- a/include/chevron/function.hpp +++ b/include/chevron/function.hpp @@ -14,43 +14,43 @@ #ifndef CHEVRON_LIB_HDR_FUNCTION_INCLUDE_H_ #define CHEVRON_LIB_HDR_FUNCTION_INCLUDE_H_ -#include "chevron/model/function/func_args.hpp" -#include "chevron/model/function/func_pointer.hpp" +#include "chevron/utility/function/func_args.hpp" +#include "chevron/utility/function/callable.hpp" #include namespace chevron { /*! @brief Callable function that accepts no arguments and returns void. */ -using VoidReturnNoArgs = FuncPtr; +using VoidReturnNoArgs = Callable; /*! @brief Callable function that accepts no arguments and returns a boolean. */ -using BoolReturnNoArgs = FuncPtr; +using BoolReturnNoArgs = Callable; /*! @brief Callable function that accepts no arguments and returns a character. */ -using CharReturnNoArgs = FuncPtr; +using CharReturnNoArgs = Callable; /*! @brief Callable function that accepts no arguments and returns an integer. */ -using IntReturnNoArgs = FuncPtr; +using IntReturnNoArgs = Callable; /*! @brief Callable function that accepts no arguments and returns a float. */ -using FloatReturnNoArgs = FuncPtr; +using FloatReturnNoArgs = Callable; /*! @brief Callable function that accepts no arguments and returns a double. */ -using DoubleReturnNoArgs = FuncPtr; +using DoubleReturnNoArgs = Callable; /*! @brief Callable function that accepts no arguments and returns a const char pointer. */ -using CstrReturnNoArgs = FuncPtr; +using CstrReturnNoArgs = Callable; /*! @brief Callable function that accepts no arguments and returns a string. */ -using StringReturnNoArgs = FuncPtr; +using StringReturnNoArgs = Callable; /*! @brief Callable function that accepts no arguments and returns size_t. */ -using SizeReturnNoArgs = FuncPtr; +using SizeReturnNoArgs = Callable; /*! @brief Callable function that accepts no arguments and returns specified type. */ template -using NoArgsReturn = FuncPtr; +using NoArgsReturn = Callable; } // namespace chevron diff --git a/include/chevron/model/function/func_pointer.hpp b/include/chevron/utility/function/callable.hpp similarity index 62% rename from include/chevron/model/function/func_pointer.hpp rename to include/chevron/utility/function/callable.hpp index 9d4ff87..1f95c12 100644 --- a/include/chevron/model/function/func_pointer.hpp +++ b/include/chevron/utility/function/callable.hpp @@ -5,35 +5,43 @@ // [ISJTB-CXX-XL20260108-000003] /*! - * @file func_pointer.hpp + * @file callable.hpp * * @brief * Provides declaration of callable function pointer. + * + * @author + * Jamon T. Bailey + * + * @date 01-15-2026 */ -#ifndef CHEVRON_LIB_H_FUNCTION_POINTER_H_ -#define CHEVRON_LIB_H_FUNCTION_POINTER_H_ +#ifndef CHEVRON_LIB_HDR_FUNCTION_POINTER_H_ +#define CHEVRON_LIB_HDR_FUNCTION_POINTER_H_ #include -#include "chevron/model/function/func_args.hpp" -#include "chevron/model/function/type_traits.hpp" +#include "chevron/utility/function/func_args.hpp" +#include "chevron/utility/function/type_traits.hpp" namespace chevron { /*! @brief Base specialization template. */ template > -class FuncPtr; +class Callable; /*! * @brief * Function pointer. * * @details - * N/A + * N/a */ template -class FuncPtr> { +class Callable> { + // ===================================================================================== // + // <> chevron::Callable | TYPE ALIASES + // ===================================================================================== // public: /*! @brief Function return type. */ using ReturnType = ReturnT; @@ -42,19 +50,21 @@ class FuncPtr> { /*! @brief Specialized standard library function pointer type. */ using StdFunc = std::function; - FuncPtr() noexcept = default; + // ===================================================================================== // + // <> chevron::Callable | CONSTRUCTORS / DESTRUCTOR + // ===================================================================================== // /*! @brief Construct from a free function, lambda, or functor. */ template requires std::is_invocable_r_v - explicit FuncPtr(Function&& callable) : funcPtr{std::forward(callable)} + explicit Callable(Function&& callable) : funcPtr{std::forward(callable)} { // } /*! @brief Construct from a member method of a class instance. */ template - FuncPtr(ClassType* instance, Method method) + Callable(ClassType* instance, Method method) { if (instance && method) { this->funcPtr = [instance, method](ArgsT... args) -> ReturnType @@ -64,25 +74,13 @@ class FuncPtr> { } } - ~FuncPtr() noexcept = default; + Callable() noexcept = default; - /*! @brief Execute function with specified arguments. */ - ReturnType operator()(ArgsT... arg) const - { - return this->funcPtr(std::forward(arg)...); - } + ~Callable() noexcept = default; - /*! @brief Execute function with specified arguments. */ - ReturnType operator()(Arguments& arguments) - { - return std::apply(this->funcPtr, arguments.argsTuple()); - } - - /*! @brief Verify presence of callable function. */ - [[nodiscard]] explicit operator bool() const noexcept - { - return !!this->funcPtr; - } + // ===================================================================================== // + // <> chevron::Callable | [PUBLIC] MEMBER METHODS + // ===================================================================================== // /*! * @brief @@ -132,38 +130,68 @@ class FuncPtr> { return false; } + /* ------------------------------------------------------------------------------------- */ + // > chevron::Callable | OPERATORS + /* ------------------------------------------------------------------------------------- */ + + /*! @brief Execute function with specified arguments. */ + ReturnType operator()(ArgsT... arg) const + { + return this->funcPtr(std::forward(arg)...); + } + + /*! @brief Execute function with specified arguments. */ + ReturnType operator()(Arguments& arguments) + { + return std::apply(this->funcPtr, arguments.argsTuple()); + } + + /*! @brief Verify presence of callable function. */ + [[nodiscard]] explicit operator bool() const noexcept + { + return !!this->funcPtr; + } + + // ===================================================================================== // + // <> chevron::Callable | [PRIVATE] ATTRIBUTES + // ===================================================================================== // private: /*! @brief Function pointer. */ StdFunc funcPtr; }; +// ===================================================================================== // +// <> chevron::Callable | DEDUCTION GUIDES +// ===================================================================================== // + /*! @details Free function deduction guide. */ template -FuncPtr(ReturnT (*)(ArgsT...)) -> FuncPtr>; +Callable(ReturnT (*)(ArgsT...)) -> Callable>; /*! @details Non-const member function deduction guide. */ template -FuncPtr(ClassType*, ReturnT (ClassType::*)(ArgsT...)) -> FuncPtr>; +Callable(ClassType*, ReturnT (ClassType::*)(ArgsT...)) + -> Callable>; /*! @details Const member function deduction guide. */ template -FuncPtr(ClassType*, ReturnT (ClassType::*)(ArgsT...) const) - -> FuncPtr>; +Callable(ClassType*, ReturnT (ClassType::*)(ArgsT...) const) + -> Callable>; /*! @details Lambda and functor deduction guide. */ template -FuncPtr(Function&&) -> FuncPtr< +Callable(Function&&) -> Callable< typename model::traits::callable_signature>::ReturnType, model::traits::to_funcargs_t< typename model::traits::callable_signature>::ArgsTuple>>; // TODO: Lambda and functor deduction guide only works -// when directly naming `FuncPtr` with it's fully +// when directly naming `Callable` with it's fully // qualified name. Other instantiations do not // appear to exhibit this behavior in identical // circumstances. -// NOTE: Is this because there is no `FuncPtr` constructor +// NOTE: Is this because there is no `Callable` constructor // that can construct a call to the `::operator()` // method of the lambda/functor? Perhaps the sole // reliance on the guide to properly make the @@ -171,4 +199,4 @@ FuncPtr(Function&&) -> FuncPtr< } // namespace chevron -#endif // CHEVRON_LIB_H_FUNCTION_POINTER_H_ +#endif // CHEVRON_LIB_HDR_FUNCTION_POINTER_H_ diff --git a/include/chevron/model/function/concepts.hpp b/include/chevron/utility/function/concepts.hpp similarity index 81% rename from include/chevron/model/function/concepts.hpp rename to include/chevron/utility/function/concepts.hpp index 45a4153..f4ff479 100644 --- a/include/chevron/model/function/concepts.hpp +++ b/include/chevron/utility/function/concepts.hpp @@ -11,8 +11,8 @@ * Defines function pointer related entity concepts. */ -#ifndef CHEVRON_LIB_H_FUNCTION_CONCEPTS_H_ -#define CHEVRON_LIB_H_FUNCTION_CONCEPTS_H_ +#ifndef CHEVRON_LIB_HDR_FUNCTION_CONCEPTS_H_ +#define CHEVRON_LIB_HDR_FUNCTION_CONCEPTS_H_ #include #include @@ -26,4 +26,4 @@ concept is_valid_args_index = Index >= 0 && Index < sizeof...(ArgsT); } // namespace chevron::model::concepts -#endif // CHEVRON_LIB_H_FUNCTION_CONCEPTS_H_ +#endif // CHEVRON_LIB_HDR_FUNCTION_CONCEPTS_H_ diff --git a/include/chevron/model/function/func_args.hpp b/include/chevron/utility/function/func_args.hpp similarity index 60% rename from include/chevron/model/function/func_args.hpp rename to include/chevron/utility/function/func_args.hpp index 23a9d59..78bf340 100644 --- a/include/chevron/model/function/func_args.hpp +++ b/include/chevron/utility/function/func_args.hpp @@ -8,15 +8,21 @@ * @file func_args.hpp * * @brief + * Provides declaration of function argument structure. + * + * @author + * Jamon T. Bailey + * + * @date 01-15-2026 */ -#ifndef CHEVRON_LIB_H_FUNCTION_ARGUMENTS_H_ -#define CHEVRON_LIB_H_FUNCTION_ARGUMENTS_H_ +#ifndef CHEVRON_LIB_HDR_FUNCTION_ARGUMENTS_H_ +#define CHEVRON_LIB_HDR_FUNCTION_ARGUMENTS_H_ #include #include #include -#include "chevron/model/function/concepts.hpp" +#include "chevron/utility/function/concepts.hpp" namespace chevron { @@ -30,10 +36,17 @@ namespace chevron */ template class FuncArgs { + // ===================================================================================== // + // <> chevron::FuncArgs | TYPE ALIASES + // ===================================================================================== // public: /*! @brief Argument types pack. */ using Types = std::tuple; + // ===================================================================================== // + // <> chevron::FuncArgs | CONSTRUCTORS / DESTRUCTOR + // ===================================================================================== // + /*! @brief Default construct all function arguments. */ constexpr FuncArgs() noexcept((std::is_nothrow_default_constructible_v && ...)) requires(std::is_default_constructible_v && ...) @@ -49,8 +62,9 @@ class FuncArgs { (std::is_constructible_v && ...) && (!std::is_same_v, FuncArgs> && ...) ) - constexpr explicit FuncArgs(IncomingArgsT&&... arg - ) noexcept((std::is_nothrow_constructible_v && ...)) + constexpr explicit FuncArgs(IncomingArgsT&&... arg) noexcept( + (std::is_nothrow_constructible_v && ...) + ) : args{std::forward(arg)...} { // @@ -58,6 +72,10 @@ class FuncArgs { ~FuncArgs() noexcept = default; + // ===================================================================================== // + // <> chevron::FuncArgs | [PUBLIC] MEMBER METHODS + // ===================================================================================== // + /*! @brief Get argument at specified index. */ template requires(model::concepts::is_valid_args_index) @@ -86,11 +104,18 @@ class FuncArgs { return this->args; } + // ===================================================================================== // + // <> chevron::FuncArgs | [PRIVATE] ATTRIBUTES + // ===================================================================================== // private: /*! @brief Pre-defined arguments tuple. */ Types args; }; +// ===================================================================================== // +// <> chevron::FuncArgs | TYPE TRAIT UTILITIES +// ===================================================================================== // + namespace model::traits { @@ -110,6 +135,10 @@ using to_funcargs_t = to_funcargs::type; } // namespace model::traits +// ===================================================================================== // +// <> chevron::FuncArgs | DEDUCTION GUIDES +// ===================================================================================== // + /*! @details Function argument deduction guide. */ template FuncArgs(ArgsT&&...) -> FuncArgs...>; @@ -119,4 +148,4 @@ FuncArgs() -> FuncArgs<>; } // namespace chevron -#endif // CHEVRON_LIB_H_FUNCTION_ARGUMENTS_H_ +#endif // CHEVRON_LIB_HDR_FUNCTION_ARGUMENTS_H_ diff --git a/include/chevron/model/function/type_traits.hpp b/include/chevron/utility/function/type_traits.hpp similarity index 92% rename from include/chevron/model/function/type_traits.hpp rename to include/chevron/utility/function/type_traits.hpp index bdf6eee..bd5ebe2 100644 --- a/include/chevron/model/function/type_traits.hpp +++ b/include/chevron/utility/function/type_traits.hpp @@ -11,8 +11,8 @@ * Defines function related entity type traits. */ -#ifndef CHEVRON_LIB_H_FUNCTION_TYPE_TRAITS_H_ -#define CHEVRON_LIB_H_FUNCTION_TYPE_TRAITS_H_ +#ifndef CHEVRON_LIB_HDR_FUNCTION_TYPE_TRAITS_H_ +#define CHEVRON_LIB_HDR_FUNCTION_TYPE_TRAITS_H_ #include #include @@ -69,4 +69,4 @@ struct callable_signature { } // namespace chevron::model::traits -#endif // CHEVRON_LIB_H_FUNCTION_TYPE_TRAITS_H_ +#endif // CHEVRON_LIB_HDR_FUNCTION_TYPE_TRAITS_H_ diff --git a/tests/cli/dev_exe.cpp b/tests/cli/dev_exe.cpp index ff5e46f..7dc93d0 100644 --- a/tests/cli/dev_exe.cpp +++ b/tests/cli/dev_exe.cpp @@ -1,13 +1,8 @@ #include #include -#include"chevron/common/export.h" -#include"chevron/function.hpp" -int doNothing() -{ - return 15; -} +#include "chevron/function.hpp" int main(int argc, char* argv[]) { @@ -15,17 +10,17 @@ int main(int argc, char* argv[]) // // Start... - chevron::IntReturnNoArgs ggg{doNothing}; - chevron::NoArgsReturn ddd{doNothing}; // //\\// return 0; +} - // FIX: Need specific constructor for lambda/functor using `::operator()`!!! - // (`FuncPtr` class) - // struct CallableModel --> ReturnType & Arguments --> FuncPtr or Func - // Static callable type `Func`? (No heap alloc) -} +/* + * :: Chevron Notes :: + * + * [ Function Utilities Notes ] + * -> Static callable type `Func`? (No heap alloc) + */