Skip to content

Commit f42ddbd

Browse files
committed
Expose find_producer functions
1 parent 2417bcd commit f42ddbd

2 files changed

Lines changed: 28 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [Unreleased]
6+
7+
### Changed
8+
- Expose `find_producer()` functions
9+
- Added Doxygen documentation for the `find_producer()` overloads.
10+
511
## [1.0.1] - 2026-06-17
612

713
- Renamed canonical header from slick/stream_buffer_multiplexer.h to slick/stream_buffer_multiplexer.hpp. The old .h path is kept as a backward-compatibility shim that re-exports the new header and emits a compiler warning directing users to update their includes.

include/slick/stream_buffer_multiplexer.hpp

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,28 @@ class stream_buffer_multiplexer {
265265
return shared_queue_->initial_reading_index();
266266
}
267267

268+
/**
269+
* @brief Find a registered producer by id.
270+
* @param producer_id Producer id to look up.
271+
* @return Non-owning pointer to the producer, or nullptr if producer_id is unregistered.
272+
*/
273+
producer_buffer* find_producer(uint32_t producer_id) noexcept {
274+
return const_cast<producer_buffer*>(std::as_const(*this).find_producer(producer_id));
275+
}
276+
277+
/**
278+
* @brief Find a registered producer by id.
279+
* @param producer_id Producer id to look up.
280+
* @return Non-owning pointer to the producer, or nullptr if producer_id is unregistered.
281+
*/
282+
const producer_buffer* find_producer(uint32_t producer_id) const noexcept {
283+
if (producer_id < dense_producers_.size()) {
284+
return dense_producers_[producer_id];
285+
}
286+
auto it = producers_.find(producer_id);
287+
return it == producers_.end() ? nullptr : it->second.get();
288+
}
289+
268290
private:
269291
static constexpr size_t dense_lookup_limit_ = 4096;
270292

@@ -299,18 +321,6 @@ class stream_buffer_multiplexer {
299321
return {};
300322
}
301323

302-
producer_buffer* find_producer(uint32_t producer_id) noexcept {
303-
return const_cast<producer_buffer*>(std::as_const(*this).find_producer(producer_id));
304-
}
305-
306-
const producer_buffer* find_producer(uint32_t producer_id) const noexcept {
307-
if (producer_id < dense_producers_.size()) {
308-
return dense_producers_[producer_id];
309-
}
310-
auto it = producers_.find(producer_id);
311-
return it == producers_.end() ? nullptr : it->second.get();
312-
}
313-
314324
template <typename Cursor>
315325
multiplex_record read_impl(Cursor& cursor) noexcept {
316326
for (;;) {

0 commit comments

Comments
 (0)