more ai generated doc with human review
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
/*! \file pistatemachine_base.h
|
||||
* \ingroup StateMachine
|
||||
* \~\brief
|
||||
* \~english Some template helpers for PIStateMachine
|
||||
* \~russian Несколько шаблонов для PIStateMachine
|
||||
*/
|
||||
//! \addtogroup StateMachine
|
||||
//! \{
|
||||
//! \file pistatemachine_base.h
|
||||
//! \brief
|
||||
//! \~english Some template helpers for PIStateMachine
|
||||
//! \~russian Несколько шаблонов для PIStateMachine
|
||||
//! \details
|
||||
//! \~english Contains helper classes and functions for state machine implementation
|
||||
//! \~russian Содержит вспомогательные классы и функции для реализации машины состояний
|
||||
//! \}
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Some template helpers for PIStateMachine
|
||||
Some template helpers for PIStateMachine
|
||||
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,11 +35,19 @@
|
||||
|
||||
namespace PIStateMachineHelpers {
|
||||
|
||||
//! \~english Helper namespace for state machine implementation
|
||||
//! \~russian Вспомогательное пространство имён для реализации машины состояний
|
||||
|
||||
//! \~english Base class for function wrappers
|
||||
//! \~russian Базовый класс для обёрток функций
|
||||
class FunctionBase {
|
||||
public:
|
||||
//! \~english Virtual destructor
|
||||
//! \~russian Виртуальный деструктор
|
||||
virtual ~FunctionBase() {}
|
||||
|
||||
//! \~english Returns format hash for type checking
|
||||
//! \~russian Возвращает хеш формата для проверки типов
|
||||
virtual uint formatHash() = 0;
|
||||
};
|
||||
|
||||
@@ -44,15 +56,24 @@ public:
|
||||
template<typename... Args>
|
||||
class Function: public FunctionBase {
|
||||
public:
|
||||
//! \~english Returns format hash for type checking
|
||||
//! \~russian Возвращает хеш формата для проверки типов
|
||||
uint formatHash() override {
|
||||
static uint ret = PIConstChars(typeid(std::function<void(Args...)>).name()).hash();
|
||||
return ret;
|
||||
}
|
||||
|
||||
//! \~english Stored function
|
||||
//! \~russian Сохранённая функция
|
||||
std::function<bool(Args...)> func;
|
||||
};
|
||||
|
||||
//! \~english Creates function wrapper from std::function
|
||||
//! \~russian Создает обёртку функции из std::function
|
||||
//! \tparam Ret Return type of the function
|
||||
//! \tparam Args Argument types of the function
|
||||
//! \param func Function to wrap
|
||||
//! \return Pointer to function wrapper
|
||||
template<typename Ret, typename... Args>
|
||||
FunctionBase * makeFunction(std::function<Ret(Args...)> func) {
|
||||
auto * ret = new Function<Args...>();
|
||||
|
||||
Reference in New Issue
Block a user