68 const std::string& name =
"callback_job");
78 const std::string& name =
"callback_job");
111 callback_job(
const std::function<std::optional<std::string>(
const std::vector<uint8_t>&)>&
113 const std::vector<uint8_t>& data,
114 const std::string& name =
"data_callback_job");
126 callback_job(
const std::function<common::VoidResult(
const std::vector<uint8_t>&)>&
128 const std::vector<uint8_t>& data,
129 const std::string& name =
"data_callback_job");
150 [[nodiscard]]
auto do_work(
void) -> common::VoidResult
override;
A specialized job class that encapsulates user-defined callbacks.
std::function< common::VoidResult(void)> callback_
Stores the user-defined callback that does not take any parameters.
callback_job(const std::function< std::optional< std::string >(void)> &callback, const std::string &name="callback_job")
Constructs a new callback_job instance with a parameterless callback.
std::function< std::optional< std::string >(const std::vector< uint8_t > &)> old_data_callback_
std::function< common::VoidResult(const std::vector< uint8_t > &)> data_callback_
Stores the user-defined callback that takes a std::vector<uint8_t>.
~callback_job(void) override
Virtual destructor for proper cleanup in derived classes.
std::function< std::optional< std::string >(void)> old_callback_
Compatibility layer for the old style callbacks.
auto do_work(void) -> common::VoidResult override
Executes the appropriate callback function to perform the job's work.
Represents a unit of work (task) to be executed, typically by a job queue.
@ callback
Call user callback for custom decision.
Base job class for schedulable work units in the thread system.
Core threading foundation of the thread system library.