Soldered 125kHz RFID board Arduino library 1.0.0
Library for Soldered 125kHz RFID board.
Loading...
Searching...
No Matches
MultiDelegate< Delegate, ISQUEUE, QUEUE_CAPACITY > Class Template Reference

#include <MultiDelegate.h>

Inherits delegate::detail::MultiDelegate< Delegate, Delegate::target_type, false, 32 >.

Detailed Description

template<typename Delegate, bool ISQUEUE = false, size_t QUEUE_CAPACITY = 32>
class MultiDelegate< Delegate, ISQUEUE, QUEUE_CAPACITY >

The MultiDelegate class template can be specialized to either a queue or an event multiplexer. It is designed to be used with Delegate, the efficient runtime wrapper for C function ptr and C++ std::function.

Template Parameters
Delegatespecifies the concrete type that MultiDelegate bases the queue or event multiplexer on.
ISQUEUEmodifies the generated MultiDelegate class in subtle ways. In queue mode (ISQUEUE == true), the value of QUEUE_CAPACITY enforces the maximum number of simultaneous items the queue can contain. This is exploited to minimize the use of new and delete by reusing already allocated items, thus reducing heap fragmentation. In event multiplexer mode (ISQUEUE = false), new and delete are used for allocation of the event handler items. If the result type of the function call operator of Delegate is void, calling a MultiDelegate queue removes each item after calling it; a Multidelegate event multiplexer keeps event handlers until explicitly removed. If the result type of the function call operator of Delegate is non-void, in a MultiDelegate queue the type-conversion to bool of that result determines if the item is immediately removed or kept after each call: if true is returned, the item is removed. A Multidelegate event multiplexer keeps event handlers until they are explicitly removed.
QUEUE_CAPACITYis only used if ISQUEUE == true. Then, it sets the maximum capacity that the queue dynamically allocates from the heap. Unused items are not returned to the heap, but are managed by the MultiDelegate instance during its own lifetime for efficiency.

The documentation for this class was generated from the following file: