29#ifndef ETL_MESSAGE_ROUTER_REGISTRY_INCLUDED
30#define ETL_MESSAGE_ROUTER_REGISTRY_INCLUDED
34#include "message_router.h"
115 return *(itr->second);
121 return *(itr->second);
154 return lhs.itr ==
rhs.itr;
171 IRegistry::iterator itr;
210 return *(itr->second);
237 return lhs.itr ==
rhs.itr;
254 IRegistry::const_iterator itr;
265 const_iterator
begin()
const
267 return const_iterator(registry.cbegin());
270 const_iterator cbegin()
const
272 return const_iterator(registry.cbegin());
283 const_iterator
end()
const
285 return const_iterator(registry.cend());
288 const_iterator cend()
const
290 return const_iterator(registry.cend());
298 IRegistry::iterator itr = registry.find(
id);
300 if (registry.find(
id) != registry.end())
312 IRegistry::const_iterator itr = registry.find(
id);
314 if (registry.find(
id) != registry.end())
329 return iterator(registry.lower_bound(
id));
332 const_iterator
lower_bound(etl::message_router_id_t
id)
const
334 return const_iterator(IRegistry::const_iterator(registry.lower_bound(
id)));
342 return iterator(registry.upper_bound(
id));
345 const_iterator
upper_bound(etl::message_router_id_t
id)
const
347 return const_iterator(IRegistry::const_iterator(registry.upper_bound(
id)));
358 IRegistry::value_type element(
router.get_message_router_id(), &
router);
360 registry.insert(element);
374 if (p_router != ETL_NULLPTR)
384 template <
typename TIterator>
387 while (first != last)
408 return find(
id) != ETL_NULLPTR;
420 if (p_router == ETL_NULLPTR)
425 IRegistry::const_iterator
irouter = registry.find(p_router->get_message_router_id());
436 IRegistry::const_iterator
irouter = registry.find(
router.get_message_router_id());
446 return registry.count(
id);
454 return registry.empty();
462 return registry.full();
470 return registry.size();
478 return registry.available();
486 return registry.max_size();
507 template <
size_t MaxRouters>
524 template <
typename TIterator>
528 while (first != last)
535#if ETL_HAS_INITIALIZER_LIST
542 std::initializer_list<etl::imessage_router*>::const_iterator itr =
init.begin();
544 while (itr !=
init.end())
555 message_router_registry(
const message_router_registry& rhs)
556 : imessage_router_registry(registry)
558 registry = rhs.registry;
564 message_router_registry& operator =(
const message_router_registry& rhs)
566 registry = rhs.registry;
Const Iterator.
Definition message_router_registry.h:178
Iterator.
Definition message_router_registry.h:88
This is the base of all message router registries.
Definition message_router_registry.h:75
void add(etl::imessage_router *p_router)
Definition message_router_registry.h:372
iterator lower_bound(etl::message_router_id_t id)
Get the lower bound in the registry with the specified ID.
Definition message_router_registry.h:327
bool contains(const etl::message_router_id_t id) const
Definition message_router_registry.h:406
bool contains(const etl::imessage_router &router) const
Definition message_router_registry.h:434
bool full() const
Returns true if the registry is full, otherwise false.
Definition message_router_registry.h:460
etl::imessage_router * find(etl::message_router_id_t id)
Get the first router in the registry with the specified ID.
Definition message_router_registry.h:296
bool empty() const
Returns true if the registry is empty, otherwise false.
Definition message_router_registry.h:452
void add(TIterator first, const TIterator &last)
Definition message_router_registry.h:385
size_t size() const
Returns the size of the registry.
Definition message_router_registry.h:468
size_t available() const
Returns the available size of the registry.
Definition message_router_registry.h:476
iterator upper_bound(etl::message_router_id_t id)
Get the upper bound in the registry with the specified ID.
Definition message_router_registry.h:340
bool contains(const etl::imessage_router *const p_router) const
Definition message_router_registry.h:418
size_t max_size() const
Returns the maximum size of the registry.
Definition message_router_registry.h:484
iterator end()
Get the end of the registry.
Definition message_router_registry.h:278
void add(etl::imessage_router &router)
Definition message_router_registry.h:354
iterator begin()
Get the beginning of the registry.
Definition message_router_registry.h:260
void remove(etl::message_router_id_t id)
Unregisters a router.
Definition message_router_registry.h:397
size_t count(const etl::message_router_id_t id) const
Returns the number of routers with the specified ID.
Definition message_router_registry.h:444
This is the base of all message routers.
Definition message_router_generator.h:121
Base exception class for message router registry.
Definition message_router_registry.h:49
The registry is full.
Definition message_router_registry.h:62
Message router registry.
Definition message_router_registry.h:509
message_router_registry(TIterator first, const TIterator &last)
Definition message_router_registry.h:525
ETL_CONSTEXPR14 bool operator==(const etl::expected< TValue, TError > &lhs, const etl::expected< TValue2, TError2 > &rhs)
Equivalence operators.
Definition expected.h:968
Definition exception.h:47
bitset_ext
Definition absolute.h:38
iterator
Definition iterator.h:399
pair holds two objects of arbitrary type
Definition utility.h:164
T2 second
second is a copy of the second object
Definition utility.h:169