31#ifndef ETL_DELEGATE_SERVICE_INCLUDED
32#define ETL_DELEGATE_SERVICE_INCLUDED
36#include "static_assert.h"
49#if ETL_USING_CPP11 && !defined(ETL_DELEGATE_FORCE_CPP03_IMPLEMENTATION)
50 template <
size_t Range,
53 class delegate_service
67 ETL_STATIC_ASSERT(Id < (Offset + Range),
"Callback Id out of range");
68 ETL_STATIC_ASSERT(Id >= Offset,
"Callback Id out of range");
70 Delegates[Id - Offset](Id);
77 void call(
size_t id)
const
79 if ((
id >= Offset) && (
id < (Offset + Range)))
82 Delegates[
id - Offset](id);
99 template <
size_t Range,
101#if ETL_USING_CPP11 && !defined(ETL_DELEGATE_FORCE_CPP03_IMPLEMENTATION)
102 class delegate_service<Range, Offset, nullptr>
131 ETL_STATIC_ASSERT(
Id < (
Offset +
Range),
"Callback Id out of range");
132 ETL_STATIC_ASSERT(
Id >=
Offset,
"Callback Id out of range");
168 ETL_STATIC_ASSERT(
Id < (
Offset +
Range),
"Callback Id out of range");
169 ETL_STATIC_ASSERT(
Id >=
Offset,
"Callback Id out of range");
178 void call(
const size_t id)
const
198 void unhandled(
size_t id)
const
200 if (unhandled_delegate.is_valid())
202 unhandled_delegate(
id);
207 delegate_type unhandled_delegate;
Definition delegate_service.h:106
delegate_service()
Definition delegate_service.h:115
void call() const
Definition delegate_service.h:166
void register_delegate(size_t id, delegate_type callback)
Definition delegate_service.h:143
void register_delegate(delegate_type callback)
Definition delegate_service.h:129
void register_unhandled_delegate(delegate_type callback)
Definition delegate_service.h:155
void call(const size_t id) const
Definition delegate_service.h:178
Declaration.
Definition delegate_cpp03.h:175
bitset_ext
Definition absolute.h:38
pair holds two objects of arbitrary type
Definition utility.h:164