131 template <
typename TRequest,
typename TReply>
140 template <
typename TRequest>
154 template <
typename Derived>
163 std::unique_ptr<Daemon>
operator()(
typename Derived::Params
const& params) {
164 static_assert(std::is_base_of<Daemon, Derived>::value,
165 "Derived type must inherit from tec::Daemon");
166 return std::make_unique<Derived>(params);
Abstract interface for a daemon that runs in a separate thread.
Definition tec_daemon.hpp:47
Daemon(Daemon &&)=delete
Daemons are non-movable to ensure unique ownership.
virtual Status make_request(Request &&, Reply &&)=0
Sends a request and waits for a reply in a daemon process.
virtual void send(Message &&msg)=0
Sends a control message to the daemon.
Daemon(const Daemon &)=delete
Daemons are non-copyable to ensure unique ownership.
virtual ~Daemon()=default
Virtual destructor for safe polymorphic deletion.
Status request(const TRequest *req)
Helper: Sends a notification request – no reply required.
Definition tec_daemon.hpp:141
Daemon()=default
Default constructor.
virtual Status run()=0
Starts the daemon's operation.
virtual Status terminate()=0
Terminates the daemon's operation.
Status request(const TRequest *req, TReply *rep)
Helper: Sends a request and waits for a reply in a daemon process.
Definition tec_daemon.hpp:132
virtual const Signal & sig_terminated() const =0
Retrieves the signal indicating the daemon is terminated.
A thread-safe signal mechanism for inter-thread synchronization.
Definition tec_signal.hpp:44
Factory for creating daemon instances.
Definition tec_daemon.hpp:155
std::unique_ptr< Daemon > operator()(typename Derived::Params const ¶ms)
Creates a unique pointer to a derived daemon instance.
Definition tec_daemon.hpp:163
Common definitions and utilities for the tec namespace.
Defines a flexible message type and helper functions for the tec namespace.
std::any Reply
Type alias for a reply object that can hold any object.
Definition tec_message.hpp:55
std::any Message
Type alias for a message that can hold any object.
Definition tec_message.hpp:43
std::any Request
Type alias for a request object that can hold any object.
Definition tec_message.hpp:49
Defines a thread-safe signal implementation using mutex and condition variable.
Defines error handling types and utilities for the tec namespace.