From 57c3157d9ad5f6e44ac3d76c0ea0665e7b0bcb3c Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 5 Apr 2026 20:21:28 +0100 Subject: [PATCH] Exported raw text documentation files from the web site editor --- docs/raw/callbacks/closure.txt | 49 + docs/raw/callbacks/delegate.txt | 234 +++++ docs/raw/callbacks/delegate_observable.txt | 79 ++ docs/raw/callbacks/function.txt | 104 ++ docs/raw/chrono/Chrono literals.txt | 36 + docs/raw/chrono/Clocks.txt | 94 ++ docs/raw/chrono/Operators.txt | 224 +++++ docs/raw/chrono/day.txt | 197 ++++ docs/raw/chrono/duration.txt | 335 +++++++ docs/raw/chrono/hh_mm_ss.txt | 87 ++ docs/raw/chrono/last_spec.txt | 17 + docs/raw/chrono/month.txt | 213 ++++ docs/raw/chrono/month_day.txt | 104 ++ docs/raw/chrono/month_day_last.txt | 91 ++ docs/raw/chrono/month_weekday.txt | 94 ++ docs/raw/chrono/month_weekday_last.txt | 88 ++ docs/raw/chrono/time_point.txt | 182 ++++ docs/raw/chrono/weekday.txt | 229 +++++ docs/raw/chrono/weekday_indexed.txt | 80 ++ docs/raw/chrono/weekday_last.txt | 70 ++ docs/raw/chrono/year.txt | 206 ++++ docs/raw/chrono/year_month.txt | 133 +++ docs/raw/chrono/year_month_day.txt | 175 ++++ docs/raw/chrono/year_month_day_last.txt | 164 +++ docs/raw/frameworks/Callback Service.txt | 57 ++ docs/raw/frameworks/Callback Timer Atomic.txt | 200 ++++ .../Callback Timer Deferred Locked.txt | 214 ++++ .../frameworks/Callback Timer Interrupt.txt | 226 +++++ docs/raw/frameworks/Callback Timer Locked.txt | 207 ++++ docs/raw/frameworks/Callback Timer.txt | 244 +++++ docs/raw/frameworks/Cooperative Scheduler.txt | 183 ++++ docs/raw/frameworks/Delegate Service.txt | 58 ++ docs/raw/frameworks/Finite State Machine.txt | 434 ++++++++ .../Hierarchical Finite State Machine.txt | 98 ++ docs/raw/frameworks/Message Broker.txt | 148 +++ docs/raw/frameworks/Message Bus.txt | 157 +++ .../frameworks/Message Router Registry.txt | 96 ++ docs/raw/frameworks/Message Router.txt | 345 +++++++ docs/raw/frameworks/Message Timer Atomic.txt | 232 +++++ .../frameworks/Message Timer Interrupt.txt | 252 +++++ docs/raw/frameworks/Message Timer Locked.txt | 242 +++++ docs/raw/frameworks/Message Timer.txt | 246 +++++ docs/raw/frameworks/Messages.txt | 82 ++ .../Reference Counted Message Pool.txt | 88 ++ .../frameworks/Reference Counted Messages.txt | 102 ++ docs/raw/frameworks/Shared Messages.txt | 38 + docs/raw/frameworks/State Chart.txt | 310 ++++++ docs/raw/frameworks/Task.txt | 41 + docs/raw/frameworks/Timer.txt | 90 ++ docs/raw/frameworks/hfsm.png | Bin 0 -> 44610 bytes docs/raw/frameworks/message_packet.txt | 103 ++ docs/raw/frameworks/signal.txt | 257 +++++ docs/raw/maths/Checksums & hashes.txt | 419 ++++++++ docs/raw/maths/Constants.txt | 143 +++ docs/raw/maths/Correlation.txt | 74 ++ docs/raw/maths/Covariance.txt | 67 ++ docs/raw/maths/Gamma.txt | 48 + docs/raw/maths/Histogram.txt | 157 +++ docs/raw/maths/Invert.txt | 39 + docs/raw/maths/Limiter.txt | 32 + docs/raw/maths/Mean.txt | 55 ++ docs/raw/maths/Quantize.txt | 49 + docs/raw/maths/RMS.txt | 56 ++ docs/raw/maths/Rescale.txt | 33 + docs/raw/maths/Rounded integral division.txt | 175 ++++ docs/raw/maths/Scaled Rounding.txt | 257 +++++ docs/raw/maths/Standard Deviation.txt | 67 ++ docs/raw/maths/Threshold.txt | 33 + docs/raw/maths/Variance.txt | 62 ++ docs/raw/maths/absolute.txt | 24 + docs/raw/maths/comb-perm.txt | 30 + docs/raw/maths/is_negative.txt | 7 + docs/raw/maths/pseudo_moving_average.txt | 88 ++ docs/raw/maths/radix.txt | 13 + docs/raw/maths/random.txt | 234 +++++ docs/raw/maths/ratio.txt | 56 ++ docs/raw/utilities/Algorithms.txt | 931 ++++++++++++++++++ docs/raw/utilities/Alignment.txt | 103 ++ docs/raw/utilities/Atomic.txt | 13 + docs/raw/utilities/Binary.txt | 380 +++++++ docs/raw/utilities/Bit.txt | 72 ++ docs/raw/utilities/ETL Traits.txt | 90 ++ docs/raw/utilities/ETL_STATIC_ASSERT.txt | 12 + docs/raw/utilities/Endian.txt | 61 ++ docs/raw/utilities/Exception.txt | 29 + docs/raw/utilities/Iterator.txt | 303 ++++++ docs/raw/utilities/Memory Cast.txt | 255 +++++ docs/raw/utilities/Memory Model.txt | 26 + docs/raw/utilities/Memory.txt | 448 +++++++++ docs/raw/utilities/Mutex.txt | 13 + docs/raw/utilities/Parameter Pack.txt | 63 ++ .../utilities/Reference Counted Objects.txt | 88 ++ docs/raw/utilities/Type List.txt | 79 ++ docs/raw/utilities/Type Lookup.txt | 155 +++ docs/raw/utilities/Type Select.txt | 50 + docs/raw/utilities/Utility.txt | 366 +++++++ docs/raw/utilities/Versions.txt | 27 + docs/raw/utilities/bit_stream_reader.txt | 163 +++ docs/raw/utilities/bit_stream_writer.txt | 227 +++++ docs/raw/utilities/byte.txt | 80 ++ docs/raw/utilities/byte_stream_reader.txt | 139 +++ docs/raw/utilities/byte_stream_writer.txt | 246 +++++ docs/raw/utilities/circular_iterator.txt | 149 +++ docs/raw/utilities/compare.txt | 125 +++ docs/raw/utilities/constant.txt | 34 + docs/raw/utilities/cyclic_value.txt | 87 ++ docs/raw/utilities/debug_count.txt | 41 + docs/raw/utilities/enum_type.txt | 45 + docs/raw/utilities/error_handler.txt | 166 ++++ docs/raw/utilities/expected.txt | 297 ++++++ docs/raw/utilities/fixed_iterator.txt | 50 + docs/raw/utilities/flags.txt | 89 ++ docs/raw/utilities/function_traits.txt | 97 ++ docs/raw/utilities/functional.txt | 105 ++ docs/raw/utilities/initializer_list.txt | 29 + docs/raw/utilities/instance_count.txt | 31 + docs/raw/utilities/integral_limits.txt | 23 + docs/raw/utilities/largest.txt | 168 ++++ docs/raw/utilities/limits.txt | 5 + docs/raw/utilities/multi_range.txt | 209 ++++ docs/raw/utilities/not_null.txt | 59 ++ docs/raw/utilities/nth_type.txt | 14 + docs/raw/utilities/null_type.txt | 13 + docs/raw/utilities/nullptr.txt | 8 + docs/raw/utilities/numeric.txt | 26 + docs/raw/utilities/parameter_type.txt | 41 + docs/raw/utilities/result.txt | 81 ++ docs/raw/utilities/smallest.txt | 116 +++ docs/raw/utilities/tuple.txt | 163 +++ docs/raw/utilities/type_def.txt | 65 ++ docs/raw/utilities/type_traits.txt | 372 +++++++ docs/raw/utilities/unaligned_type.txt | 240 +++++ docs/raw/utilities/user_type.txt | 24 + test/vs2022/etl.vcxproj | 2 - 134 files changed, 17644 insertions(+), 2 deletions(-) create mode 100644 docs/raw/callbacks/closure.txt create mode 100644 docs/raw/callbacks/delegate.txt create mode 100644 docs/raw/callbacks/delegate_observable.txt create mode 100644 docs/raw/callbacks/function.txt create mode 100644 docs/raw/chrono/Chrono literals.txt create mode 100644 docs/raw/chrono/Clocks.txt create mode 100644 docs/raw/chrono/Operators.txt create mode 100644 docs/raw/chrono/day.txt create mode 100644 docs/raw/chrono/duration.txt create mode 100644 docs/raw/chrono/hh_mm_ss.txt create mode 100644 docs/raw/chrono/last_spec.txt create mode 100644 docs/raw/chrono/month.txt create mode 100644 docs/raw/chrono/month_day.txt create mode 100644 docs/raw/chrono/month_day_last.txt create mode 100644 docs/raw/chrono/month_weekday.txt create mode 100644 docs/raw/chrono/month_weekday_last.txt create mode 100644 docs/raw/chrono/time_point.txt create mode 100644 docs/raw/chrono/weekday.txt create mode 100644 docs/raw/chrono/weekday_indexed.txt create mode 100644 docs/raw/chrono/weekday_last.txt create mode 100644 docs/raw/chrono/year.txt create mode 100644 docs/raw/chrono/year_month.txt create mode 100644 docs/raw/chrono/year_month_day.txt create mode 100644 docs/raw/chrono/year_month_day_last.txt create mode 100644 docs/raw/frameworks/Callback Service.txt create mode 100644 docs/raw/frameworks/Callback Timer Atomic.txt create mode 100644 docs/raw/frameworks/Callback Timer Deferred Locked.txt create mode 100644 docs/raw/frameworks/Callback Timer Interrupt.txt create mode 100644 docs/raw/frameworks/Callback Timer Locked.txt create mode 100644 docs/raw/frameworks/Callback Timer.txt create mode 100644 docs/raw/frameworks/Cooperative Scheduler.txt create mode 100644 docs/raw/frameworks/Delegate Service.txt create mode 100644 docs/raw/frameworks/Finite State Machine.txt create mode 100644 docs/raw/frameworks/Hierarchical Finite State Machine.txt create mode 100644 docs/raw/frameworks/Message Broker.txt create mode 100644 docs/raw/frameworks/Message Bus.txt create mode 100644 docs/raw/frameworks/Message Router Registry.txt create mode 100644 docs/raw/frameworks/Message Router.txt create mode 100644 docs/raw/frameworks/Message Timer Atomic.txt create mode 100644 docs/raw/frameworks/Message Timer Interrupt.txt create mode 100644 docs/raw/frameworks/Message Timer Locked.txt create mode 100644 docs/raw/frameworks/Message Timer.txt create mode 100644 docs/raw/frameworks/Messages.txt create mode 100644 docs/raw/frameworks/Reference Counted Message Pool.txt create mode 100644 docs/raw/frameworks/Reference Counted Messages.txt create mode 100644 docs/raw/frameworks/Shared Messages.txt create mode 100644 docs/raw/frameworks/State Chart.txt create mode 100644 docs/raw/frameworks/Task.txt create mode 100644 docs/raw/frameworks/Timer.txt create mode 100644 docs/raw/frameworks/hfsm.png create mode 100644 docs/raw/frameworks/message_packet.txt create mode 100644 docs/raw/frameworks/signal.txt create mode 100644 docs/raw/maths/Checksums & hashes.txt create mode 100644 docs/raw/maths/Constants.txt create mode 100644 docs/raw/maths/Correlation.txt create mode 100644 docs/raw/maths/Covariance.txt create mode 100644 docs/raw/maths/Gamma.txt create mode 100644 docs/raw/maths/Histogram.txt create mode 100644 docs/raw/maths/Invert.txt create mode 100644 docs/raw/maths/Limiter.txt create mode 100644 docs/raw/maths/Mean.txt create mode 100644 docs/raw/maths/Quantize.txt create mode 100644 docs/raw/maths/RMS.txt create mode 100644 docs/raw/maths/Rescale.txt create mode 100644 docs/raw/maths/Rounded integral division.txt create mode 100644 docs/raw/maths/Scaled Rounding.txt create mode 100644 docs/raw/maths/Standard Deviation.txt create mode 100644 docs/raw/maths/Threshold.txt create mode 100644 docs/raw/maths/Variance.txt create mode 100644 docs/raw/maths/absolute.txt create mode 100644 docs/raw/maths/comb-perm.txt create mode 100644 docs/raw/maths/is_negative.txt create mode 100644 docs/raw/maths/pseudo_moving_average.txt create mode 100644 docs/raw/maths/radix.txt create mode 100644 docs/raw/maths/random.txt create mode 100644 docs/raw/maths/ratio.txt create mode 100644 docs/raw/utilities/Algorithms.txt create mode 100644 docs/raw/utilities/Alignment.txt create mode 100644 docs/raw/utilities/Atomic.txt create mode 100644 docs/raw/utilities/Binary.txt create mode 100644 docs/raw/utilities/Bit.txt create mode 100644 docs/raw/utilities/ETL Traits.txt create mode 100644 docs/raw/utilities/ETL_STATIC_ASSERT.txt create mode 100644 docs/raw/utilities/Endian.txt create mode 100644 docs/raw/utilities/Exception.txt create mode 100644 docs/raw/utilities/Iterator.txt create mode 100644 docs/raw/utilities/Memory Cast.txt create mode 100644 docs/raw/utilities/Memory Model.txt create mode 100644 docs/raw/utilities/Memory.txt create mode 100644 docs/raw/utilities/Mutex.txt create mode 100644 docs/raw/utilities/Parameter Pack.txt create mode 100644 docs/raw/utilities/Reference Counted Objects.txt create mode 100644 docs/raw/utilities/Type List.txt create mode 100644 docs/raw/utilities/Type Lookup.txt create mode 100644 docs/raw/utilities/Type Select.txt create mode 100644 docs/raw/utilities/Utility.txt create mode 100644 docs/raw/utilities/Versions.txt create mode 100644 docs/raw/utilities/bit_stream_reader.txt create mode 100644 docs/raw/utilities/bit_stream_writer.txt create mode 100644 docs/raw/utilities/byte.txt create mode 100644 docs/raw/utilities/byte_stream_reader.txt create mode 100644 docs/raw/utilities/byte_stream_writer.txt create mode 100644 docs/raw/utilities/circular_iterator.txt create mode 100644 docs/raw/utilities/compare.txt create mode 100644 docs/raw/utilities/constant.txt create mode 100644 docs/raw/utilities/cyclic_value.txt create mode 100644 docs/raw/utilities/debug_count.txt create mode 100644 docs/raw/utilities/enum_type.txt create mode 100644 docs/raw/utilities/error_handler.txt create mode 100644 docs/raw/utilities/expected.txt create mode 100644 docs/raw/utilities/fixed_iterator.txt create mode 100644 docs/raw/utilities/flags.txt create mode 100644 docs/raw/utilities/function_traits.txt create mode 100644 docs/raw/utilities/functional.txt create mode 100644 docs/raw/utilities/initializer_list.txt create mode 100644 docs/raw/utilities/instance_count.txt create mode 100644 docs/raw/utilities/integral_limits.txt create mode 100644 docs/raw/utilities/largest.txt create mode 100644 docs/raw/utilities/limits.txt create mode 100644 docs/raw/utilities/multi_range.txt create mode 100644 docs/raw/utilities/not_null.txt create mode 100644 docs/raw/utilities/nth_type.txt create mode 100644 docs/raw/utilities/null_type.txt create mode 100644 docs/raw/utilities/nullptr.txt create mode 100644 docs/raw/utilities/numeric.txt create mode 100644 docs/raw/utilities/parameter_type.txt create mode 100644 docs/raw/utilities/result.txt create mode 100644 docs/raw/utilities/smallest.txt create mode 100644 docs/raw/utilities/tuple.txt create mode 100644 docs/raw/utilities/type_def.txt create mode 100644 docs/raw/utilities/type_traits.txt create mode 100644 docs/raw/utilities/unaligned_type.txt create mode 100644 docs/raw/utilities/user_type.txt diff --git a/docs/raw/callbacks/closure.txt b/docs/raw/callbacks/closure.txt new file mode 100644 index 00000000..72acbae9 --- /dev/null +++ b/docs/raw/callbacks/closure.txt @@ -0,0 +1,49 @@ +closure + +etl::closure wraps an etl::delegate and a set of arguments. +____________________________________________________________________________________________________ +C++11 and above. +etl::closure +____________________________________________________________________________________________________ +C++03. +etl::delegate +etl::delegate +etl::delegate +etl::delegate +etl::delegate +____________________________________________________________________________________________________ +Types + +delegate_type The delegate type etl::delegate +____________________________________________________________________________________________________ +Constructor + +C++11 and above. +ETL_CONSTEXPR14 closure(const delegate_type& f, const TArgs... args) +____________________________________________________________________________________________________ +C++03. +closure(const delegate_type& f, const TArg0 arg0) +closure(const delegate_type& f, const TArg0 arg0, const TArg1 arg1) +closure(const delegate_type& f, const TArg0 arg0, const TArg1 arg1, const TArg2 arg2) +closure(const delegate_type& f, const TArg0 arg0, const TArg1 arg1, const TArg2 arg2, + const TArg3 arg3) +closure(const delegate_type& f, const TArg0 arg0, const TArg1 arg1, const TArg2 arg2, + const TArg3 arg3, const TArg4 arg4) +____________________________________________________________________________________________________ +Operations +template +void bind(UArg arg) +Bind a new value to the argument at the specified index. +UArg must be one of TArgs. +Only non-reference types can be rebound. +C++11 and above. +____________________________________________________________________________________________________ +template +void bind(UArgs&&... args) +Bind new values to all of the arguments at once. +The number of arguments must match the delegate. +C++11 and above. +____________________________________________________________________________________________________ +ETL_CONSTEXPR14 TReturn operator()(TParams... args) const +Executes the delegate. + diff --git a/docs/raw/callbacks/delegate.txt b/docs/raw/callbacks/delegate.txt new file mode 100644 index 00000000..8117f380 --- /dev/null +++ b/docs/raw/callbacks/delegate.txt @@ -0,0 +1,234 @@ +delegate + +etl::delegate is a type-safe, generic, and efficient delegate implementation. A delegate is essentially a type-safe function pointer. It can be used to encapsulate a callable unit (like a function, a function pointer, member function, or a callable object like a functor or a lambda function) and call it later. + +etl::delegate is similar in a lot of ways to std::function_ref introduced with C++26. + +The delegate functions may be defined at compile time and/or runtime, depending on the function type. +Most delegates can only be constructed via a create function, except lambdas and functors, which can be created by the delegate constructor. + +This may be used to implement a platform abstraction layer that allows an embedded application to interface with multiple hardware platforms. + +Here's a high-level overview of how etl::delegate works: +Creation: +When you create a delegate, you specify the function signature that it should match. This is done using template parameters. For example, etl::delegate creates a delegate that can hold references to functions that take an integer as an argument and return void. +Assignment: +You can assign a function to the delegate using the create method. The function you assign must match the delegate's function signature. For example, if you have a delegate of type etl::delegate, you could assign a function void myFunction(int) to it like this: +auto myDelegate = etl::delegate::create(); +Invocation: +Once a function has been assigned to the delegate, you can call that function through the delegate just like you would call a regular function. For example, if myDelegate is a delegate that holds a reference to myFunction, you could call myFunction through the delegate like this: myDelegate(123); +____________________________________________________________________________________________________ +Notes: +<=20.21.0 +This class only supports >=C++11. + +>=20.22.0 +This class is automatically selects C++03 or C++11 versions based on the value of ETL_USING_CPP11 +The C++03 variant only supports delegates taking 0 or 1 parameter. + +etl::delegate is non-owning. You cannot use lambdas that capture variables that will have gone out of scope when the delegate is called. This would result in dangling references. Lambdas are not copied; The delegate merely keeps pointers to lambdas. This also applies to functors. + +>=20.40.0 +Move constructors from lambdas or functors are disabled, thereby stopping a delegate being created from a temporary defined in aparameter. + +>=20.42.0 +etl::delegate is noexcept +____________________________________________________________________________________________________ +etl::delegate + +20.22.0 +For C++03 +etl::delegate +etl::delegate + +For the examples below, assume the following definitions. + +class Test +{ +public: + + int member_function(int); + static int member_static(int); + int operator()(int); + int operator()(int) const; +}; + +Test test; + +int global(int); + +auto lambda = [](int i){ return i; }; +____________________________________________________________________________________________________ +Public types + +return_type TReturn 20.43.0 +argument_types etl::type_list 20.43.0 +____________________________________________________________________________________________________ +Run time construction + +Lambdas +etl::delegate d(lambda); +etl::delegate d = lambda; +etl::delegate d = etl::delegate::create(lambda); + +d.set(lambda); + +Functors +etl::delegate d(test); +etl::delegate d = test; +etl::delegate d = etl::delegate::create(test); + +d.set(); + +Member functions +etl::delegate d = etl::delegate::create(test); + +d.set(test); +d.set(); +____________________________________________________________________________________________________ +Compile time construction + +Global functions +auto d = etl::delegate::create(); + +Member functions (if the instance is known at compile time) +auto d = etl::delegate::create(); // Deprecated +auto d = etl::delegate::create(); // New + +Functors (if the instance is known at compile time) +auto d = etl::delegate::create(); +auto d = etl::delegate::create(); +Note: These are disabled for GCC <= v8.1 as it generates an 'Internal Compiler Error'. + +Static member functions +auto d = etl::delegate::create(); +____________________________________________________________________________________________________ +Constexpr + +Most delegates can be declared as constexpr. (C++11 and above) +static Test test; +constexpr auto d = etl::delegate::create(); + +All create functions are constexpr under C++14. +All create functions are [[nodiscard]] under C++17. +____________________________________________________________________________________________________ +Calling the delegate + +The delegate may be called as a function with the defined parameter signature. + +etl::delegate d; + +int r = d(3); +____________________________________________________________________________________________________ +Operations + +ETL_CONSTEXPR14 delegate() +Constructs an uninitialised delegate. +____________________________________________________________________________________________________ +ETL_CONSTEXPR14 delegate(const delegate& other) +Copy constructs a delegate. +____________________________________________________________________________________________________ +ETL_CONSTEXPR14 TReturn operator()(TParams... args) const ETL_NOEXCEPT +Executes the delegate. +constexpr from 20.42.1 +____________________________________________________________________________________________________ +20.17.0 +ETL_CONSTEXPR14 bool call_if(TParams... args) const ETL_NOEXCEPT +For delegates returning void. +Calls the delegate if valid. +Returns true if valid, otherwise false. +constexpr from 20.42.2 + +ETL_CONSTEXPR14 etl::optional call_if(TParams... args) const ETL_NOEXCEPT +For delegates returning TReturn. +Calls the delegate if valid. +Returns a valid etl::optional containing the return value, if valid. +constexpr from 20.42.2 +____________________________________________________________________________________________________ +20.17.0 +template +ETL_CONSTEXPR14 TReturn call_or(TAlternative alternative, TParams... args) const ETL_NOEXCEPT +Calls the delegate if valid, otherwise calls alternative. +constexpr from 20.42.2 + +template +ETL_CONSTEXPR14 TReturn call_or(TParams... args) const ETL_NOEXCEPT +Calls the delegate if valid, otherwise calls Method. +____________________________________________________________________________________________________ +void clear() ETL_NOEXCEPT +Sets the delegate back to the uninitialised state. +____________________________________________________________________________________________________ +ETL_NODISCARD ETL_CONSTEXPR14 bool is_valid() const ETL_NOEXCEPT +ETL_CONSTEXPR14 operator bool() const +Returns true if the delegate has been initialised, otherwise false. +____________________________________________________________________________________________________ +ETL_CONSTEXPR14 operator =() ETL_NOEXCEPT +Assigns from another delegate or lambda. +____________________________________________________________________________________________________ +ETL_CONSTEXPR14 operator ==() ETL_NOEXCEPT +ETL_CONSTEXPR14 operator !=() ETL_NOEXCEPT +Compares delegates. +____________________________________________________________________________________________________ +make_delegate +For C++17 and above. +20.39.5 +____________________________________________________________________________________________________ +template +constexpr auto make_delegate() noexcept +Make a delegate from a free function. +Returns etl::delegate::create(); +____________________________________________________________________________________________________ +template +constexpr auto make_delegate(TLambda& instance) noexcept +Make a delegate from a functor or lambda function. +Returns etl::delegate(instance); +____________________________________________________________________________________________________ +template +constexpr auto make_delegate() noexcept +Make a delegate from a functor, compile time. +Returns etl::delegate::create(); +____________________________________________________________________________________________________ +template +constexpr auto make_delegate() noexcept +Make a delegate from a member function at compile time. +Returns etl::delegate::create(); +____________________________________________________________________________________________________ +template +constexpr auto make_delegate() noexcept +Make a delegate from a const member function at compile time. +Returns etl::delegate::create(); +____________________________________________________________________________________________________ +template +constexpr auto make_delegate(T& instance) noexcept +Make a delegate from a member function at run time. +Returns etl::delegate::create(instance); +____________________________________________________________________________________________________ +template +constexpr auto make_delegate(const T& instance) noexcept +Make a delegate from a member function at run time. +Returns etl::delegate::create(instance); + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/raw/callbacks/delegate_observable.txt b/docs/raw/callbacks/delegate_observable.txt new file mode 100644 index 00000000..5e40ea56 --- /dev/null +++ b/docs/raw/callbacks/delegate_observable.txt @@ -0,0 +1,79 @@ +delegate_observable + +etl::delegate_observable is a variation on the observer pattern idea, but using delegates as the callback mechanism. + +template +class delegate_observable + +TNotification is the notification type. +Max_Observers is the maximum number of observers that can be handled. +____________________________________________________________________________________________________ +Template deduction guide + +template +delegate_observable(TNotification, TDelegates...) + -> delegate_observable; + +Example +etl::delegate delegate1; +etl::delegate delegate2; + +etl::delegate_observable observable(int{}, delegate1, delegate2); +____________________________________________________________________________________________________ +Public types + +delegate_type The type of delegate used in this observer. +size_type The type used internally for sizes. +notification_type The type of the notification. +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR14 delegate_observable() +Default constructor. +____________________________________________________________________________________________________ +template +ETL_CONSTEXPR14 delegate_observable(TDelegate&&... delegates) +Construct from a collection of observers. +____________________________________________________________________________________________________ +template +ETL_CONSTEXPR14 delegate_observable(notification_type, TDelegate&&... delegates) +Construct from notification type and a list of observers. +Variant for template deduction guide. +The notification value is ignored. It is here to allow deduction of the notification type for the template deduction guide. +____________________________________________________________________________________________________ +Modifiers + +ETL_CONSTEXPR14 bool add_observer(delegate_type observer) +Add an observer to the list. +Returns true if the observer was removed, false if not. +____________________________________________________________________________________________________ +ETL_CONSTEXPR14 bool remove_observer(const delegate_type& observer) +Remove a particular observer from the list. +Returns true if the observer was removed, false if not. +____________________________________________________________________________________________________ +ETL_CONSTEXPR14 void clear_observers() +Clear all observers. +____________________________________________________________________________________________________ +Status + +ETL_CONSTEXPR14 size_type number_of_observers() const +Returns the number of observers. +____________________________________________________________________________________________________ +Notofication + +ETL_CONSTEXPR14 void notify_observers(notification_type n) const +Notify all of the observers, sending them the notification. + + + + + + + + + + + + + + diff --git a/docs/raw/callbacks/function.txt b/docs/raw/callbacks/function.txt new file mode 100644 index 00000000..d4daa9e8 --- /dev/null +++ b/docs/raw/callbacks/function.txt @@ -0,0 +1,104 @@ +function +Note: This class is deprecated. Please use the more versatile etl::delegate class here. + +A set of wrapper templates to allow a member or static function to be called without the caller having to know the specific details of the callee apart from the parameter type. The templates allow the called function to be abstracted. + +This may be used to implement a platform abstraction layer that allows an embedded application to interface with multiple hardware platforms. + +etl::function Callbacks to free or member functions taking zero or one parameter. + Function pointer at runtime. + +etl::function_fv Callback to a free function taking no parameters. (Functiion Void) + Function pointer at compile time. + +etl::function_fp Callback to a free function taking one parameter. (Functiion Parameter) + Function pointer at compile time. + +etl::function_mv Callback to a member function taking no parameters. (Member Void) + Function pointer at compile time. + +etl::function_imv Callback to a member function taking no parameters. (Instance Member Void) + Instance reference and function pointer at compile time. + +etl::function_mp Callback to a member function taking one parameter. (Member Parameter) + Function pointer at compile time. + +etl::function_imp Callback to a member function taking one parameter. (Instance Member Parameter) + Instance reference and function pointer at compile time. + +See the tutorial. + +____________________________________________________________________________________________________ +Interface classes. + +template +class ifunction + +Interface class for a function taking one parameter. +____________________________________________________________________________________________________ +template <> +class ifunction + +Interface class for a function taking no parameters. + +All of the following classes are derived from the above. + +____________________________________________________________________________________________________ +Function address at run time. +The functions are called indirectly through an internal pointer. + +template +class function : public ifunction + +Class for a member function taking one parameter. +____________________________________________________________________________________________________ +template +class function : public ifunction + +Class for a member function taking no parameters. +____________________________________________________________________________________________________ +template +class function : public ifunction + +Class for a free function taking one parameter. +____________________________________________________________________________________________________ +template <> +class function : public ifunction + +Class for a free function taking no parameters. + +____________________________________________________________________________________________________ +Function address at compile time. +These will be more efficient than the previous definitions, as the one level of indirection is eliminated. + +template +class function_mv : public ifunction + +Class for a member function taking no parameters. +____________________________________________________________________________________________________ + +template +class function_imv : public ifunction + +Class for a member function taking no parameters. +____________________________________________________________________________________________________ +template +class function_mp : public ifunction + +Class for a member function taking one parameter. +____________________________________________________________________________________________________ +template +class function_imp : public ifunction + +Class for a member function taking one parameter. +____________________________________________________________________________________________________ +template +class function_fv : public ifunction + +Class for a free function taking no parameters. +____________________________________________________________________________________________________ +template +class function_fp : public ifunction + +Class for a free function taking one parameter. + diff --git a/docs/raw/chrono/Chrono literals.txt b/docs/raw/chrono/Chrono literals.txt new file mode 100644 index 00000000..5c8f1003 --- /dev/null +++ b/docs/raw/chrono/Chrono literals.txt @@ -0,0 +1,36 @@ +Chrono literals +Back to chrono + +The ETL Chrono literals are define slightly differently from the STL in that they are user defined, as opposed to language defined. + +Example:- +For STL, the literal to define year 2025 would be 2025y. +For ETL, the literal is 2025_y. + +By default, the ETL uses the designations of the STL. +As this may clash with other user defined literals, the ETL allows more verbose forms to be used, by defining the macro ETL_USE_VERBOSE_CHRONO_LITERALS. +If enabled, the example of 2025_y would be written as 2025_year. + +Duration type STL like Verbose +etl::chrono::year 2025_y 2025_year +etl::chrono::day 10_d 10_day +etl::chrono::hours 14_h 14_hours +etl::chrono::minutes 30_min 30_minutes +etl::chrono::seconds 45_s 45_seconds +etl::chrono::milliseconds 500_ms 500_milliseconds +etl::chrono::microseconds 500_us 500_microseconds +etl::chrono::nanoseconds 500_ns 500_nanoseconds + +Chrono literals may by accessed by using one of the following:- + +using namespace etl::chrono; +using namespace etl::literals; +using namespace etl::chrono_literals; + + + + + + + + diff --git a/docs/raw/chrono/Clocks.txt b/docs/raw/chrono/Clocks.txt new file mode 100644 index 00000000..aeb2522d --- /dev/null +++ b/docs/raw/chrono/Clocks.txt @@ -0,0 +1,94 @@ +Clocks +Back to chrono +____________________________________________________________________________________________________ +Macros +Default macro definitions. +Define these in etl_profile.h to set your own duration types for the clocks. + +ETL_CHRONO_SYSTEM_CLOCK_DURATION etl::chrono::nanoseconds +ETL_CHRONO_SYSTEM_CLOCK_IS_STEADY true +ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION etl::chrono::nanoseconds +ETL_CHRONO_HIGH_RESOLUTION_CLOCK_IS_STEADY true +ETL_CHRONO_STEADY_CLOCK_DURATION etl::chrono::nanoseconds +____________________________________________________________________________________________________ +Platform clock access +Declarations of the functions that must be defined to interface the clocks with the underlying platform. + +extern "C" ETL_CHRONO_SYSTEM_CLOCK_DURATION::rep etl_get_system_clock(); +extern "C" ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION::rep etl_get_high_resolution_clock(); +extern "C" ETL_CHRONO_STEADY_CLOCK_DURATION::rep etl_get_steady_clock(); + +These functions must return the current count of the underlying clock. The value is in terms of the +clock duration defined for that clock. + +Example: +If the system_clock duration is set to etl::chrono::nanoseconds, then a return value of 1000 represents 1000ns. +____________________________________________________________________________________________________ +system_clock + +class system_clock + +Member types +using duration = ETL_CHRONO_SYSTEM_CLOCK_DURATION +using rep = duration::rep +using period = duration::period +using time_point = time_point + +Member functions +static time_point now() ETL_NOEXCEPT +static time_t to_time_t(const time_point& t) ETL_NOEXCEPT +static time_point from_time_t(time_t t) ETL_NOEXCEPT +____________________________________________________________________________________________________ +high_resolution_clock + +class high_resolution_clock + +Member types +using duration = ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION +using rep = duration::rep +using period = duration::period +using time_point = time_point + +Member functions +static time_point now() ETL_NOEXCEPT +____________________________________________________________________________________________________ +steady_clock + +class steady_clock + +Member types +using duration = ETL_CHRONO_STEADY_CLOCK_DURATION +using rep = duration::rep +using period = duration::period +using time_point = time_point + +Member functions +static time_point now() ETL_NOEXCEPT +____________________________________________________________________________________________________ +system_time + +template +using sys_time = etl::chrono::time_point + +using sys_seconds = sys_time +using sys_days = sys_time +____________________________________________________________________________________________________ +local_time + +struct local_t + +template +using local_time = etl::chrono::time_point + +using local_seconds = local_time +using local_days = local_time +____________________________________________________________________________________________________ +clock_cast + +Cast a time point from one clock to another. +This implementation assumes all clock epochs are the same. + +template +ETL_CONSTEXPR14 etl::chrono::time_point + clock_cast(const etl::chrono::time_point& from_time_point) ETL_NOEXCEPT + diff --git a/docs/raw/chrono/Operators.txt b/docs/raw/chrono/Operators.txt new file mode 100644 index 00000000..d14f4fca --- /dev/null +++ b/docs/raw/chrono/Operators.txt @@ -0,0 +1,224 @@ +Operators +Operators for building dates. +Back to chrono +____________________________________________________________________________________________________ +month_day + +Create from month and day. + +ETL_CONSTEXPR14 +etl::chrono::month_day operator /(const etl::chrono::month& m, + const etl::chrono::day& d) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_day operator /(const etl::chrono::month& m, + int d) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_day operator /(int m, + const etl::chrono::day& d) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_day operator /(const etl::chrono::day& d, + const etl::chrono::month& m) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_day operator /(const etl::chrono::day& d, + int m) +ETL_NOEXCEPT +____________________________________________________________________________________________________ +month_day_last + +ETL_CONSTEXPR14 +etl::chrono::month_day_last operator /(const etl::chrono::month& m, + etl::chrono::last_spec) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_day_last operator /(int m, + etl::chrono::last_spec) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_day_last operator /(etl::chrono::last_spec, + const etl::chrono::month& m) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_day_last operator /(etl::chrono::last_spec, + int m) +ETL_NOEXCEPT +____________________________________________________________________________________________________ +month_weekday + +ETL_CONSTEXPR14 +etl::chrono::month_weekday operator /(const etl::chrono::month& m, + const etl::chrono::weekday_indexed& wdi) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_weekday operator /(int m, + const etl::chrono::weekday_indexed& wdi) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_weekday operator /(const etl::chrono::weekday_indexed& wdi, + const etl::chrono::month& m) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_weekday operator /(const etl::chrono::weekday_indexed& wdi, + int m) +ETL_NOEXCEPT +____________________________________________________________________________________________________ +month_weekday_last + +ETL_CONSTEXPR14 +etl::chrono::month_weekday_last operator /(const etl::chrono::month& m, + const etl::chrono::weekday_last& wdl) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_weekday_last operator /(int m, + const etl::chrono::weekday_last& wdl) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_weekday_last operator /(const etl::chrono::weekday_last& wdl, + const etl::chrono::month& m) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::month_weekday_last operator /(const etl::chrono::weekday_last& wdl, + int m) +ETL_NOEXCEPT + +____________________________________________________________________________________________________ +year_month + +ETL_CONSTEXPR14 +etl::chrono::year_month operator /(const etl::chrono::year& y, + const etl::chrono::month& m) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month operator /(const etl::chrono::year& y, + int m) +ETL_NOEXCEPT +____________________________________________________________________________________________________ +year_month_day + +ETL_CONSTEXPR14 etl::chrono::year_month_day operator /(const etl::chrono::year_month& ym, + const etl::chrono::day& d) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 etl::chrono::year_month_day operator /(const etl::chrono::year_month& ym, + int d ) +ETL_NOEXCEPT +____________________________________________________________________________________________________ +year_month_day + +ETL_CONSTEXPR14 +etl::chrono::year_month_day operator /(const etl::chrono::year& y, + const etl::chrono::month_day& md) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_day operator /(int y, + const etl::chrono::month_day& md) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_day operator /(const etl::chrono::month_day& md, + const etl::chrono::year& y) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_day operator /(const etl::chrono::month_day& md, + int y) +ETL_NOEXCEPT +____________________________________________________________________________________________________ +year_month_day_last + +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last operator /(const etl::chrono::year_month& ym, + etl::chrono::last_spec) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last operator /(const etl::chrono::year& y, + const etl::chrono::month_day_last& mdl) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last operator /(int y, + const etl::chrono::month_day_last& mdl) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last operator /(const etl::chrono::month_day_last& mdl, + const etl::chrono::year& y) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last operator /(const etl::chrono::month_day_last& mdl, + int y) +ETL_NOEXCEPT +____________________________________________________________________________________________________ +year_month_weekday + +ETL_CONSTEXPR14 +etl::chrono::year_month_weekday operator /(const etl::chrono::year_month& ym, + const etl::chrono::weekday_indexed& wdi) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_weekday operator /(const etl::chrono::year& y, + const etl::chrono::month_weekday& mwd) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_weekday operator /(int y, + const etl::chrono::month_weekday& mwd) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_weekday operator /(const etl::chrono::month_weekday& mwd, + const etl::chrono::year& y) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_weekday operator /(const etl::chrono::month_weekday& mwd, + int y) +ETL_NOEXCEPT +____________________________________________________________________________________________________ +year_month_weekday_last + +ETL_CONSTEXPR14 +etl::chrono::year_month_weekday_last operator /(const etl::chrono::year_month& ym, + const etl::chrono::weekday_last& wdl) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_weekday_last operator /(const etl::chrono::year& y, + const etl::chrono::month_weekday_last& mwdl) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_weekday_last operator /(int y, + const etl::chrono::month_weekday_last& mwdl) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_weekday_last operator /(const etl::chrono::month_weekday_last& mwdl, + const etl::chrono::year& y) +ETL_NOEXCEPT + +ETL_CONSTEXPR14 +etl::chrono::year_month_weekday_last operator /(const etl::chrono::month_weekday_last& mwdl, + int y) +ETL_NOEXCEPT diff --git a/docs/raw/chrono/day.txt b/docs/raw/chrono/day.txt new file mode 100644 index 00000000..406b9796 --- /dev/null +++ b/docs/raw/chrono/day.txt @@ -0,0 +1,197 @@ +day +A template representing a day. +Back to chrono +____________________________________________________________________________________________________ +day + +STL equivalent: std::chrono::day + +class day +____________________________________________________________________________________________________ +Typesdefs +rep The internal representation. +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR +day() +ETL_NOEXCEPT +Default constructor. +______________________________________________ +ETL_CONSTEXPR +explicit day(unsigned value) +ETL_NOEXCEPT +Construct from unsigned. +______________________________________________ +ETL_CONSTEXPR14 +day(const etl::chrono::day& other) +ETL_NOEXCEPT +Copy constructor. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the day is within the valid range. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +int compare(const etl::chrono::day& other) const +ETL_NOEXCEPT +Compare day with another. +if day < other, returns -1 +else if day > other, returns 1 +else returns 0 +____________________________________________________________________________________________________ +Assignment + +ETL_CONSTEXPR14 +etl::chrono::day& operator =(const etl::chrono::day& rhs) +ETL_NOEXCEPT +Assignment operator +____________________________________________________________________________________________________ +Increment/decrement + +ETL_CONSTEXPR14 +etl::chrono::day& operator ++() +ETL_NOEXCEPT +Pre-increment operator. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::day operator ++(int) +ETL_NOEXCEPT +Post-increment operator. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::day& operator --() +ETL_NOEXCEPT +Pre-decrement operator. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::day operator --(int) +ETL_NOEXCEPT +Post-decrement operator. +____________________________________________________________________________________________________ +Mathematical operators + +ETL_CONSTEXPR14 +etl::chrono::day& operator +=(const etl::chrono::days& ms) +ETL_NOEXCEPT +Plus-equals operator adding etl::chrono::days. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::day& operator -=(const etl::chrono::days& ms) +ETL_NOEXCEPT +Minus-equals operator subtracting etl::chrono::days. +____________________________________________________________________________________________________ +Conversion + +ETL_CONSTEXPR14 +operator unsigned() const +ETL_NOEXCEPT +Conversion operator to unsigned int. +____________________________________________________________________________________________________ +Non-member mathematical operators + +ETL_CONSTEXPR14 +etl::chrono::day operator +(const etl::chrono::day& m, + const etl::chrono::days& ms) +ETL_NOEXCEPT +Add etl::chrono::days to etl::chrono::day. +Returns etl::chrono::day. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::day operator +(const etl::chrono::days& ms, + const etl::chrono::day& m) +ETL_NOEXCEPT +Add etl::chrono::day to etl::chrono::days. +Returns etl::chrono::day. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::day operator -(const etl::chrono::day& m, + const etl::chrono::days& ms) +ETL_NOEXCEPT +Subtract etl::chrono::days from etl::chrono::day. +Returns etl::chrono::day. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::day operator -(const etl::chrono::days& ms, + const etl::chrono::day& m) +ETL_NOEXCEPT +Subtract etl::chrono::day from etl::chrono::days. +Returns etl::chrono::days. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::days operator -(const etl::chrono::day& m1, + const etl::chrono::day& m2) ETL_NOEXCEPT +Subtract etl::chrono::day from etl::chrono::day. +Returns etl::chrono::days. +____________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::day& m1, + const etl::chrono::day& m2) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::day& m1, + const etl::chrono::day& m2) +ETL_NOEXCEPT +Inequality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::day& m1, + const etl::chrono::day& m2) +ETL_NOEXCEPT +Less-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::day& m1, + const etl::chrono::day& m2) +ETL_NOEXCEPT +Less-than-or-equal operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator >(const etl::chrono::day& m1, + const etl::chrono::day& m2) +ETL_NOEXCEPT +Greater-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator >=(const etl::chrono::day& m1, + const etl::chrono::day& m2) +ETL_NOEXCEPT +Greater-than-or-equal operator. +______________________________________________ +[[nodiscard]] inline constexpr +auto operator <=>(const etl::chrono::day& m1, + const etl::chrono::day& m2) +noexcept +Spaceship operator. +C++20 +____________________________________________________________________________________________________ +Defined days + +etl::chrono::January +etl::chrono::February +etl::chrono::March +etl::chrono::April +etl::chrono::May +etl::chrono::June +etl::chrono::July +etl::chrono::August +etl::chrono::September +etl::chrono::October +etl::chrono::November +etl::chrono::December +____________________________________________________________________________________________________ +Hash + +template <> +struct hash +Hash function for etl::chrono::day + diff --git a/docs/raw/chrono/duration.txt b/docs/raw/chrono/duration.txt new file mode 100644 index 00000000..a56d8dfc --- /dev/null +++ b/docs/raw/chrono/duration.txt @@ -0,0 +1,335 @@ +duration +Templates representing a time intervals. +Back to chrono +____________________________________________________________________________________________________ +duration_values + +STL equivalent: std::chrono::duration_values + +template +struct duration_values + +ETL_NODISCARD static ETL_CONSTEXPR TRep zero() ETL_NOEXCEPT +Returns TRep(0) +______________________________________________ +ETL_NODISCARD static ETL_CONSTEXPR14 TRep min() ETL_NOEXCEPT +Returns etl::numeric_limits::min() +______________________________________________ +ETL_NODISCARD static ETL_CONSTEXPR14 TRep max() ETL_NOEXCEPT +Returns etl::numeric_limits::max() + +____________________________________________________________________________________________________ +duration + +STL equivalent: std::chrono::duration + +template > +class duration +______________________________________________ +using rep = TRep +using period = typename TPeriod::type; +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR +duration() +ETL_NOEXCEPT +Default constructor. +______________________________________________ +ETL_CONSTEXPR14 +duration(const etl::chrono::duration& other) +ETL_NOEXCEPT +______________________________________________ +template +ETL_CONSTEXPR14 +explicit duration(const TRep2& value) +ETL_NOEXCEPT +______________________________________________ +template +ETL_CONSTEXPR14 +duration(const etl::chrono::duration& other) +ETL_NOEXCEPT +Construct from another duration type. +Enabled if etl::ratio_divide::den == 1 +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +int compare(const time_point& other) const +ETL_NOEXCEPT +Compare day with another. +if time_point < other, returns -1 +else if time_point > other, returns 1 +else returns 0 +____________________________________________________________________________________________________ +Assignment + +ETL_CONSTEXPR14 +etl::chrono::duration operator =(const etl::chrono::duration& other) ETL_NOEXCEPT +______________________________________________ +template +ETL_CONSTEXPR14 +etl::chrono::duration operator =(const etl::chrono::duration& other) ETL_NOEXCEPT +____________________________________________________________________________________________________ +Convertion + +ETL_CONSTEXPR14 +TRep count() const +ETL_NOEXCEPT +Returns the duration count as a numeric. +______________________________________________ +ETL_CONSTEXPR14 +etl::common_type_t operator +() const +ETL_NOEXCEPT +Implements unary plus. +______________________________________________ +ETL_CONSTEXPR14 +etl::common_type_t operator -() const +ETL_NOEXCEPT +Implements unary minus. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::duration absolute() const +ETL_NOEXCEPT +Returns the absolute value of the duration. +____________________________________________________________________________________________________ +Constants + +ETL_NODISCARD +static ETL_CONSTEXPR14 etl::chrono::duration zero() +ETL_NOEXCEPT +Returns the duration zero value. +______________________________________________ +ETL_NODISCARD +static ETL_CONSTEXPR14 etl::chrono::duration min() +ETL_NOEXCEPT +Returns the minimum duration value. +______________________________________________ +ETL_NODISCARD +static ETL_CONSTEXPR14 etl::chrono::duration max() +ETL_NOEXCEPT +Returns the maximum duration value. +____________________________________________________________________________________________________ +Increment/decrement + +ETL_CONSTEXPR14 +duration& operator ++() +ETL_NOEXCEPT +Pre-increments the duration count. +______________________________________________ +ETL_CONSTEXPR14 +duration operator ++(int) +ETL_NOEXCEPT +Post-increments the duration count. +______________________________________________ +ETL_CONSTEXPR14 +duration& operator --() +ETL_NOEXCEPT +Pre-decrements the duration count. +______________________________________________ +ETL_CONSTEXPR14 +duration operator --(int) +ETL_NOEXCEPT +Post-decrements the duration count. +____________________________________________________________________________________________________ +Mathematical operators + +ETL_CONSTEXPR14 +duration& operator +=(const duration& d) +ETL_NOEXCEPT +Adds duration d to this duration. +______________________________________________ +ETL_CONSTEXPR14 +duration& operator -=(const duration& d) +ETL_NOEXCEPT +Subtracts duration d to this duration. +______________________________________________ +ETL_CONSTEXPR14 +duration& operator *=(const TRep& r) +ETL_NOEXCEPT +Multiplies this duration by r. +______________________________________________ +ETL_CONSTEXPR14 +duration& operator /=(const TRep& r) +ETL_NOEXCEPT +Divides this duration by r. +______________________________________________ +ETL_CONSTEXPR14 +duration& operator %=(const TRep& r) +ETL_NOEXCEPT +Sets this duration to the modulus of r. +______________________________________________ +ETL_CONSTEXPR14 +duration& operator %=(const duration& d) +ETL_NOEXCEPT +Sets this duration to the modulus of duration d. +____________________________________________________________________________________________________ +Comparison + +template +ETL_CONSTEXPR14 +int compare(const duration& other) const +ETL_NOEXCEPT +Compare duration with another. +If duration < other, returns -1 +else if duration > other, returns 1 +else returns 0 +____________________________________________________________________________________________________ +Non-member mathematical operators + +template +ETL_CONSTEXPR14 +etl::common_type_t, + etl::chrono::duration> +operator +(const etl::chrono::duration& lhs, + const etl::chrono::duration& rhs) +ETL_NOEXCEPT +Operator + +______________________________________________ +template +ETL_CONSTEXPR14 +etl::common_type_t, + etl::chrono::duration >::type +operator -(const etl::chrono::duration& lhs, + const etl::chrono::duration& rhs) +ETL_NOEXCEPT +Operator - +______________________________________________ +template +ETL_CONSTEXPR14 +etl::chrono::duration, TPeriod1>> +operator *(const etl::chrono::duration& lhs, + const TRep2& rhs) +ETL_NOEXCEPT +Operator * +Enabled if TRep2 is not a specialization of etl::chrono::duration. +______________________________________________ +template +ETL_CONSTEXPR14 +etl::chrono::duration, TPeriod2> +operator *(const TRep1& lhs, + const etl::chrono::duration& rhs) +ETL_NOEXCEPT +Operator * +______________________________________________ +template +ETL_CONSTEXPR14 +etl::common_type_t, TPeriod1> +operator /(const etl::chrono::duration& lhs, + const TRep2& rhs) +ETL_NOEXCEPT +Operator / +Enabled if TRep2 is not a specialization of etl::chrono::duration. +______________________________________________ +template +ETL_CONSTEXPR14 +etl::common_type_t +operator /(const etl::chrono::duration& lhs, + const etl::chrono::duration& rhs) +ETL_NOEXCEPT +Operator / +______________________________________________ +template +ETL_CONSTEXPR14 +etl::chrono::duration, TPeriod1> +operator %(const etl::chrono::duration& lhs, + const TRep2& rhs) +ETL_NOEXCEPT +Operator % +______________________________________________ +template +ETL_CONSTEXPR14 +etl::common_type_t, + etl::chrono::duration> +operator %(const etl::chrono::duration& lhs, + const etl::chrono::duration& rhs) +ETL_NOEXCEPT +Operator % +____________________________________________________________________________________________________ +Non-member comparison operators + +template +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::duration& lhs, + const etl::chrono::duration& rhs) +ETL_NOEXCEPT +Checks for equality. +______________________________________________ +template +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::duration& lhs, + const etl::chrono::duration& rhs) +ETL_NOEXCEPT +Checks for inequality. +______________________________________________ +template +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::duration& lhs, + const etl::chrono::duration& rhs) +ETL_NOEXCEPT +Checks for less-than. +______________________________________________ +template +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::duration& lhs, + const etl::chrono::duration& rhs) +ETL_NOEXCEPT +Checks for less-than-or-equal. +______________________________________________ +template +ETL_CONSTEXPR14 +bool operator >(const etl::chrono::duration& lhs, + const etl::chrono::duration& rhs) +ETL_NOEXCEPT +Checks for greater-than. +______________________________________________ +template +ETL_CONSTEXPR14 +bool operator >=(const etl::chrono::duration& lhs, + const etl::chrono::duration& rhs) +ETL_NOEXCEPT +Checks for greater-than-or-equal. +______________________________________________ +template +[[nodiscard]] +constexpr +auto operator <=>(const etl::chrono::duration& lhs, + const etl::chrono::duration& rhs) +noexcept +Spaceship operator. +C++20 +____________________________________________________________________________________________________ +common_type + +template +struct common_type, etl::chrono::duration> +etl::common_type specialisation for etl::duration. +____________________________________________________________________________________________________ +Hash + +template +struct hash> +____________________________________________________________________________________________________ +Pre-defined duration types + +etl::chrono::years +etl::chrono::months +etl::chrono::weeks +etl::chrono::days +etl::chrono::hours +etl::chrono::minutes +etl::chrono::seconds +etl::chrono::milliseconds +etl::chrono::microseconds +etl::chrono::nanoseconds +____________________________________________________________________________________________________ +duration_cast + +template +ETL_CONSTEXPR14 +TToDuration duration_cast(const etl::chrono::duration& d) +ETL_NOEXCEPT +Converts from one duration type to another. + diff --git a/docs/raw/chrono/hh_mm_ss.txt b/docs/raw/chrono/hh_mm_ss.txt new file mode 100644 index 00000000..f7db1ebc --- /dev/null +++ b/docs/raw/chrono/hh_mm_ss.txt @@ -0,0 +1,87 @@ +hh_mm_ss +A type to hold hous, minutes, and seconds. +Back to chrono +____________________________________________________________________________________________________ +absolute + +template +ETL_NODISCARD +ETL_CONSTEXPR14 +TDuration absolute(TDuration dur) +ETL_NOEXCEPT +A specialisation of absolute for etl::chrono::duration. +Returns the absolute duration value. +____________________________________________________________________________________________________ +hh_mm_ss + +template +class hh_mm_ss + +Static asserts if TDuration is not a specialisation of etl::chrono::duration. +____________________________________________________________________________________________________ +Class constant + +static constexpr int fractional_width; +The number of fractional digits. +____________________________________________________________________________________________________ +Class type + +precision +The return type for to_duration. +____________________________________________________________________________________________________ +Constructors + +ETL_CONSTEXPR +hh_mm_ss() +ETL_NOEXCEPT +Default constructor. +______________________________________________ +ETL_CONSTEXPR14 +explicit hh_mm_ss(TDuration d) +ETL_NOEXCEPT +Construct from duration. + ____________________________________________________________________________________________________ +Access + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool is_negative() const +ETL_NOEXCEPT +Checks for negative duration. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::hours hours() const +ETL_NOEXCEPT +Returns the hours. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::minutes minutes() const +ETL_NOEXCEPT +Returns the minutes. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::seconds seconds() const +ETL_NOEXCEPT +Returns the seconds. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +precision subseconds() const +ETL_NOEXCEPT +Returns the subseconds. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +explicit operator precision() const +ETL_NOEXCEPT +Returns the duration. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +precision to_duration() const +ETL_NOEXCEPT +Returns the duration. + diff --git a/docs/raw/chrono/last_spec.txt b/docs/raw/chrono/last_spec.txt new file mode 100644 index 00000000..9acf616d --- /dev/null +++ b/docs/raw/chrono/last_spec.txt @@ -0,0 +1,17 @@ +last_spec +last_spec is a tag type that is used in conjunction with other calendar types to indicate the last thing in a sequence. +Back to chrono +____________________________________________________________________________________________________ +last_spec + +struct last_spec +{ + explicit last_spec() = default; +}; + +inline constexpr last_spec last{}; + +Example: + +2025_y/March/last for last day of March 2025 i.e. 2025-03-31 + diff --git a/docs/raw/chrono/month.txt b/docs/raw/chrono/month.txt new file mode 100644 index 00000000..c507f668 --- /dev/null +++ b/docs/raw/chrono/month.txt @@ -0,0 +1,213 @@ +month +A template representing a month. +Back to chrono +____________________________________________________________________________________________________ +month + +STL equivalent: std::chrono::month + +class month +____________________________________________________________________________________________________ +Typesdefs +rep The internal representation. +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR +month() +ETL_NOEXCEPT +Default constructor. +______________________________________________ +ETL_CONSTEXPR +explicit month(unsigned value) +ETL_NOEXCEPT +Construct from unsigned. +______________________________________________ +ETL_CONSTEXPR14 +month(const etl::chrono::month& other) +ETL_NOEXCEPT +Copy constructor. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the month is in range. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +int compare(const etl::chrono::month& other) const +ETL_NOEXCEPT +Compare month with another. +if month < other, returns -1 +else if month > other, returns 1 +else returns 0 +____________________________________________________________________________________________________ +Assignment + +ETL_CONSTEXPR14 +etl::chrono::month& operator =(const etl::chrono::month& rhs) +ETL_NOEXCEPT +Assignment operator +____________________________________________________________________________________________________ +Increment/decrement + +ETL_CONSTEXPR14 +etl::chrono::month& operator ++() +ETL_NOEXCEPT +Pre-increment operator. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::month operator ++(int) +ETL_NOEXCEPT +Post-increment operator. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::month& operator --() +ETL_NOEXCEPT +Pre-decrement operator. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::month operator --(int) +ETL_NOEXCEPT +Post-decrement operator. +____________________________________________________________________________________________________ +Mathematical operators + +ETL_CONSTEXPR14 +etl::chrono::month& operator +=(const etl::chrono::months& ms) +ETL_NOEXCEPT +Plus-equals operator adding etl::chrono::months. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::month& operator -=(const etl::chrono::months& ms) +ETL_NOEXCEPT +Minus-equals operator subtracting etl::chrono::months. +____________________________________________________________________________________________________ +Constants + +ETL_NODISCARD +static +ETL_CONSTEXPR14 +etl::chrono::month min() +ETL_NOEXCEPT +The minimum month value for which ok() will return true. +______________________________________________ +ETL_NODISCARD +static +ETL_CONSTEXPR14 +etl::chrono::month max() +ETL_NOEXCEPT +The maximum month value for which ok() will return true. +____________________________________________________________________________________________________ +Conversion + +ETL_CONSTEXPR14 +operator unsigned() const +ETL_NOEXCEPT +Conversion operator to unsigned int. +____________________________________________________________________________________________________ +Non-member mathematical operators + +ETL_CONSTEXPR14 +etl::chrono::month operator +(const etl::chrono::month& m, + const etl::chrono::months& ms) +ETL_NOEXCEPT +Add etl::chrono::months to etl::chrono::month. +Returns etl::chrono::month. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::month operator +(const etl::chrono::months& ms, + const etl::chrono::month& m) +ETL_NOEXCEPT +Add etl::chrono::month to etl::chrono::months. +Returns etl::chrono::month. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::month operator -(const etl::chrono::month& m, + const etl::chrono::months& ms) +ETL_NOEXCEPT +Subtract etl::chrono::months from etl::chrono::month. +Returns etl::chrono::month. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::month operator -(const etl::chrono::months& ms, + const etl::chrono::month& m) +ETL_NOEXCEPT +Subtract etl::chrono::month from etl::chrono::months. +Returns etl::chrono::months. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::months operator -(const etl::chrono::month& m1, + const etl::chrono::month& m2) ETL_NOEXCEPT +Subtract etl::chrono::month from etl::chrono::month. +Returns etl::chrono::months. +____________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::month& m1, + const etl::chrono::month& m2) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::month& m1, + const etl::chrono::month& m2) +ETL_NOEXCEPT +Inequality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::month& m1, + const etl::chrono::month& m2) +ETL_NOEXCEPT +Less-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::month& m1, + const etl::chrono::month& m2) +ETL_NOEXCEPT +Less-than-or-equal operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator >(const etl::chrono::month& m1, + const etl::chrono::month& m2) +ETL_NOEXCEPT +Greater-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator >=(const etl::chrono::month& m1, + const etl::chrono::month& m2) +ETL_NOEXCEPT +Greater-than-or-equal operator. +______________________________________________ +[[nodiscard]] inline constexpr +auto operator <=>(const etl::chrono::month& m1, + const etl::chrono::month& m2) +noexcept +Spaceship operator. +C++20 +____________________________________________________________________________________________________ +Defined months + +etl::chrono::January +etl::chrono::February +etl::chrono::March +etl::chrono::April +etl::chrono::May +etl::chrono::June +etl::chrono::July +etl::chrono::August +etl::chrono::September +etl::chrono::October +etl::chrono::November +etl::chrono::December +____________________________________________________________________________________________________ +Hash + +template <> +struct hash +Hash function for etl::chrono::month + diff --git a/docs/raw/chrono/month_day.txt b/docs/raw/chrono/month_day.txt new file mode 100644 index 00000000..72a436b1 --- /dev/null +++ b/docs/raw/chrono/month_day.txt @@ -0,0 +1,104 @@ +month_day +A template representing a month and day. +Back to chrono +____________________________________________________________________________________________________ +month_day + +STL equivalent: std::chrono::month_day + +class month_day +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR +month_day() +Default constructor. +______________________________________________ +ETL_CONSTEXPR14 +month_day(const etl::chrono::month& m, + const etl::chrono::day& d) +ETL_NOEXCEPT +Construct from month and day. +____________________________________________________________________________________________________ +Access + +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::month month() const +ETL_NOEXCEPT +Returns the month. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::day day() const +ETL_NOEXCEPT +Returns the day. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the month and day is within the valid limits. +______________________________________________ +ETL_CONSTEXPR14 +int compare(const month_day& other) const +ETL_NOEXCEPT +Compare month_day with another. +if month < other.month, returns -1 +else if month > other.month, returns 1 +else if day < other.day, returns -1 +else if day > other.day, returns 1 +else returns 0 +____________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::month_day& lhs, + const etl::chrono::month_day& rhs) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::month_day& lhs, + const etl::chrono::month_day& rhs) +ETL_NOEXCEPT +Inequality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::month_day& lhs, + const etl::chrono::month_day& rhs) +ETL_NOEXCEPT +Less-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::month_day& lhs, + const etl::chrono::month_day& rhs) +ETL_NOEXCEPT +Less-than-equal operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::month_day& lhs, + const etl::chrono::month_day& rhs) +ETL_NOEXCEPT +Greater-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::month_day& lhs, + const etl::chrono::month_day& rhs) +ETL_NOEXCEPT +Greater-than-equal operator. +______________________________________________ +[[nodiscard]] constexpr +auto operator <=>(const etl::chrono::month_day& lhs, + const etl::chrono::month_day& rhs) +ETL_NOEXCEPT +Spaceship operator +____________________________________________________________________________________________________ +Hash + +template +struct hash +Hash function for etl::chrono::month_day + diff --git a/docs/raw/chrono/month_day_last.txt b/docs/raw/chrono/month_day_last.txt new file mode 100644 index 00000000..0668d466 --- /dev/null +++ b/docs/raw/chrono/month_day_last.txt @@ -0,0 +1,91 @@ +month_day_last +A template representing a month and day. +Back to chrono +____________________________________________________________________________________________________ +month_day_last + +STL equivalent: std::chrono::month_day_last + +class month_day_last +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR14 +explicit month_day_last(const etl::chrono::month& m) +ETL_NOEXCEPT +Construct from month. +____________________________________________________________________________________________________ +Access + +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::month month() const +ETL_NOEXCEPT +Returns the month. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the month is within the valid limits. +______________________________________________ +ETL_CONSTEXPR14 +int compare(const month_day_last& other) const +ETL_NOEXCEPT +Compare month_day_last with another. +if month < other.month, returns -1 +else if month > other.month, returns 1 +else returns 0 +____________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::month_day_last& lhs, + const etl::chrono::month_day_last& rhs) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::month_day_last& lhs, + const etl::chrono::month_day_last& rhs) +ETL_NOEXCEPT +Inequality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::month_day_last& lhs, + const etl::chrono::month_day_last& rhs) +ETL_NOEXCEPT +Less-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::month_day_last& lhs, + const etl::chrono::month_day_last& rhs) +ETL_NOEXCEPT +Less-than-equal operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::month_day_last& lhs, + const etl::chrono::month_day_last& rhs) +ETL_NOEXCEPT +Greater-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::month_day_last& lhs, + const etl::chrono::month_day_last& rhs) +ETL_NOEXCEPT +Greater-than-equal operator. +______________________________________________ +[[nodiscard]] constexpr +auto operator <=>(const etl::chrono::month_day_last& lhs, + const etl::chrono::month_day_last& rhs) +ETL_NOEXCEPT +Spaceship operator +____________________________________________________________________________________________________ +Hash + +template +struct hash +Hash function for etl::chrono::month_day_last + diff --git a/docs/raw/chrono/month_weekday.txt b/docs/raw/chrono/month_weekday.txt new file mode 100644 index 00000000..2b2e0af4 --- /dev/null +++ b/docs/raw/chrono/month_weekday.txt @@ -0,0 +1,94 @@ +month_weekday +A template representing a month and weekday. +Back to chrono +____________________________________________________________________________________________________ +month_weekday + +STL equivalent: std::chrono::month_weekday + +class month_weekday +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR +month_weekday() +Default constructor. +______________________________________________ +ETL_CONSTEXPR14 +month_weekday(const etl::chrono::month& m, + const etl::chrono::weekday_indexed& wd) +ETL_NOEXCEPT +Construct from month and weekday_indexed. +____________________________________________________________________________________________________ +Access + +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::month month() const +ETL_NOEXCEPT +Returns the month. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::weekday_indexed weekday_indexed() const +ETL_NOEXCEPT +Returns the weekday. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the month and day is within the valid limits. +____________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::month_weekday& lhs, + const etl::chrono::month_weekday& rhs) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::month_weekday& lhs, + const etl::chrono::month_weekday& rhs) +ETL_NOEXCEPT +Inequality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::month_weekday& lhs, + const etl::chrono::month_weekday& rhs) +ETL_NOEXCEPT +Less-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::month_weekday& lhs, + const etl::chrono::month_weekday& rhs) +ETL_NOEXCEPT +Less-than-equal operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::month_weekday& lhs, + const etl::chrono::month_weekday& rhs) +ETL_NOEXCEPT +Greater-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::month_weekday& lhs, + const etl::chrono::month_weekday& rhs) +ETL_NOEXCEPT +Greater-than-equal operator. +______________________________________________ +[[nodiscard]] constexpr +auto operator <=>(const etl::chrono::month_weekday& lhs, + const etl::chrono::month_weekday& rhs) +ETL_NOEXCEPT +Spaceship operator +____________________________________________________________________________________________________ +Hash + +template +struct hash +Hash function for etl::chrono::month_weekday + diff --git a/docs/raw/chrono/month_weekday_last.txt b/docs/raw/chrono/month_weekday_last.txt new file mode 100644 index 00000000..f26390b2 --- /dev/null +++ b/docs/raw/chrono/month_weekday_last.txt @@ -0,0 +1,88 @@ +month_weekday_last +A template representing a month and weekday_last. +Back to chrono +____________________________________________________________________________________________________ +month_weekday_last + +STL equivalent: std::chrono::month_weekday_last + +class month_weekday_last +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR +month_weekday_last() +Default constructor. +______________________________________________ +ETL_CONSTEXPR14 +month_weekday_last(const etl::chrono::month& m, + const etl::chrono::weekday_last& wd) +ETL_NOEXCEPT +Construct from month and weekday_last. +____________________________________________________________________________________________________ +Access + +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::month month() const +ETL_NOEXCEPT +Returns the month. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::weekday_last weekday_last() const +ETL_NOEXCEPT +Returns the weekday. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the month and day is within the valid limits. +____________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::month_weekday_last& lhs, + const etl::chrono::month_weekday_last& rhs) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::month_weekday_last& lhs, + const etl::chrono::month_weekday_last& rhs) +ETL_NOEXCEPT +Inequality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::month_weekday_last& lhs, + const etl::chrono::month_weekday_last& rhs) +ETL_NOEXCEPT +Less-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::month_weekday_last& lhs, + const etl::chrono::month_weekday_last& rhs) +ETL_NOEXCEPT +Less-than-equal operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::month_weekday_last& lhs, + const etl::chrono::month_weekday_last& rhs) +ETL_NOEXCEPT +Greater-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::month_weekday_last& lhs, + const etl::chrono::month_weekday_last& rhs) +ETL_NOEXCEPT +Greater-than-equal operator. +____________________________________________________________________________________________________ +Hash + +template +struct hash +Hash function for etl::chrono::month_weekday_last + diff --git a/docs/raw/chrono/time_point.txt b/docs/raw/chrono/time_point.txt new file mode 100644 index 00000000..30cd9baa --- /dev/null +++ b/docs/raw/chrono/time_point.txt @@ -0,0 +1,182 @@ +time_point +etl::chrono::time_point represents a point in time. +Back to chrono +____________________________________________________________________________________________________ +tme_point + +Represents a point in time storing a TDuration indicating the time +interval from the start of the TClock's epoch. + +template +class time_point +____________________________________________________________________________________________________ +Member types + +using clock = TClock +using duration = TDuration +using rep = typename TDuration::rep +using period = typename TDuration::period +____________________________________________________________________________________________________ +Constructors + +ETL_CONSTEXPR +time_point() +ETL_NOEXCEPT +Default constructor. +______________________________________________ +ETL_CONSTEXPR14 +explicit time_point(const duration& dur_) +ETL_NOEXCEPT +Construct from a duration. +______________________________________________ +ETL_CONSTEXPR14 +time_point(const time_point& rhs) +ETL_NOEXCEPT +Copy constructor. +______________________________________________ +template +ETL_CONSTEXPR14 +explicit time_point(const time_point& rhs) +ETL_NOEXCEPT +Copy construct from another time_point with a different duration type. +____________________________________________________________________________________________________ +Assignment + +ETL_CONSTEXPR14 +time_point& operator =(const time_point& rhs) +ETL_NOEXCEPT +Assignment operator. +____________________________________________________________________________________________________ +Access + +ETL_NODISCARD +ETL_CONSTEXPR14 duration time_since_epoch() const +ETL_NOEXCEPT +Returns a duration representing the amount of time between this and the clock's epoch. +____________________________________________________________________________________________________ +Member arithmetic operators + +ETL_CONSTEXPR14 time_point& operator +=(const duration& rhs) +ETL_NOEXCEPT +Adds a duration. +______________________________________________ +ETL_CONSTEXPR14 time_point& operator -=(const duration& rhs) +ETL_NOEXCEPT +Subtracts a duration. +____________________________________________________________________________________________________ +Constants + +ETL_NODISCARD +static ETL_CONSTEXPR14 time_point min() +ETL_NOEXCEPT +Returns a time_point with the smallest possible duration. +______________________________________________ +ETL_NODISCARD +static ETL_CONSTEXPR14 time_point max() +ETL_NOEXCEPT +Returns a time_point with the largest possible duration. +____________________________________________________________________________________________________ +Rounding + +template +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::time_point + floor(const etl::chrono::time_point& tp) +ETL_NOEXCEPT +Rounds down a duration to the nearest lower precision. +______________________________________________ +template +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::time_point + ceil(const etl::chrono::time_point& tp) +ETL_NOEXCEPT +Rounds up a duration to the nearest higher precision. +______________________________________________ +template +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::time_point + round(const etl::chrono::time_point& tp) +ETL_NOEXCEPT +Rounds a duration to the nearest precision. +If the duration is exactly halfway, it rounds away from zero. +____________________________________________________________________________________________________ +Casting + +template +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::time_point + time_point_cast(const etl::chrono::time_point& tp) +ETL_NOEXCEPT +____________________________________________________________________________________________________ +Comparison + +ETL_NODISCARD +ETL_CONSTEXPR14 int compare(const time_point& other) const +ETL_NOEXCEPT +Compare day with another. +If time_point < other, returns -1 +else if time_point > other, returns 1 +else returns 0 +____________________________________________________________________________________________________ +Non-member comparison operators + +template +ETL_CONSTEXPR14 +bool operator ==(const time_point& lhs, + const time_point& rhs) +ETL_NOEXCEPT +Equality operator +______________________________________________ +template +ETL_CONSTEXPR14 +bool operator !=(const time_point& lhs, + const time_point& rhs) +ETL_NOEXCEPT +Inequality operator +______________________________________________ +template +ETL_CONSTEXPR14 +bool operator <(const time_point& lhs, + const time_point& rhs) +ETL_NOEXCEPT +Less-than operator +______________________________________________ +template +ETL_CONSTEXPR14 +bool operator <=(const time_point& lhs, + const time_point& rhs) +ETL_NOEXCEPT +Less-than-equal operator +______________________________________________ +template +ETL_CONSTEXPR14 +bool operator >(const time_point& lhs, + const time_point& rhs) +ETL_NOEXCEPT +Greater-than operator +______________________________________________ +template +ETL_CONSTEXPR14 +bool operator >=(const time_point& lhs, + const time_point& rhs) +ETL_NOEXCEPT +Greater-than-equal operator +______________________________________________ +template +[[nodiscard]] constexpr auto operator <=>(const etl::chrono::time_point& lhs, + const etl::chrono::time_point& rhs) +noexcept +Spaceship operator +C++20 +____________________________________________________________________________________________________ +etl::common_type specialisation + +template +struct common_type, + etl::chrono::time_point> +Defines type, which is the common type of two etl::chrono::time_point + diff --git a/docs/raw/chrono/weekday.txt b/docs/raw/chrono/weekday.txt new file mode 100644 index 00000000..257b9596 --- /dev/null +++ b/docs/raw/chrono/weekday.txt @@ -0,0 +1,229 @@ +weekday +A template representing a weekday. +Back to chrono +____________________________________________________________________________________________________ +weekday + +STL equivalent: std::chrono::weekday + +class weekday +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR +weekday() +ETL_NOEXCEPT +Default constructor. +______________________________________________ +ETL_CONSTEXPR +explicit weekday(unsigned value) +ETL_NOEXCEPT +Construct from unsigned. +______________________________________________ +ETL_CONSTEXPR14 +weekday(const etl::chrono::sys_days& sd) +ETL_NOEXCEPT +Construct from sys_days. +______________________________________________ +ETL_CONSTEXPR14 +weekday(const etl::chrono::local_days& sd) +ETL_NOEXCEPT +Construct from local_days. +______________________________________________ +ETL_CONSTEXPR14 +weekday(const etl::chrono::weekday& other) +ETL_NOEXCEPT +Copy constructor. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the weekday is valid +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +bool is_weekend() const +ETL_NOEXCEPT +Returns true if the weekday is a Saturday or Sunday. +____________________________________________________________________________________________________ +Assignment + +ETL_CONSTEXPR14 +etl::chrono::weekday& operator =(const etl::chrono::weekday& rhs) +ETL_NOEXCEPT +Assignment operator +____________________________________________________________________________________________________ +Access + +ETL_CONSTEXPR14 +int c_encoding() const +ETL_NOEXCEPT +Gets the value of the weekday using C encoding. + +ETL_CONSTEXPR14 +int iso_encoding() const +ETL_NOEXCEPT +Gets the value of the weekday using ISO encoding. + +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::weekday_indexed operator[](unsigned index) const +ETL_NOEXCEPT +Index operator, from index. + +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::weekday_last operator[](etl::chrono::last_spec last) const +ETL_NOEXCEPT +Index operator, from etl::chrono::last_spec. +____________________________________________________________________________________________________ +Increment/decrement + +ETL_CONSTEXPR14 +etl::chrono::weekday& operator ++() +ETL_NOEXCEPT +Pre-increment operator. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::weekday operator ++(int) +ETL_NOEXCEPT +Post-increment operator. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::weekday& operator --() +ETL_NOEXCEPT +Pre-decrement operator. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::weekday operator --(int) +ETL_NOEXCEPT +Post-decrement operator. +____________________________________________________________________________________________________ +Mathematical operators + +ETL_CONSTEXPR14 +etl::chrono::weekday& operator +=(const etl::chrono::weekdays& ms) +ETL_NOEXCEPT +Plus-equals operator adding etl::chrono::weekdays. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::weekday& operator -=(const etl::chrono::weekdays& ms) +ETL_NOEXCEPT +Minus-equals operator subtracting etl::chrono::weekdays. +____________________________________________________________________________________________________ +Constants + +ETL_NODISCARD +static +ETL_CONSTEXPR14 +etl::chrono::weekday min() +ETL_NOEXCEPT +The minimum weekday value for which ok() will return true. +______________________________________________ +ETL_NODISCARD +static +ETL_CONSTEXPR14 +etl::chrono::weekday max() +ETL_NOEXCEPT +The maximum weekday value for which ok() will return true. +____________________________________________________________________________________________________ +Non-member mathematical operators + +ETL_CONSTEXPR14 +etl::chrono::weekday operator +(const etl::chrono::weekday& m, + const etl::chrono::weekdays& ms) +ETL_NOEXCEPT +Add etl::chrono::weekdays to etl::chrono::weekday. +Returns etl::chrono::weekday. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::weekday operator +(const etl::chrono::weekdays& ms, + const etl::chrono::weekday& m) +ETL_NOEXCEPT +Add etl::chrono::weekday to etl::chrono::weekdays. +Returns etl::chrono::weekday. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::weekday operator -(const etl::chrono::weekday& m, + const etl::chrono::weekdays& ms) +ETL_NOEXCEPT +Subtract etl::chrono::weekdays from etl::chrono::weekday. +Returns etl::chrono::weekday. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::weekday operator -(const etl::chrono::weekdays& ms, + const etl::chrono::weekday& m) +ETL_NOEXCEPT +Subtract etl::chrono::weekday from etl::chrono::weekdays. +Returns etl::chrono::weekdays. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::weekdays operator -(const etl::chrono::weekday& m1, + const etl::chrono::weekday& m2) ETL_NOEXCEPT +Subtract etl::chrono::weekday from etl::chrono::weekday. +Returns etl::chrono::weekdays. +____________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::weekday& m1, + const etl::chrono::weekday& m2) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::weekday& m1, + const etl::chrono::weekday& m2) +ETL_NOEXCEPT +Inequality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::weekday& m1, + const etl::chrono::weekday& m2) +ETL_NOEXCEPT +Less-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::weekday& m1, + const etl::chrono::weekday& m2) +ETL_NOEXCEPT +Less-than-or-equal operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator >(const etl::chrono::weekday& m1, + const etl::chrono::weekday& m2) +ETL_NOEXCEPT +Greater-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator >=(const etl::chrono::weekday& m1, + const etl::chrono::weekday& m2) +ETL_NOEXCEPT +Greater-than-or-equal operator. +______________________________________________ +[[nodiscard]] inline constexpr +auto operator <=>(const etl::chrono::weekday& m1, + const etl::chrono::weekday& m2) +noexcept +Spaceship operator. +C++20 +____________________________________________________________________________________________________ +Defined weekdays + +etl::chrono::Monday +etl::chrono::Tuesday +etl::chrono::Wednesday +etl::chrono::Thursday +etl::chrono::Friday +etl::chrono::Saturday +etl::chrono::Sunday +____________________________________________________________________________________________________ +Hash + +template <> +struct hash +Hash function for etl::chrono::weekday + diff --git a/docs/raw/chrono/weekday_indexed.txt b/docs/raw/chrono/weekday_indexed.txt new file mode 100644 index 00000000..270cd24c --- /dev/null +++ b/docs/raw/chrono/weekday_indexed.txt @@ -0,0 +1,80 @@ +weekday_indexed +A template representing a weekday_indexed. +Back to chrono +____________________________________________________________________________________________________ +weekday_indexed + +STL equivalent: std::chrono::weekday_indexed + +class weekday_indexed +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR +weekday_indexed() +ETL_NOEXCEPT +Default constructor. +______________________________________________ +ETL_CONSTEXPR14 +weekday_indexed(const etl::chrono::weekday& wd, unsigned index) +ETL_NOEXCEPT +Construct from weekday and index. +______________________________________________ +ETL_CONSTEXPR14 +weekday_indexed(const etl::chrono::weekday_indexed& other) +ETL_NOEXCEPT +Copy constructor. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the weekday_indexed is valid +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +bool is_weekend() const +ETL_NOEXCEPT +Returns true if the weekday_indexed is a Saturday or Sunday. +____________________________________________________________________________________________________ +Assignment + +ETL_CONSTEXPR14 +etl::chrono::weekday_indexed& operator =(const etl::chrono::weekday_indexed& rhs) +ETL_NOEXCEPT +Assignment operator +____________________________________________________________________________________________________ +Access + +ETL_CONSTEXPR14 +etl::chrono::weekday weekday() const +ETL_NOEXCEPT +Gets the weekday. +______________________________________________ +ETL_CONSTEXPR14 +unsigned index() const +ETL_NOEXCEPT +Gets the index. +____________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::weekday_indexed& m1, + const etl::chrono::weekday_indexed& m2) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::weekday_indexed& m1, + const etl::chrono::weekday_indexed& m2) +ETL_NOEXCEPT +Inequality operator. +____________________________________________________________________________________________________ +Hash + +template <> +struct hash +Hash function for etl::chrono::weekday_indexed + diff --git a/docs/raw/chrono/weekday_last.txt b/docs/raw/chrono/weekday_last.txt new file mode 100644 index 00000000..b7d0e2f4 --- /dev/null +++ b/docs/raw/chrono/weekday_last.txt @@ -0,0 +1,70 @@ +weekday_last +A template representing a weekday_last. +Back to chrono +____________________________________________________________________________________________________ +weekday_last + +STL equivalent: std::chrono::weekday_last + +class weekday_last +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR +weekday_last() +ETL_NOEXCEPT +Default constructor. +______________________________________________ +ETL_CONSTEXPR14 +weekday_last(const etl::chrono::weekday& wd) +ETL_NOEXCEPT +Construct from weekday and index. +______________________________________________ +ETL_CONSTEXPR14 +weekday_last(const etl::chrono::weekday_last& other) +ETL_NOEXCEPT +Copy constructor. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the weekday_last valid. +____________________________________________________________________________________________________ +Assignment + +ETL_CONSTEXPR14 +etl::chrono::weekday_last& operator =(const etl::chrono::weekday_last& rhs) +ETL_NOEXCEPT +Assignment operator +____________________________________________________________________________________________________ +Access + +ETL_CONSTEXPR14 +etl::chrono::weekday weekday() const +ETL_NOEXCEPT +Gets the weekday. +____________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::weekday_last& m1, + const etl::chrono::weekday_last& m2) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::weekday_last& m1, + const etl::chrono::weekday_last& m2) +ETL_NOEXCEPT +Inequality operator. +____________________________________________________________________________________________________ +Hash + +template <> +struct hash +Hash function for etl::chrono::weekday_last + + diff --git a/docs/raw/chrono/year.txt b/docs/raw/chrono/year.txt new file mode 100644 index 00000000..9fcea0a2 --- /dev/null +++ b/docs/raw/chrono/year.txt @@ -0,0 +1,206 @@ +year +A template representing a year. +Back to chrono +____________________________________________________________________________________________________ +year + +STL equivalent: std::chrono::year + +class year +____________________________________________________________________________________________________ +Typesdefs +rep The internal representation. +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR +year() +ETL_NOEXCEPT +Default constructor. +______________________________________________ +ETL_CONSTEXPR +explicit year(unsigned value) +ETL_NOEXCEPT +Construct from unsigned. +______________________________________________ +ETL_CONSTEXPR14 +year(const etl::chrono::year& other) +ETL_NOEXCEPT +Copy constructor. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +int compare(const etl::chrono::year& other) const +ETL_NOEXCEPT +Compare day with another. +if year < other, returns -1 +else if year > other, returns 1 +else returns 0 +____________________________________________________________________________________________________ +Assignment + +ETL_CONSTEXPR14 +etl::chrono::year& operator =(const etl::chrono::year& rhs) +ETL_NOEXCEPT +Assignment operator +____________________________________________________________________________________________________ +Increment/decrement + +ETL_CONSTEXPR14 +etl::chrono::year& operator ++() +ETL_NOEXCEPT +Pre-increment operator. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year operator ++(int) +ETL_NOEXCEPT +Post-increment operator. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year& operator --() +ETL_NOEXCEPT +Pre-decrement operator. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year operator --(int) +ETL_NOEXCEPT +Post-decrement operator. +____________________________________________________________________________________________________ +Mathematical operators + +ETL_CONSTEXPR14 +etl::chrono::year& operator +=(const etl::chrono::years& ys) +ETL_NOEXCEPT +Plus-equals operator adding etl::chrono::years. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year& operator -=(const etl::chrono::years& ys) +ETL_NOEXCEPT +Minus-equals operator subtracting etl::chrono::years. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the year is within the valid -32767 to 32767 range. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +bool is_leap() const +ETL_NOEXCEPT +Returns true if the year is a leap year. +____________________________________________________________________________________________________ +Constants + +ETL_NODISCARD +static +ETL_CONSTEXPR14 +etl::chrono::year min() +ETL_NOEXCEPT +The minimum year value for which ok() will return true. +______________________________________________ +ETL_NODISCARD +static +ETL_CONSTEXPR14 +etl::chrono::year max() +ETL_NOEXCEPT +The maximum year value for which ok() will return true. +____________________________________________________________________________________________________ +Conversion + +ETL_CONSTEXPR14 +operator int() const +ETL_NOEXCEPT +Conversion operator to unsigned int. +____________________________________________________________________________________________________ +Non-member mathematical operators + +ETL_CONSTEXPR14 +etl::chrono::year operator +(const etl::chrono::year& y, + const etl::chrono::years& ys) +ETL_NOEXCEPT +Add etl::chrono::years to etl::chrono::year. +Returns etl::chrono::year. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year operator +(const etl::chrono::years& ys, + const etl::chrono::year& y) +ETL_NOEXCEPT +Add etl::chrono::year to etl::chrono::years. +Returns etl::chrono::year. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year operator -(const etl::chrono::year& y, + const etl::chrono::years& ys) +ETL_NOEXCEPT +Subtract etl::chrono::years from etl::chrono::year. +Returns etl::chrono::year. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year operator -(const etl::chrono::years& ys, + const etl::chrono::year& y) +ETL_NOEXCEPT +Subtract etl::chrono::year from etl::chrono::years. +Returns etl::chrono::years. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::years operator -(const etl::chrono::year& y1, + const etl::chrono::year& y2) ETL_NOEXCEPT +Subtract etl::chrono::year from etl::chrono::year. +Returns etl::chrono::years. +____________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::year& y1, + const etl::chrono::year& y2) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::year& y1, + const etl::chrono::year& y2) +ETL_NOEXCEPT +Inequality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <(const etl::chrono::year& y1, + const etl::chrono::year& y2) +ETL_NOEXCEPT +Less-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator <=(const etl::chrono::year& y1, + const etl::chrono::year& y2) +ETL_NOEXCEPT +Less-than-or-equal operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator >(const etl::chrono::year& y1, + const etl::chrono::year& y2) +ETL_NOEXCEPT +Greater-than operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator >=(const etl::chrono::year& y1, + const etl::chrono::year& y2) +ETL_NOEXCEPT +Greater-than-or-equal operator. +______________________________________________ +[[nodiscard]] inline constexpr +auto operator <=>(const etl::chrono::year& y1, + const etl::chrono::year& y2) +noexcept +Spaceship operator. +C++20 +____________________________________________________________________________________________________ +Hash + +template +struct hash +Hash function for etl::chrono::year + diff --git a/docs/raw/chrono/year_month.txt b/docs/raw/chrono/year_month.txt new file mode 100644 index 00000000..1a775519 --- /dev/null +++ b/docs/raw/chrono/year_month.txt @@ -0,0 +1,133 @@ +year_month +A template representing a year and month. +Back to chrono +____________________________________________________________________________________________________ +year_month + +STL equivalent: std::chrono::year_month + +class year_month +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR +year_month() +Default constructor. +______________________________________________ +ETL_CONSTEXPR14 +year_month(const etl::chrono::year& y, + const etl::chrono::month& m) +ETL_NOEXCEPT +Construct from month and day. +____________________________________________________________________________________________________ +Access + +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::year year() const +ETL_NOEXCEPT +Returns the year. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::month month() const +ETL_NOEXCEPT +Returns the month. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the year and month is within the valid limits. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +int compare(const etl::chrono::year_month& other) const +ETL_NOEXCEPT +if (y < other.y) return -1 +if (y > other.y) return 1 +if (m < other.m) return -1 +if (m > other.m) return 1 +else return 0 +____________________________________________________________________________________________________ +Non-member mathematical operators + +ETL_CONSTEXPR14 +etl::chrono::year_month operator +(const etl::chrono::year_month& ym, + const etl::chrono::years& dy) +Adds etl::chrono::years. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month operator +(const etl::chrono::years& dy, + const etl::chrono::year_month& ym) +ETL_NOEXCEPT +Adds etl::chrono::years. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month operator +(const etl::chrono::year_month& ym, + const etl::chrono::months& dm) +ETL_NOEXCEPT +Adds etl::chrono::months. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month operator +(const etl::chrono::months& dm, + const etl::chrono::year_month& ym) +ETL_NOEXCEPT +Adds etl::chrono::months. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month operator -(const etl::chrono::year_month& ym, + const etl::chrono::years& dy) +ETL_NOEXCEPT +Subtracts etl::chrono::years. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month operator -(const etl::chrono::year_month& ym, + const etl::chrono::months& dm) +ETL_NOEXCEPT +Subtracts etl::chrono::months. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::months operator -(const etl::chrono::year_month& ym1, + const etl::chrono::year_month& ym2) +ETL_NOEXCEPT +Subtracts etl::chrono::year_month. +____________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::year_month& lhs, + const etl::chrono::year_month& rhs) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::year_month& lhs, + const etl::chrono::year_month& rhs) +ETL_NOEXCEPT +Inequality operator. +______________________________________________ +[[nodiscard]] friend constexpr +auto operator <=>(const etl::chrono::year_month& lhs, + const etl::chrono::year_month& rhs) +ETL_NOEXCEPT +Spaceship operator +______________________________________________ +ETL_CONSTEXPR14 +int compare(const year_month& other) const +ETL_NOEXCEPT +Compare year_month with another. +if month < other.month, returns -1 +else if month > other.month, returns 1 +else if day < other.day, returns -1 +else if day > other.day, returns 1 +else returns 0; +____________________________________________________________________________________________________ +Hash + +template +struct hash +Hash function for etl::chrono::year_month + diff --git a/docs/raw/chrono/year_month_day.txt b/docs/raw/chrono/year_month_day.txt new file mode 100644 index 00000000..69118574 --- /dev/null +++ b/docs/raw/chrono/year_month_day.txt @@ -0,0 +1,175 @@ +year_month_day +A template representing a year and month. +Back to chrono +____________________________________________________________________________________________________ +year_month_day + +STL equivalent: std::chrono::year_month_day + +class year_month_day +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR year_month_day() +Default constructor. +______________________________________________ +ETL_CONSTEXPR14 +year_month_day(const etl::chrono::year& y, + const etl::chrono::month& m, + const etl::chrono::day& d) +ETL_NOEXCEPT +Construct from month and day. +______________________________________________ +ETL_CONSTEXPR14 +year_month_day(const etl::chrono::year_month_day_last& ymdl) +ETL_NOEXCEPT +Construct from year_month_day_last. +______________________________________________ +ETL_CONSTEXPR14 +year_month_day(const etl::chrono::sys_days& sd) +ETL_NOEXCEPT +Construct from sys_days. +______________________________________________ +ETL_CONSTEXPR14 +year_month_day(const etl::chrono::local_days& ld) +ETL_NOEXCEPT +Construct from local_days. +____________________________________________________________________________________________________ +Access + +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::year year() const +ETL_NOEXCEPT +Returns the year. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::month month() const +ETL_NOEXCEPT +Returns the month. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 etl::chrono::day day() const ETL_NOEXCEPT +Returns the day. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the year and month is within the valid limits. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +int compare(const etl::chrono::year_month_day& other) const +ETL_NOEXCEPT +Compare year_month_day with another. +if year < other.year, returns -1 +else if year > other.year, returns 1 +if month < other.month, returns -1 +else if month > other.month, returns 1 +else if day < other.day, returns -1 +else if day > other.day, returns 1 +else returns 0 +____________________________________________________________________________________________________ +operators + +ETL_CONSTEXPR14 +etl::chrono::year_month_day& operator +=(const etl::chrono::years& dy) +ETL_NOEXCEPT +Adds etl::chrono::years. + +ETL_CONSTEXPR14 +etl::chrono::year_month_day& operator +=(const etl::chrono::months& dm) +ETL_NOEXCEPT +Adds etl::chrono::months. + +ETL_CONSTEXPR14 +etl::chrono::year_month_day& operator -=(const etl::chrono::years& dy) +ETL_NOEXCEPT +Subtracts etl::chrono::years. + +ETL_CONSTEXPR14 +etl::chrono::year_month_day& operator -=(const etl::chrono::months& dm) +ETL_NOEXCEPT +Subtracts etl::chrono::months. +____________________________________________________________________________________________________ +Non-member operators + +ETL_CONSTEXPR14 +etl::chrono::year_month_day operator +(const etl::chrono::year_month_day& ym, + const etl::chrono::years& dy) +Adds etl::chrono::years. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month_day operator +(const etl::chrono::years& dy, + const etl::chrono::year_month_day& ym) +ETL_NOEXCEPT +Adds etl::chrono::years. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month_day operator +(const etl::chrono::year_month_day& ym, + const etl::chrono::months& dm) +ETL_NOEXCEPT +Adds etl::chrono::months. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month operator +(const etl::chrono::months& dm, + const etl::chrono::year_month_day& ym) +ETL_NOEXCEPT +Adds etl::chrono::months. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month operator -(const etl::chrono::year_month_day& ym, + const etl::chrono::years& dy) +ETL_NOEXCEPT +Subtracts etl::chrono::years. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month operator -(const etl::chrono::year_month_day& ym, + const etl::chrono::months& dm) +ETL_NOEXCEPT +Subtracts etl::chrono::months. +___________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::year_month_day& lhs, + const etl::chrono::year_month_day& rhs) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::year_month_day& lhs, + const etl::chrono::year_month_day& rhs) +ETL_NOEXCEPT +Inequality operator. +______________________________________________ +[[nodiscard]] friend constexpr +auto operator <=>(const etl::chrono::year_month_day& lhs, + const etl::chrono::year_month_day& rhs) +ETL_NOEXCEPT +Spaceship operator +______________________________________________ +ETL_CONSTEXPR14 +int compare(const year_month& other) const +ETL_NOEXCEPT +Compare year_month_day with another. +if year < other.year, returns -1 +else if year > other.year, returns 1 +if month < other.month, returns -1 +else if month > other.month, returns 1 +else if day < other.day, returns -1 +else if day > other.day, returns 1 +else returns 0 +____________________________________________________________________________________________________ +Hash + +template <> +struct hash +Hash function for etl::chrono::year_month_day + + + diff --git a/docs/raw/chrono/year_month_day_last.txt b/docs/raw/chrono/year_month_day_last.txt new file mode 100644 index 00000000..03fa46b5 --- /dev/null +++ b/docs/raw/chrono/year_month_day_last.txt @@ -0,0 +1,164 @@ +year_month_day_last +A template representing a year and month. +Back to chrono +____________________________________________________________________________________________________ +year_month_day_last + +STL equivalent: std::chrono::year_month_day_last + +class year_month_day_last +____________________________________________________________________________________________________ +Construction + +ETL_CONSTEXPR year_month_day_last() +Default constructor. +______________________________________________ +ETL_CONSTEXPR14 +year_month_day(const etl::chrono::year& y, + const etl::chrono::month_day_last& mdl) +ETL_NOEXCEPT +Construct from month and day. +______________________________________________ +ETL_CONSTEXPR14 +year_month_day(const etl::chrono::year_month_day_last& ymdl) +ETL_NOEXCEPT +Construct from year_month_day_last. +____________________________________________________________________________________________________ +Access + +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::year year() const +ETL_NOEXCEPT +Returns the year. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::month month() const +ETL_NOEXCEPT +Returns the month. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::month_day_last month_day_last() const +ETL_NOEXCEPT +Returns the month. +____________________________________________________________________________________________________ +Tests + +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +Returns true if the year and month is within the valid limits. +______________________________________________ +ETL_NODISCARD +ETL_CONSTEXPR14 +int compare(const etl::chrono::year_month_day_last& other) const +ETL_NOEXCEPT +Compare year_month_day with another. +if year < other.year, returns -1 +else if year > other.year, returns 1 +if month < other.month, returns -1 +else if month > other.month, returns 1 +else returns 0 +____________________________________________________________________________________________________ +operators + +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last& operator +=(const etl::chrono::years& dy) +ETL_NOEXCEPT +Adds etl::chrono::years. + +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last& operator +=(const etl::chrono::months& dm) +ETL_NOEXCEPT +Adds etl::chrono::months. + +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last& operator -=(const etl::chrono::years& dy) +ETL_NOEXCEPT +Subtracts etl::chrono::years. + +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last& operator -=(const etl::chrono::months& dm) +ETL_NOEXCEPT +Subtracts etl::chrono::months. +____________________________________________________________________________________________________ +Non-member operators + +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last operator +(const etl::chrono::year_month_day_last& ym, + const etl::chrono::years& dy) +Adds etl::chrono::years. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last operator +(const etl::chrono::years& dy, + const etl::chrono::year_month_day_last& ym) +ETL_NOEXCEPT +Adds etl::chrono::years. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last operator +(const etl::chrono::year_month_day_last& ym, + const etl::chrono::months& dm) +ETL_NOEXCEPT +Adds etl::chrono::months. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last operator +(const etl::chrono::months& dm, + const etl::chrono::year_month_day_last& ym) +ETL_NOEXCEPT +Adds etl::chrono::months. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month_last operator -(const etl::chrono::year_month_day_last& ym, + const etl::chrono::years& dy) +ETL_NOEXCEPT +Subtracts etl::chrono::years. +______________________________________________ +ETL_CONSTEXPR14 +etl::chrono::year_month_day_last operator -(const etl::chrono::year_month_day& ym, + const etl::chrono::months& dm) +ETL_NOEXCEPT +Subtracts etl::chrono::months. +___________________________________________________________________________________________________ +Non-member comparison operators + +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::year_month_day_last& lhs, + const etl::chrono::year_month_day_last& rhs) +ETL_NOEXCEPT +Equality operator. +______________________________________________ +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::year_month_day_last& lhs, + const etl::chrono::year_month_day_last& rhs) +ETL_NOEXCEPT +Inequality operator. +______________________________________________ +[[nodiscard]] friend constexpr +auto operator <=>(const etl::chrono::year_month_day& lhs, + const etl::chrono::year_month_day& rhs) +ETL_NOEXCEPT +Spaceship operator +______________________________________________ +ETL_CONSTEXPR14 +int compare(const year_month& other) const +ETL_NOEXCEPT +Compare year_month_day with another. +if year < other.year, returns -1 +else if year > other.year, returns 1 +if month < other.month, returns -1 +else if month > other.month, returns 1 +else if day < other.day, returns -1 +else if day > other.day, returns 1 +else returns 0 +____________________________________________________________________________________________________ +Hash + +template <> +struct hash +Hash function for etl::chrono::year_month_day_last + + + diff --git a/docs/raw/frameworks/Callback Service.txt b/docs/raw/frameworks/Callback Service.txt new file mode 100644 index 00000000..5cc8868b --- /dev/null +++ b/docs/raw/frameworks/Callback Service.txt @@ -0,0 +1,57 @@ +Callback Service +This template class allows easier integration of 'C' style events (such as interrupt vectors) and C++ handlers. +It can allow abstraction between low level events such as interrupts and their application dependent handlers. +The handlers may be any combination of global, static or member functions. +It utilises the templated function wrapper. See here. + +The callbacks are identified by an id. The values of the ids must range from zero or a specified offset, up to the maximum number of specified callbacks. Calling an unused callback id will either do nothing or, if the user has specified a handler, call this with the id of the callback. + +There are functions that use both runtime and compile time checks of the callback id. +Compile time is preferable. +____________________________________________________________________________________________________ +Member functions + +template +etl::callback_service + +RANGE The id range of the callbacks. +OFFSET The starting id for the range. +____________________________________________________________________________________________________ +callback_service() + +Sets all of the callbacks to route to the unhandled callback. +Sets the unhandled callback to default (do nothing). +____________________________________________________________________________________________________ +template +void register_callback(etl::ifunction& callback) + +Registers callback with the id specified in the template parameter. +A compile time error will occur if the id is out of range. +____________________________________________________________________________________________________ +void register_callback(size_t id, etl::ifunction& callback) + +Registers callback with the id specified in the template parameter. +The registration will be ignored if the id is out of range. +____________________________________________________________________________________________________ +void register_unhandled_callback(etl::ifunction& callback) + +Registers the callback to be used for unhandled ids. +____________________________________________________________________________________________________ +template +void callback() + +Calls the callback associated with the id. +Calls the unhandled callback if the id has not been registered. +A compile time error will occur if the id is out of range. +____________________________________________________________________________________________________ +void callback(const size_t id) + +Calls the callback associated with the id. +Calls the unhandled callback if the id has not been registered or if is out of range. +____________________________________________________________________________________________________ +Example + +Tutorial + +See the example project in etl\examples\FunctionInterruptSimulation + diff --git a/docs/raw/frameworks/Callback Timer Atomic.txt b/docs/raw/frameworks/Callback Timer Atomic.txt new file mode 100644 index 00000000..c5b5b11a --- /dev/null +++ b/docs/raw/frameworks/Callback Timer Atomic.txt @@ -0,0 +1,200 @@ +Callback Timer Atomic +20.22.0 + +A software timer class that can manage up to 254 timers. Each one may be repeating or single shot. +When a timer triggers it will call the selected function. The function may be a class member or free function. +The timers are driven from a call to tick(uint32_t count). This call would normally be made from a high priority interrupt routine. The destination function will receive the callback in the same context as the tick call. +The call to tick has a low overhead when a timer is not 'due'. Internally the timers are stored in 'first timeout' order so only the head of the list needs to be checked. + +Each timer may have a period of up to 232-2 ticks (4,294,967,294). +At 1ms per tick this would equate to just over 49 days. + +The framework relies on an atomic counter type. With this mechanism, calls to tick are never disabled. If the foreground thread is within a disable/enable section when the timer interrupt/thread is activated then the tick update will be deferred until the next tick period. The timer interrupt/thread may interrogate the return value of tick() to check whether the update was deferred. + +Defines the following classes:- +etl::icallback_timer_atomic +etl::callback_timer_atomic + +20.25.0 +From this version, an atomic 'semaphore' counter type must be supplied. + +Uses definitions from timer.h + +Important: +For correct operation of the timer framework, the routine that calls tick must not be pre-emptible by another routine that calls a timer function. Also, calls to the timer framework may only be made from the caller of tick and one other, lower priority, thread of execution +____________________________________________________________________________________________________ +icallback_timer_atomic +The base class for all timer controllers. + +Type definitions +callback_type etl::delegate +The function type used for callbacks. +_____________________________________________________________________________________________________ +Member functions +etl::timer::id::type register_timer(callback_type callback, + uint32_t period, + bool repeating) +Registers a timer calling a free or static function. +callback A delegate to the callback funtion that will be callled when the timer expires. +period The timer period in ticks. +repeating false if single shot, true if repeating. + +Returns the allocated timer id or etl::timer::mode::NO_TIMER if one was not available. +____________________________________________________________________________________________________ +bool unregister_timer(etl::timer::id::type id) +Unregisters a timer. +If the timer is active then it will be stopped. +Returns true if a timer with the id was successfully unregistered. +___________________________________________________________________________________________________ +void enable(bool state) +Enables or disables the timer manager according to the state. +____________________________________________________________________________________________________ +bool is_running() const +Returns true if the timer manager is enabled. +____________________________________________________________________________________________________ +void clear() +Clears the callback timer back to the initial state. All timers will be stopped and unregistered. +____________________________________________________________________________________________________ +bool tick(uint32_t count) +This function updates the internal tick counter (if enabled) and must pass the number of ticks that have occurred since the last call. If the count encompasses more than one period of a repeating timer then the timer will be triggered multiple times in one call to tick. +Returns true if the tick counter was updated, otherwise false. This may be used by the calling routine to accumulate unprocessed tick counts. +____________________________________________________________________________________________________ +bool start(etl::timer::id::type id, bool immediate = false) +Starts the timer with the specified id. +If the timer is already running then the timer Is restarted from the current tick count. +If immediate is true then the timer is triggered on the next call to tick(). Note: Single shot timers will only trigger once. +If the id does not correspond to a registered timer then returns false. +____________________________________________________________________________________________________ +bool stop(etl::timer::id::type id) +Stops the timer with the specified id. +Does nothing if the timer is already stopped. +if the id does not correspond to a registered timer then returns false. +____________________________________________________________________________________________________ +bool set_period(etl::timer::id::type id, uint32_t period) +Stops the timer with the specified id. +Sets a new timer period. +Returns true if successful. +____________________________________________________________________________________________________ +bool set_mode(etl::timer::id::type id, bool repeating) +Stops the timer with the specified id. +Sets a new timer mode. +Returns true if successful. +____________________________________________________________________________________________________ +etl::timer::id::type time_to_next() +Returns the time to the next timeout. +20.38.0 +____________________________________________________________________________________________________ +Constants +MAX_TIMERS +The maximum number of timer that can be handled. +____________________________________________________________________________________________________ +callback_timer_atomic + +Template parameters +MAX_TIMERS The number of timers to be supported. The maximum number is 254. +A value of 255 will result in a compile error. +____________________________________________________________________________________________________ +message_timer_atomic() +Default construct. +____________________________________________________________________________________________________ +Example + +//*************************************************************************** +// Class callback via etl::function +//*************************************************************************** +class Test +{ +public: + + Test() + : ticks(0) + { + } + + void callback() + { + ++ticks; + } + + int ticks; +}; + +Test test; + +using callback_type = etl::icallback_timer_atomic::callback_type; + +callback_type member_callback = callback_type::create member_callback; + +//*************************************************************************** +// Free function callback via etl::function +//*************************************************************************** +int free_ticks1 = 0; + +void free_callback1() +{ + ++free_ticks; +} + +callback_type free_callback1 = callback_type::create(); + +//*************************************************************************** +// Free function callback via function pointer +//*************************************************************************** +int free_ticks2 = 0; + +void free_callback2() +{ + ++free_ticks2; +} + +//*************************************************************************** +// Timer controller. +//*************************************************************************** +etl::callback_timer_atomic<2, std::atomic_int32_t> timer_controller; + +//*************************************************************************** +// The main loop. +//*************************************************************************** +int main() +{ + etl::timer::id::type id1 = timer_controller.register_timer(member_callback, + 1000, + etl::timer::mode::SINGLE_SHOT); + + etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, + 100, + etl::timer::mode::REPEATING); + + timer_controller.start(id1); + timer_controller.start(id2); + + timer_controller.enable(true); + + // Start timer interrupts here. + + while (true) + { + // Loop forever. + } + + return 0; +} + +//*************************************************************************** +// The interrupt timer callback. +//*************************************************************************** +void timer_interrupt() +{ + const uint32_t TICK = 1; + static uint32_t nticks = TICK; + + if (timer_controller.tick(nticks)) + { + nticks = TICK; + } + else + { + nticks += TICK; + } +} + diff --git a/docs/raw/frameworks/Callback Timer Deferred Locked.txt b/docs/raw/frameworks/Callback Timer Deferred Locked.txt new file mode 100644 index 00000000..7a46ae8e --- /dev/null +++ b/docs/raw/frameworks/Callback Timer Deferred Locked.txt @@ -0,0 +1,214 @@ +Callback Timer Deferred Locked +20.43.0 + +A software timer class that can manage up to 254 timers. Each one may be repeating or single shot. +When a timer triggers it will call the selected function. The function may be a class member or free function. +The timers are driven from a call to tick(uint32_t count). This call would normally be made from a high priority interrupt routine. The destination function will receive the callback in the same context as the tick call. +The call to tick has a low overhead when a timer is not 'due'. Internally the timers are stored in 'first timeout' order so only the head of the list needs to be checked. +This class is different from the similar etl::callback_timer_locked in that it will record any timer events during the call to tick() so that they may be handled by handle_deferred(). + +Each timer may have a period of up to 232-2 ticks (4,294,967,294). +At 1ms per tick this would equate to just over 49 days. + +Defines the following classes:- +etl::icallback_timer_locked +etl::callback_timer_deferred_locked + +The access to the timers is controlled by three external functions, supplied to the timer by the +member function set_locks. + +The three delegate parameters are:- +Try Lock Attempts to set the lock. Returns true if successful, otherwise false. +Lock Sets the lock. +Unlock Resets the lock. + +Uses definitions from timer.h + +Important: +For correct operation of the timer framework, the routine that calls tick must not be pre-emptible by another routine that calls a timer function. Also, calls to the timer framework may only be made from the caller of tick and one other, lower priority, thread of execution +____________________________________________________________________________________________________ +icallback_timer_locked +The base class for all timer controllers. + +Type definitions +callback_type etl::delegate +The function type used for callbacks. + +try_lock_type etl::delegate +The function type used for 'try lock'. + +lock_type etl::delegate +The function type used for 'lock'. + +unlock_type etl::delegate +The function type used for 'unlock'. +____________________________________________________________________________________________________ +Member functions +etl::timer::id::type register_timer(callback_type callback), + uint32_t period, + bool repeating) +Registers a timer calling a free or static function. +callback A delegate to the callback free funtion that will be callled when the timer expires. +period The timer period in ticks. +repeating false if single shot, true if repeating. + +Returns the allocated timer id or etl::timer::mode::NO_TIMER if one was not available. +____________________________________________________________________________________________________ +bool unregister_timer(etl::timer::id::type id) +Unregisters a timer. +If the timer is active then it will be stopped. +Returns true if a timer with the id was successfully unregistered. +___________________________________________________________________________________________________ +void enable(bool state) +Enables or disables the timer manager according to the state. +____________________________________________________________________________________________________ +bool is_running() const +Returns true if the timer manager is enabled. +____________________________________________________________________________________________________ +void clear() +Clears the callback timer back to the initial state. All timers will be stopped and unregistered. +____________________________________________________________________________________________________ +bool tick(uint32_t count) +This function updates the internal tick counter (if enabled) and must pass the number of ticks that have occurred since the last call. If the count encompasses more than one period of a repeating timer then the timer will be triggered multiple times in one call to tick. +Returns true if the tick counter was updated, otherwise false. This may be used by the calling routine to accumulate unprocessed tick counts. +Any triggered events will be recorded so that they +____________________________________________________________________________________________________ +void handle_deferred() +Handles the work collected during the tick() call. +You can call this function after tick() or you can call this on another task to handle the timer events. +____________________________________________________________________________________________________ +bool start(etl::timer::id::type id, bool immediate = false) +Starts the timer with the specified id. +If the timer is already running then the timer Is restarted from the current tick count. +If immediate is true then the timer is triggered on the next call to tick(). Note: Single shot timers will only trigger once. +If the id does not correspond to a registered timer then returns false. +____________________________________________________________________________________________________ +bool stop(etl::timer::id::type id) +Stops the timer with the specified id. +Does nothing if the timer is already stopped. +if the id does not correspond to a registered timer then returns false. +____________________________________________________________________________________________________ +bool set_period(etl::timer::id::type id, uint32_t period) +Stops the timer with the specified id. +Sets a new timer period. +Returns true if successful. +____________________________________________________________________________________________________ +bool set_mode(etl::timer::id::type id, bool repeating) +Stops the timer with the specified id. +Sets a new timer mode. +Returns true if successful. +____________________________________________________________________________________________________ +void set_locks(try_lock_type try_lock_, lock_type lock_, lock_type unlock_) +Sets the try-lock, lock and unlock delegates. +____________________________________________________________________________________________________ +etl::timer::id::type time_to_next() +Returns the time to the next timeout. +20.38.0 +____________________________________________________________________________________________________ +Constants +MAX_TIMERS +The maximum number of timers that can be handled. +____________________________________________________________________________________________________ +callback_timer_locked + +Template parameters +MAX_TIMERS The number of timers to be supported. The maximum number is 254. +A value of 255 will result in a compile error. + +callback_timer_locked() +Default construct. +The lock callback delegates are not set. +____________________________________________________________________________________________________ +callback_timer_locked(try_lock_type try_lock, lock_type lock, unlock_type unlock) +Construct from lock callback delegates. +____________________________________________________________________________________________________ +Example + +//*************************************************************************** +// Class callback via etl::function +//*************************************************************************** +class Test +{ +public: + + Test() + : ticks(0) + { + } + + void callback() + { + ++ticks; + } + + int ticks; +}; + +using callback_type = etl::icallback_timer_atomic::callback_type; + +callback_type member_callback = callback_type::create member_callback; + +//*************************************************************************** +// Free function callback via etl::function +//*************************************************************************** +int free_ticks1 = 0; + +void free_callback1() +{ + ++free_ticks; +} + +callback_type free_callback1 = callback_type::create(); + +//*************************************************************************** +// Timer controller. +//*************************************************************************** +etl::callback_timer<2> timer_controller; + +//*************************************************************************** +// The main loop. +//*************************************************************************** +int main() +{ + etl::timer::id::type id1 = timer_controller.register_timer(member_callback, + 1000, + etl::timer::mode::SINGLE_SHOT); + + etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, + 100, + etl::timer::mode::REPEATING); + + timer_controller.start(id1); + timer_controller.start(id2); + timer_controller.start(id3); + + timer_controller.enable(true); + + // Start timer interrupts here. + + while (true) + { + // Loop forever. + } + + return 0; +} + +//*************************************************************************** +// The interrupt timer callback. +//*************************************************************************** +void timer_interrupt() +{ + const uint32_t TICK = 1; + static uint32_t nticks = TICK; + + if (timer_controller.tick(nticks)) + { + nticks = TICK; + } + else + { + nticks += TICK; + } +} + diff --git a/docs/raw/frameworks/Callback Timer Interrupt.txt b/docs/raw/frameworks/Callback Timer Interrupt.txt new file mode 100644 index 00000000..dd55025a --- /dev/null +++ b/docs/raw/frameworks/Callback Timer Interrupt.txt @@ -0,0 +1,226 @@ +Callback Timer Interrupt +20.25.0 + +A software timer class that can manage up to 254 timers. Each one may be repeating or single shot. +When a timer triggers it will call the selected function. The function may be a class member or free function. +The timers are driven from a call to tick(uint32_t count). This call would normally be made from a high priority interrupt routine. The destination function will receive the callback in the same context as the tick call. +The call to tick has a low overhead when a timer is not 'due'. Internally the timers are stored in 'first timeout' order so only the head of the list needs to be checked. + +Each timer may have a period of up to 232-2 ticks (4,294,967,294). +At 1ms per tick this would equate to just over 49 days. + +The framework relies on a supplied interrupt enable/disable guard type. With this mechanism, calls to tick are disabled if certain member functions are called. If the program flow is within a disable/enable section when the timer interrupt is activated then the tick update will be deferred until the next tick period. The timer interrupt may interrogate the return value of tick() to check whether the update was deferred. The guard allows timer functions to be to be called from the callback called by tick(). + +Defines the following classes:- +etl::icallback_timer_atomic +etl::callback_timer_atomic + +Uses definitions from timer.h + +Important: +For correct operation of the timer framework, the routine that calls tick must not be pre-emptible by another routine that calls a timer function. Also, calls to the timer framework may only be made from the caller of tick and one other, lower priority, thread of execution +____________________________________________________________________________________________________ +icallback_timer_atomic +The base class for all timer controllers. + +Template parameters +MAX_TIMERS The number of timers to be supported. The maximum number is 254. +A value of 255 will result in a compile error. +_____________________________________________________________________________________________________ +TInterruptGuard The type that enables/disables interrupts. + +Type definitions +callback_type etl::delegate +The function type used for callbacks. +_____________________________________________________________________________________________________ +Member functions +etl::timer::id::type register_timer(callback_type callback, + uint32_t period, + bool repeating) +Registers a timer calling a free or static function. +callback A delegate to the callback funtion that will be callled when the timer expires. +period The timer period in ticks. +repeating false if single shot, true if repeating. + +Returns the allocated timer id or etl::timer::mode::NO_TIMER if one was not available. +____________________________________________________________________________________________________ +bool unregister_timer(etl::timer::id::type id) +Unregisters a timer. +If the timer is active then it will be stopped. +Returns true if a timer with the id was successfully unregistered. +___________________________________________________________________________________________________ +void enable(bool state) +Enables or disables the timer manager according to the state. +____________________________________________________________________________________________________ +bool is_running() const +Returns true if the timer manager is enabled. +____________________________________________________________________________________________________ +void clear() +Clears the callback timer back to the initial state. All timers will be stopped and unregistered. +____________________________________________________________________________________________________ +bool tick(uint32_t count) +This function updates the internal tick counter (if enabled) and must pass the number of ticks that have occurred since the last call. If the count encompasses more than one period of a repeating timer then the timer will be triggered multiple times in one call to tick. +Returns true if the tick counter was updated, otherwise false. This may be used by the calling routine to accumulate unprocessed tick counts. +____________________________________________________________________________________________________ +bool start(etl::timer::id::type id, bool immediate = false) +Starts the timer with the specified id. +If the timer is already running then the timer Is restarted from the current tick count. +If immediate is true then the timer is triggered on the next call to tick(). Note: Single shot timers will only trigger once. +If the id does not correspond to a registered timer then returns false. +____________________________________________________________________________________________________ +bool stop(etl::timer::id::type id) +Stops the timer with the specified id. +Does nothing if the timer is already stopped. +if the id does not correspond to a registered timer then returns false. +____________________________________________________________________________________________________ +bool set_period(etl::timer::id::type id, uint32_t period) +Stops the timer with the specified id. +Sets a new timer period. +Returns true if successful. +____________________________________________________________________________________________________ +bool set_mode(etl::timer::id::type id, bool repeating) +Stops the timer with the specified id. +Sets a new timer mode. +Returns true if successful. +____________________________________________________________________________________________________ +etl::timer::id::type time_to_next() +Returns the time to the next timeout. +20.38.0 +____________________________________________________________________________________________________ +Constants +MAX_TIMERS +The maximum number of timer that can be handled. +____________________________________________________________________________________________________ +callback_timer_atomic + +Template parameters +MAX_TIMERS The number of timers to be supported. The maximum number is 254. +A value of 255 will result in a compile error. + +TInterruptGuard The type that enables/disables interrupts. +____________________________________________________________________________________________________ +message_timer_atomic() +Default construct. +____________________________________________________________________________________________________ +Example + +//*************************************************************************** +// Class callback via etl::function +//*************************************************************************** +class Test +{ +public: + + Test() + : ticks(0) + { + } + + void callback() + { + ++ticks; + } + + int ticks; +}; + +Test test; + +//*************************************************************************** +// The interrupt guard type. +// Saves and disables on contruction. +// Restores on destruction. +//*************************************************************************** +struct InterruptGuard +{ + InterruptGuard() + { + state = __save_interrupts(); + __disable_interrupts(); + } + + ~InterruptGuard() + { + __restore_interrupts(state); + } + + int state; +}; + +using callback_type = etl::icallback_timer_atomic::callback_type; + +callback_type member_callback = callback_type::create member_callback; + +//*************************************************************************** +// Free function callback via etl::function +//*************************************************************************** +int free_ticks1 = 0; + +void free_callback1() +{ + ++free_ticks; +} + +callback_type free_callback1 = callback_type::create(); + +//*************************************************************************** +// Free function callback via function pointer +//*************************************************************************** +int free_ticks2 = 0; + +void free_callback2() +{ + ++free_ticks2; +} + +//*************************************************************************** +// Timer controller. +//*************************************************************************** +etl::callback_timer_atomic<2, InterruptGuard> timer_controller; + +//*************************************************************************** +// The main loop. +//*************************************************************************** +int main() +{ + etl::timer::id::type id1 = timer_controller.register_timer(member_callback, + 1000, + etl::timer::mode::SINGLE_SHOT); + + etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, + 100, + etl::timer::mode::REPEATING); + + timer_controller.start(id1); + timer_controller.start(id2); + + timer_controller.enable(true); + + // Start timer interrupts here. + + while (true) + { + // Loop forever. + } + + return 0; +} + +//*************************************************************************** +// The interrupt timer callback. +//*************************************************************************** +void timer_interrupt() +{ + const uint32_t TICK = 1; + static uint32_t nticks = TICK; + + if (timer_controller.tick(nticks)) + { + nticks = TICK; + } + else + { + nticks += TICK; + } +} + diff --git a/docs/raw/frameworks/Callback Timer Locked.txt b/docs/raw/frameworks/Callback Timer Locked.txt new file mode 100644 index 00000000..e9c18c63 --- /dev/null +++ b/docs/raw/frameworks/Callback Timer Locked.txt @@ -0,0 +1,207 @@ +Callback Timer Locked + +A software timer class that can manage up to 254 timers. Each one may be repeating or single shot. +When a timer triggers it will call the selected function. The function may be a class member or free function. +The timers are driven from a call to tick(uint32_t count). This call would normally be made from a high priority interrupt routine. The destination function will receive the callback in the same context as the tick call. +The call to tick has a low overhead when a timer is not 'due'. Internally the timers are stored in 'first timeout' order so only the head of the list needs to be checked. + +Each timer may have a period of up to 232-2 ticks (4,294,967,294). +At 1ms per tick this would equate to just over 49 days. + +Defines the following classes:- +etl::icallback_timer_locked +etl::callback_timer_locked + +The access to the timers is controlled by three external functions, supplied to the timer by the +member function set_locks. + +The three delegate parameters are:- +Try Lock Attempts to set the lock. Returns true if successful, otherwise false. +Lock Sets the lock. +Unlock Resets the lock. + +Uses definitions from timer.h + +Important: +For correct operation of the timer framework, the routine that calls tick must not be pre-emptible by another routine that calls a timer function. Also, calls to the timer framework may only be made from the caller of tick and one other, lower priority, thread of execution +____________________________________________________________________________________________________ +icallback_timer_locked +The base class for all timer controllers. + +Type definitions +callback_type etl::delegate +The function type used for callbacks. + +try_lock_type etl::delegate +The function type used for 'try lock'. + +lock_type etl::delegate +The function type used for 'lock'. + +unlock_type etl::delegate +The function type used for 'unlock'. +____________________________________________________________________________________________________ +Member functions +etl::timer::id::type register_timer(callback_type callback), + uint32_t period, + bool repeating) +Registers a timer calling a free or static function. +callback A delegate to the callback free funtion that will be callled when the timer expires. +period The timer period in ticks. +repeating false if single shot, true if repeating. + +Returns the allocated timer id or etl::timer::mode::NO_TIMER if one was not available. +____________________________________________________________________________________________________ +bool unregister_timer(etl::timer::id::type id) +Unregisters a timer. +If the timer is active then it will be stopped. +Returns true if a timer with the id was successfully unregistered. +___________________________________________________________________________________________________ +void enable(bool state) +Enables or disables the timer manager according to the state. +____________________________________________________________________________________________________ +bool is_running() const +Returns true if the timer manager is enabled. +____________________________________________________________________________________________________ +void clear() +Clears the callback timer back to the initial state. All timers will be stopped and unregistered. +____________________________________________________________________________________________________ +bool tick(uint32_t count) +This function updates the internal tick counter (if enabled) and must pass the number of ticks that have occurred since the last call. If the count encompasses more than one period of a repeating timer then the timer will be triggered multiple times in one call to tick. +Returns true if the tick counter was updated, otherwise false. This may be used by the calling routine to accumulate unprocessed tick counts. +____________________________________________________________________________________________________ +bool start(etl::timer::id::type id, bool immediate = false) +Starts the timer with the specified id. +If the timer is already running then the timer Is restarted from the current tick count. +If immediate is true then the timer is triggered on the next call to tick(). Note: Single shot timers will only trigger once. +If the id does not correspond to a registered timer then returns false. +____________________________________________________________________________________________________ +bool stop(etl::timer::id::type id) +Stops the timer with the specified id. +Does nothing if the timer is already stopped. +if the id does not correspond to a registered timer then returns false. +____________________________________________________________________________________________________ +bool set_period(etl::timer::id::type id, uint32_t period) +Stops the timer with the specified id. +Sets a new timer period. +Returns true if successful. +____________________________________________________________________________________________________ +bool set_mode(etl::timer::id::type id, bool repeating) +Stops the timer with the specified id. +Sets a new timer mode. +Returns true if successful. +____________________________________________________________________________________________________ +void set_locks(try_lock_type try_lock_, lock_type lock_, lock_type unlock_) +Sets the try-lock, lock and unlock delegates. +____________________________________________________________________________________________________ +etl::timer::id::type time_to_next() +Returns the time to the next timeout. +20.38.0 +____________________________________________________________________________________________________ +Constants +MAX_TIMERS +The maximum number of timers that can be handled. +____________________________________________________________________________________________________ +callback_timer_locked + +Template parameters +MAX_TIMERS The number of timers to be supported. The maximum number is 254. +A value of 255 will result in a compile error. + +callback_timer_locked() +Default construct. +The lock callback delegates are not set. +____________________________________________________________________________________________________ +callback_timer_locked(try_lock_type try_lock, lock_type lock, unlock_type unlock) +Construct from lock callback delegates. +____________________________________________________________________________________________________ +Example + +//*************************************************************************** +// Class callback via etl::function +//*************************************************************************** +class Test +{ +public: + + Test() + : ticks(0) + { + } + + void callback() + { + ++ticks; + } + + int ticks; +}; + +using callback_type = etl::icallback_timer_atomic::callback_type; + +callback_type member_callback = callback_type::create member_callback; + +//*************************************************************************** +// Free function callback via etl::function +//*************************************************************************** +int free_ticks1 = 0; + +void free_callback1() +{ + ++free_ticks; +} + +callback_type free_callback1 = callback_type::create(); + +//*************************************************************************** +// Timer controller. +//*************************************************************************** +etl::callback_timer<2> timer_controller; + +//*************************************************************************** +// The main loop. +//*************************************************************************** +int main() +{ + etl::timer::id::type id1 = timer_controller.register_timer(member_callback, + 1000, + etl::timer::mode::SINGLE_SHOT); + + etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, + 100, + etl::timer::mode::REPEATING); + + timer_controller.start(id1); + timer_controller.start(id2); + timer_controller.start(id3); + + timer_controller.enable(true); + + // Start timer interrupts here. + + while (true) + { + // Loop forever. + } + + return 0; +} + +//*************************************************************************** +// The interrupt timer callback. +//*************************************************************************** +void timer_interrupt() +{ + const uint32_t TICK = 1; + static uint32_t nticks = TICK; + + if (timer_controller.tick(nticks)) + { + nticks = TICK; + } + else + { + nticks += TICK; + } +} + diff --git a/docs/raw/frameworks/Callback Timer.txt b/docs/raw/frameworks/Callback Timer.txt new file mode 100644 index 00000000..101dd576 --- /dev/null +++ b/docs/raw/frameworks/Callback Timer.txt @@ -0,0 +1,244 @@ +Callback Timer +This class has been superseded. +Consider using callback_timer_atomic or callback_timer_locked. + +A software timer class that can manage up to 254 timers. Each one may be repeating or single shot. +When a timer triggers it will call the selected function. The function may be a class member or free function. +The timers are driven from a call to tick(uint32_t count). This call would normally be made from a high priority interrupt routine. The destination function will receive the callback in the same context as the tick call. +The call to tick has a low overhead when a timer is not 'due'. Internally the timers are stored in 'first timeout' order so only the head of the list needs to be checked. + +Each timer may have a period of up to 232-2 ticks (4,294,967,294). +At 1ms per tick this would equate to just over 49 days. + +Defines the following classes:- +etl::icallback_timer +etl::callback_timer +etl::callback_timer_data + +Uses definitions from timer.h + +An example Keil project for the Nucleo 401RE may be found in examples/ArmTimerCallbacks - C++ + +Usage notes +The message timer is designed to be used in a timer interrupt/thread - single foreground task environment. The timer tick call may pre-empt the foreground task, except when a timer function is within a ETL_DISABLE_TIMER_UPDATES / ETL_ENABLE_TIMER_UPDATES section. These macros will either use an atomic semaphore or contain code to disable or enable the relevant timer interrupts. + +There are two macros that control which mechanism is used. +____________________________________________________________________________________________________ +ETL_CALLBACK_TIMER_USE_ATOMIC_LOCK + +The framework relies on an atomic counter type. By default this is defined as etl::timer_semaphore_t. +This in turn is either defined as std::atomic, if the compiler supports std::atomic, or +etl::atomic if there is an atomic_xxx.h defined for the platform. A user defined type may be used for the semaphore by defining ETL_TIMER_SEMAPHORE_TYPE. Only the timer interrupt/thread and one foreground task may call register_timer, unregister_timer, clear, start or stop. +With this mechanism, calls to tick are never disabled. If the foreground thread is within a disable/enable section when the timer interrupt/thread is activated then the tick update will be deferred until the next tick period. The timer interrupt/thread may interrogate the return value of tick() to check whether the update was deferred. +____________________________________________________________________________________________________ +ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK + +The user must supply two macro definitions (ETL_CALLBACK_TIMER_DISABLE_INTERRUPTS and ETL_MESSAGE_TIMER_ENABLE_INTERRUPTS) to control interrupt enables. These macros must enable/disable all interrupts that may call tick, register_timer, unregister_timer, clear, start or stop. +The user should ensure that mechanisms, such as memory barriers are used to disable re-ordering of the instructions. +If the foreground task is within a disable/enable section when the timer interrupt is triggered then the tick update will be deferred until the interrupts are re-enabled. Depending on the resolution of the timers, the interrupt routine may be able to compensate for the delay by passing a modified tick count to tick(). + +Important: +For correct operation of the timer framework, the routine that calls tick must not be pre-emptible by another routine that calls a timer function. Also, calls to the timer framework may only be made from the caller of tick and one other, lower priority, thread of execution +____________________________________________________________________________________________________ +icallback_timer +The base class for all timer controllers. + +Member functions +etl::timer::id::type register_timer(void (*p_callback)(), + uint32_t period, + bool repeating) + +Registers a timer calling a free or static function. +p_callback A pointer to the callback free funtion that will be callled when the timer expires. +period The timer period in ticks. +repeating false if single shot, true if repeating. + +Returns the allocated timer id or etl::timer::mode::NO_TIMER if one was not available. +_____________________________________________________________________________________________________ +etl::timer::id::type register_timer(etl::ifunction& callback, + uint32_t period, + bool repeating) + +Registers a timer calling a free, static or member function through the etl::ifunction interface. +p_callback A reference to the etl::function callback function that will be called when the timer expires. +period The timer period in ticks. +repeating false if single shot, true if repeating. + +Returns the allocated timer id or etl::timer::id::NO_TIMER if one was not available. +_____________________________________________________________________________________________________ +etl::timer::id::type register_timer(etl::delegate& callback, + uint32_t period, + bool repeating) + +Registers a timer calling a free, static or member function through the etl::delegate interface. +p_callback A reference to the etl::delegate callback function that will be called when the timer expires. +period The timer period in ticks. +repeating false if single shot, true if repeating. + +Returns the allocated timer id or etl::timer::id::NO_TIMER if one was not available. +____________________________________________________________________________________________________ +bool unregister_timer(etl::timer::id::type id) + +Unregisters a timer. +If the timer is active then it will be stopped. +Returns true if a timer with the id was successfully unregistered. +___________________________________________________________________________________________________ +void enable(bool state) + +Enables or disables the timer manager according to the state. +____________________________________________________________________________________________________ +bool is_running() const + +Returns true if the timer manager is enabled. +____________________________________________________________________________________________________ +void clear() + +Clears the callback timer back to the initial state. All timers will be stopped and unregistered. +____________________________________________________________________________________________________ +bool tick(uint32_t count) + +This function updates the internal tick counter (if enabled) and must pass the number of ticks that have occurred since the last call. If the count encompasses more than one period of a repeating timer then the timer will be triggered multiple times in one call to tick. +Returns true if the tick counter was updated, otherwise false. This may be used by the calling routine to accumulate unprocessed tick counts. +____________________________________________________________________________________________________ +bool start(etl::timer::id::type id, bool immediate = false) + +Starts the timer with the specified id. +If the timer is already running then the timer Is restarted from the current tick count. +If immediate is true then the timer is triggered on the next call to tick(). Note: Single shot timers will only trigger once. +If the id does not correspond to a registered timer then returns false. +____________________________________________________________________________________________________ +bool stop(etl::timer::id::type id) + +Stops the timer with the specified id. +Does nothing if the timer is already stopped. +if the id does not correspond to a registered timer then returns false. +____________________________________________________________________________________________________ +bool set_period(etl::timer::id::type id, uint32_t period) + +Stops the timer with the specified id. +Sets a new timer period. +Returns true if successful. +____________________________________________________________________________________________________ +bool set_mode(etl::timer::id::type id, bool repeating) + +Stops the timer with the specified id. +Sets a new timer mode. +Returns true if successful. +____________________________________________________________________________________________________ +etl::timer::id::type time_to_next() +Returns the time to the next timeout. +20.38.0 +____________________________________________________________________________________________________ +Constants + +MAX_TIMERS +____________________________________________________________________________________________________ +callback_timer + +Template parameters +MAX_TIMERS The number of timers to be supported. The maximum number is 254. +A value of 255 will result in a compile error. +____________________________________________________________________________________________________ +Example + +//*************************************************************************** +// Class callback via etl::function +//*************************************************************************** +class Test +{ +public: + + Test() + : ticks(0) + { + } + + void callback() + { + ++ticks; + } + + int ticks; +}; + +Test test; +etl::function_mv member_callback(test); + +//*************************************************************************** +// Free function callback via etl::function +//*************************************************************************** +int free_ticks1 = 0; + +void free_callback1() +{ + ++free_ticks; +} + +etl::function_fv free_function_callback; + +//*************************************************************************** +// Free function callback via function pointer +//*************************************************************************** +int free_ticks2 = 0; + +void free_callback2() +{ + ++free_ticks2; +} + +//*************************************************************************** +// Timer controller. +//*************************************************************************** +etl::callback_timer<3> timer_controller; + +//*************************************************************************** +// The main loop. +//*************************************************************************** +int main() +{ + etl::timer::id::type id1 = timer_controller.register_timer(member_callback, + 1000, + etl::timer::mode::SINGLE_SHOT); + + etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, + 100, + etl::timer::mode::REPEATING); + + etl::timer::id::type id3 = timer_controller.register_timer(free_callback2, + 10, + etl::timer::mode::REPEATING); + + timer_controller.start(id1); + timer_controller.start(id2); + timer_controller.start(id3); + + timer_controller.enable(true); + + // Start timer interrupts here. + + while (true) + { + // Loop forever. + } + + return 0; +} + +//*************************************************************************** +// The interrupt timer callback. +//*************************************************************************** +void timer_interrupt() +{ + const uint32_t TICK = 1; + static uint32_t nticks = TICK; + + if (timer_controller.tick(nticks)) + { + nticks = TICK; + } + else + { + nticks += TICK; + } +} + diff --git a/docs/raw/frameworks/Cooperative Scheduler.txt b/docs/raw/frameworks/Cooperative Scheduler.txt new file mode 100644 index 00000000..7e759aeb --- /dev/null +++ b/docs/raw/frameworks/Cooperative Scheduler.txt @@ -0,0 +1,183 @@ +Cooperative Scheduler + +A lightweight cooperative multi-tasking scheduler. +Can be used stand-alone or in conjunction with a messaging system such as the ETL's message router or FSM as the back-end handler. For use when a complex OS or RTOS is overkill. + +Calls an 'idle' callback whenever the scheduler returns true. +Calls a 'watchdog' callback whenever the scheduler returns. + +The scheduler makes use of etl::task. + +____________________________________________________________________________________________________ +Scheduling Policies +A number of built-in scheduling policies are available. +Note: The tasks are stored in decreasing priority id order. i.e. Higher id = higher priority. + +____________________________________________________________________________________________________ +Sequential Single +etl::scheduler_policy_sequential_single + +A sequential algorithm that calls a task if it has work to do , starting from the highest priority task. +On return, it moves to the next task in the list. At the end of the list it returns the idle status. +If no tasks with work were found then the idle status is set to true. + +____________________________________________________________________________________________________ +Sequential Multiple +etl::scheduler_policy_sequential_multiple + +A sequential algorithm that calls a task if it has work to do , starting from the highest priority task. +On return, it calls the task again if it still has work, otherwise it moves to the next task in the list. +At the end of the list it returns the idle status. +If no tasks with work were found then the idle status is set to true. + +____________________________________________________________________________________________________ +Highest Priority +etl::scheduler_policy_highest_priority + +An algorithm that calls the highest priority task that has work to do. +Returns the idle status. +If no tasks with work were found then the idle status is set to true. + +____________________________________________________________________________________________________ +Most Work +etl::scheduler_policy_most_work + +An algorithm that calls the task that has the most work to do, starting from the highest priority task. +Returns the idle status. +If no tasks with work were found then the idle status is set to true. + +____________________________________________________________________________________________________ +Custom Scheduler +Creating a custom scheduler policy is simple. +Just create a structure with the following signature and add your own scheduling algorithm. +To get 'idle' callbacks then the policy must regularly return true. +To get 'watchdog' callbacks then the policy must regularly return. + +struct scheduler_policy_custom +{ + bool schedule_tasks(etl::ivector& task_list) + { + bool idle = true; + + //************************************** + // Add your scheduling policy here. + // Set 'idle' to false if any tasks were run. + //************************************** + + return idle; + } +}; + +____________________________________________________________________________________________________ +ischeduler +Can be used as a reference to all scheduler instances. + +ischeduler() + +Constructor + +____________________________________________________________________________________________________ +void set_idle_callback(etl::ifunction& callback); + +Sets the function to be called when idle. + +____________________________________________________________________________________________________ +void set_watchdog_callback(etl::ifunction& callback); + +Sets the function to be called to reset the watchdog. + +____________________________________________________________________________________________________ +void set_scheduler_running(bool scheduler_running); + +Sets the running state of the scheduler. + +____________________________________________________________________________________________________ +bool scheduler_is_running() const; + +Gets the running state of the scheduler. + +____________________________________________________________________________________________________ +void exit_scheduler() + +Instructs the scheduler to exit after the next idle call. + +____________________________________________________________________________________________________ +void add_task(etl::task& task); + +Adds a task to the task list. +The task list is in priority order where higher id = higher priority. Tasks with duplicate ids are in insert order. +Emits an etl::scheduler_too_many_tasks_exception if the task list is full. + +____________________________________________________________________________________________________ +template +void add_task_list(etl::task** p_tasks, TSize size); + +Emits an etl::scheduler_too_many_tasks_exception if the task list is full. +Emits an etl::scheduler_null_task_exception if any of the task pointers is null. + +____________________________________________________________________________________________________ +virtual void start() + +Starts the scheduler. + +____________________________________________________________________________________________________ +scheduler +Inherits from etl::ischeduler. + +____________________________________________________________________________________________________ +Template Parameters + +TSchedulerPolicy The policy to use schedule tasks. +MAX_TASKS The maximum number of tasks to schedule. + +____________________________________________________________________________________________________ +Member Functions + +scheduler() + +Constructor. + +void start() + +Starts the scheduler. +Emits an etl::scheduler_no_tasks_exception if there are no tasks in the list. + +____________________________________________________________________________________________________ +Errors + +scheduler_exception +Inherits from etl::exception + +scheduler_no_tasks_exception +Inherits from etl::scheduler_exception + +scheduler_null_task_exception +Inherits from etl::scheduler_exception + +____________________________________________________________________________________________________ +Overview of use +As a basic example, you will have to define the following... + +Tasks +For each of your tasks, derive a class from etl::task and overide the two virtual functions uint32_t task_request_work() const and void task_process_work(). task_request_work returns a value that informs the scheduler that this task has work to process. The return value should be non-zero if the task has work. This meaning of this is user defined, it could be the number of messages in the task's queue, or just a 0 = no work, 1 = have work. task_process_work allows the task to process any work that it has. How much work it processes on each call is user defined; often it will be one 'unit' of work and letting the policy determine which task gets the next opportunity to process more. + +Task list +An array of pointers to the tasks. Passed to the scheduler with add_task_list. +Use add_task to add additional tasks. + +The scheduler +An instance of etl::scheduler with the required scheduling policy. +Initialise the task list by calling add_task_list. + +Callbacks +If you wish to get callbacks for 'idle' or 'watchdog' then define callback functions and call set_idle_callback and set_watchdog_callback to tell the scheduler. +The callbacks may be global, static or member function, wrapped in an etl::function. + +Starting the scheduler +The scheduler is started by calling start(). + +____________________________________________________________________________________________________ +Example + +An example of the scheduler can be found in the repository in examples/Scheduler + diff --git a/docs/raw/frameworks/Delegate Service.txt b/docs/raw/frameworks/Delegate Service.txt new file mode 100644 index 00000000..25b53106 --- /dev/null +++ b/docs/raw/frameworks/Delegate Service.txt @@ -0,0 +1,58 @@ +Delegate Service +This template class allows easier integration of 'C' style events (such as interrupt vectors) and C++ handlers. +It can allow abstraction between low level events such as interrupts and their application dependent handlers. +The handlers may be any combination of global, static, member functions, lambdas and functors. +It utilises the templated function wrapper. See here. + +The delegate callbacks are identified by an id. The values of the ids must range from zero or a specified offset, up to the maximum range of specified delegates. Calling an unused delegate id will either do nothing or, if the user has specified a handler, call this with the id of the delegate. + +There are functions that use both runtime and compile time checks of the delegate id. +Compile time is preferable. + +template * Delegates = nullptr> +etl::delegate_service + +Range The id range of the delegates (last - first + 1). +Offset The starting id for the range. Default 0. +Delegates An optional pointer to an array of delegate pointers. + +If the pointer to a delegate array is supplied as a template parameter then the delegate service may be declared constexpr, otherwise the service is runtime only. +____________________________________________________________________________________________________ +Member functions +____________________________________________________________________________________________________ +delegate_service() +Runtime only +Sets all of the delegates to route to the unhandled delegate. +Sets the unhandled delegate to default (do nothing). +____________________________________________________________________________________________________ +template +void register_delegate(etl::delegate& callback) +Runtime only +Registers delegate with the id specified in the template parameter. +A compile time error will occur if the id is out of range. +____________________________________________________________________________________________________ +void register_delegate(size_t id, etl::delegate& callback) +Runtime only +Registers delegate with the id specified in the template parameter. +The registration will be ignored if the id is out of range. +____________________________________________________________________________________________________ +void register_unhandled_delegate(etl::delegate& callback) +Runtime only +Registers the delegate to be used for unhandled ids. +____________________________________________________________________________________________________ +template +void call() +Calls the delegate associated with the id. +Calls the unhandled delegate if the id has not been registered. +A compile time error will occur if the id is out of range. +____________________________________________________________________________________________________ +void call(const size_t id) +Calls the delegate associated with the id. +Calls the unhandled delegate if the id has not been registered or if is out of range. +____________________________________________________________________________________________________ +Example + +Tutorial + +See the example project in etl\examples\FunctionInterruptSimulation-Delegates + diff --git a/docs/raw/frameworks/Finite State Machine.txt b/docs/raw/frameworks/Finite State Machine.txt new file mode 100644 index 00000000..cf489c14 --- /dev/null +++ b/docs/raw/frameworks/Finite State Machine.txt @@ -0,0 +1,434 @@ +Finite State Machine + +This page documents version 20.0.0 and above. +For version 19.x.x or earlier see this page. + +A finite state machine driven by the reception of events (messages) . The incoming messages will be automatically routed to specific handlers based on the message list defined in the template parameters. Optional on_entry and on_exit handlers are available. + +This FSM is slightly more involved to set up than the traditional simple table driven method, but provides great flexibility in implementation. It may also be faster due to the fact that all messages are routed through a direct switch/case/call method rather than scanning a lookup table and calling indirectly through function pointers. + +The on_event functions are not virtual. The template class uses CRTP to directly call the derived class's functions. + +Defines the following classes:- +etl::ifsm_state +etl::fsm_state <