13#include "acme/prototype/prototype/transfer.h"
15#include "acme/prototype/prototype/pointer.h"
17#include "acme/prototype/prototype/subparticle.h"
19#include "acme/prototype/time/_time.h"
21CLASS_DECL_ACME class ::time default_run_timeout();
71template <
typename ENTITY,
typename... ARGUMENTS >
72concept callable = ::std::is_invocable< ENTITY, ARGUMENTS... >::type;
74template <
typename ENTITY,
typename RESULT,
typename... ARGUMENTS >
78constexpr bool is_lvalue_helper = std::is_lvalue_reference<T>::value;
81constexpr bool is_xvalue_helper = std::is_rvalue_reference<T>::value;
84constexpr bool is_prvalue_helper = !(is_lvalue_helper<T> || is_xvalue_helper<T>);
87constexpr bool is_rvalue_helper = is_xvalue_helper<T> || is_prvalue_helper<T>;
90constexpr bool is_glvalue_helper = is_xvalue_helper<T> || is_lvalue_helper<T>;
92#define is_left_instance(type_instance) is_lvalue_helper<decltype((type_instance))>
93#define is_xvalue(type_instance) is_xvalue_helper<decltype((type_instance))>
94#define is_prvalue(type_instance)is_prvalue_helper<decltype((type_instance))>
95#define is_right_instance(type_instance) is_rvalue_helper<decltype((type_instance))>
96#define is_glvalue(type_instance)is_glvalue_helper<decltype((type_instance))>
145#define FUNCTION_DEBUGGING 1
146class function_common_base
149#if FUNCTION_DEBUGGING
150 const_char_pointer m_pszDebug;
153 class ::time m_timeTimeout;
156 function_common_base(
const class ::time &timeTimeout = default_run_timeout()) :
157 m_timeTimeout(timeTimeout)
163 class ::time timeout()
const
166 return m_timeTimeout;
171 void set_timeout(
const class ::time & timeTimeout)
173 m_timeTimeout = timeTimeout;
347template <
typename PRIMITIVE_FUNCTION >
352 template < prototype_function FUNCTION >
357template <
typename PROCEDURE >
359 requires(PROCEDURE procedure)
362 { procedure() } -> std::same_as<void>;
367template <
typename PROCEDURE >
369class pure_procedure :
370 virtual public ::subparticle
375 PROCEDURE m_procedure;
377 pure_procedure(
const PROCEDURE & procedure) :
378 m_procedure(procedure)
385 void operator()()
override
406class function < void() > :
407 public ::function_common_base,
408 public ::pointer < ::subparticle >
415 using base_pointer = ::pointer < ::subparticle >;
429 function(
::subparticle *psubparticle,
const class ::time &timeTimeout = default_run_timeout()) :
430 function_common_base(timeTimeout),
431 base_pointer(psubparticle)
437 function(
::lparam &
lparam,
const class ::time &timeTimeout = default_run_timeout()) :
438 function_common_base(timeTimeout), base_pointer(
lparam)
444 template <
typename PROCEDURE >
446 function(
const PROCEDURE &procedure,
const class time &timeTimeout = default_run_timeout()) :
447 function_common_base(timeTimeout), base_pointer(allocateø
pure_procedure(procedure))
501 template <
typename PROCEDURE >
502 function(enum_timeout,
const class time & timeTimeout,
const PROCEDURE & procedureParam) :
503 function(procedureParam, timeTimeout)
515 void operator()()
const
518 this->m_p->operator()();
523 function & operator = (
const function & function)
526 base_pointer::operator=(function);
535template <
typename FUNCTION,
typename RETURN_TYPE>
540 {
function() } -> std::same_as<RETURN_TYPE>;
545template <
typename RETURN_TYPE >
547 virtual public ::subparticle
552 virtual RETURN_TYPE function_get() = 0;
559template <
typename FUNCTION,
typename RETURN_TYPE >
560class return_function :
569 return_function(
const FUNCTION &
function) :
584 RETURN_TYPE function_get()
587 return this->m_function();
596template <
typename RETURN_TYPE >
597class function < RETURN_TYPE() > :
598 public function_common_base,
599 public ::pointer<::return_function_base <RETURN_TYPE >>
603 using base = ::return_function_base <RETURN_TYPE >;
605 using base_pointer = ::pointer<::return_function_base <RETURN_TYPE >>;
611 function(nullptr_t) {}
623 template <
typename FUNCTION >
625 function(
const FUNCTION &functionParam,
const class ::time & timeTimeout = default_run_timeout()) :
626 function_common_base(timeTimeout),
658 template <
typename FUNCTION >
659 function(enum_timeout,
const class time & timeTimeout,
const FUNCTION & functionParam) :
660 function(functionParam, timeTimeout)
672 RETURN_TYPE operator()()
const
675 return this->m_p->function_get();
712 function & operator = (
const function & function)
715 base_pointer::operator=(function);
741template <
typename FUNCTION,
typename RETURN_TYPE,
typename... ARGUMENTS>
743 requires(FUNCTION
function, ARGUMENTS... arguments)
746 {
function(arguments...) } -> std::same_as<RETURN_TYPE>;
751template <
typename RETURN_TYPE,
typename... ARGUMENTS >
753 virtual public ::subparticle
758 virtual RETURN_TYPE operator()(ARGUMENTS... arguments) = 0;
765template <
typename FUNCTION,
typename RETURN_TYPE,
typename... ARGUMENTS >
767class arguments_function :
779 arguments_function(
const FUNCTION &
function) :
786 RETURN_TYPE operator()(ARGUMENTS... arguments)
override
789 return m_function(arguments...);
796template <
typename RETURN_TYPE,
typename... ARGUMENTS >
797class function < RETURN_TYPE(ARGUMENTS...) > :
798 public function_common_base,
799 public ::pointer <arguments_function_base< RETURN_TYPE, ARGUMENTS...>>
848 function(nullptr_t) {}
861 template <
typename FUNCTION >
863 function(
const FUNCTION &functionParam,
const class ::time &timeTimeout = default_run_timeout()) :
864 function_common_base(timeTimeout),
895 template <
typename FUNCTION >
897 function(enum_timeout,
const class time & timeTimeout,
const FUNCTION & functionParam) :
898 function(functionParam, timeTimeout)
903 function(base *pbase,
const class ::time &timeTimeout = default_run_timeout()) :
904 function_common_base(timeTimeout),
919 RETURN_TYPE operator()(ARGUMENTS... arguments)
const
924 return this->m_p->operator()(arguments...);
963 function & operator = (
const function & function)
966 base_pointer::operator=(function);
992template <
typename PROCEDURE,
typename... ARGUMENTS>
994 requires(PROCEDURE procedure, ARGUMENTS... arguments)
997 { procedure(arguments...) } -> std::same_as<void>;
1002template <
typename ... ARGUMENTS>
1004 virtual public ::subparticle
1008 virtual void operator()(ARGUMENTS... arguments)= 0;
1013template <
typename PROCEDURE,
typename ... ARGUMENTS >
1014class arguments_procedure :
1019 PROCEDURE m_procedure;
1021 arguments_procedure(
const PROCEDURE & procedure) :
1022 m_procedure(procedure)
1067 virtual void operator()(ARGUMENTS... arguments)
1070 this->m_procedure(arguments...);
1161template <
typename... ARGUMENTS >
1162class function < void(ARGUMENTS...) > :
1163 public function_common_base,
1164 public ::pointer < arguments_procedure_base <ARGUMENTS...> >
1182 function(nullptr_t) {}
1194 template <
typename PROCEDURE >
1196 function(
const PROCEDURE &procedure,
const class ::time &timeTimeout = default_run_timeout()) :
1197 function_common_base(timeTimeout),
1208 function(base *pbase,
const class ::time &timeTimeout = default_run_timeout()) :
1209 function_common_base(timeTimeout),
1218 template <
typename PAYLOAD_WITH_PROCEDURE >
1219 requires (::is_same<::std::decay_t<PAYLOAD_WITH_PROCEDURE>,
payload >
1220|| ::is_same<::std::decay_t <PAYLOAD_WITH_PROCEDURE>,
property>)
1221 function(PAYLOAD_WITH_PROCEDURE payloadWithProcedure,
const class ::time &timeTimeout = default_run_timeout()) :
1222 function_common_base(timeTimeout),
1223 base_pointer(
dynamic_cast <base*
>(as_subparticle(payloadWithProcedure)))
1241 template <
typename PROCEDURE >
1243 function(enum_timeout,
const class time & timeTimeout,
const PROCEDURE & procedure) :
1244 function(procedure, timeTimeout)
1257 void operator()(ARGUMENTS... arguments)
const
1260 this->m_p->operator()(arguments...);
1294 function & operator = (
const function & function)
1297 base_pointer::operator=(function);
Definition function.h:754
Definition function.h:769
Definition function.h:1005
Definition function.h:1016
Definition _template_forward_declaration.h:297
Definition handler_context.h:9
Definition function.h:371
Definition function.h:548
Definition function.h:562
Definition subparticle.h:78
Definition function.h:742
Definition function.h:993
Definition function.h:348
Definition function.h:358
Definition function.h:536