|
|
@ -20,8 +20,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
namespace srsran {
|
|
|
|
namespace srsran {
|
|
|
|
|
|
|
|
|
|
|
|
using observer_id = std::size_t;
|
|
|
|
using observer_id = std::size_t;
|
|
|
|
const size_t invalid_observer_id = std::numeric_limits<observer_id>::max();
|
|
|
|
const std::size_t invalid_observer_id = std::numeric_limits<observer_id>::max();
|
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args>
|
|
|
|
template <typename... Args>
|
|
|
|
class observer;
|
|
|
|
class observer;
|
|
|
@ -84,7 +84,7 @@ public:
|
|
|
|
template <typename... Args2>
|
|
|
|
template <typename... Args2>
|
|
|
|
observer_id subscribe(Args2&&... args)
|
|
|
|
observer_id subscribe(Args2&&... args)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
size_t id = 0;
|
|
|
|
std::size_t id = 0;
|
|
|
|
for (auto& slot : observers) {
|
|
|
|
for (auto& slot : observers) {
|
|
|
|
if (not static_cast<bool>(slot)) {
|
|
|
|
if (not static_cast<bool>(slot)) {
|
|
|
|
// empty slot found
|
|
|
|
// empty slot found
|
|
|
@ -108,9 +108,9 @@ public:
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
size_t nof_observers() const
|
|
|
|
std::size_t nof_observers() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
size_t count = 0;
|
|
|
|
std::size_t count = 0;
|
|
|
|
for (auto& slot : observers) {
|
|
|
|
for (auto& slot : observers) {
|
|
|
|
count += static_cast<bool>(slot) ? 1 : 0;
|
|
|
|
count += static_cast<bool>(slot) ? 1 : 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|