|
libtcspc C++ API
Streaming TCSPC and time tag data processing
|
Bucket source that reuses storage.
This bucket source provides buckets whose underlying memory is allocated via new[], but storage from destroyed buckets is reused for new buckets. Extraction of the storage is not supported (cannot be done because the storage is a private type).
This bucket source is thread-safe: buckets (or their storage) may be created and destroyed on multiple threads simultaneously. (Access to an individual bucket is not thread-safe.)
| T | the bucket element type |
| Blocking | if true, block when a new bucket is requested but the number of outstanding buckets has reached the maximum count. |
| ClearRecycled | if true, bucket data elements will be destroyed when the bucket (or its storage) is destroyed; otherwise elements may remain in the recycled storage. |
Inherits tcspc::bucket_source< T >, and std::enable_shared_from_this< recycling_bucket_source< T, false, false > >.
Public Member Functions | |
| auto | bucket_of_size (std::size_t size) -> bucket< T > override |
| Implements bucket source requirement. | |
| Public Member Functions inherited from tcspc::bucket_source< T > | |
| virtual auto | shared_view_of (bucket< T > const &bkt) -> bucket< T const > |
| Create a shared view bucket that is a read-only view of the given bucket but may outlive the original bucket. | |
| virtual auto | supports_shared_views () const noexcept -> bool |
| Return whether this bucket source is a sharable bucket source. | |
Static Public Member Functions | |
| static auto | create (arg::max_bucket_count<> max_bucket_count=arg::max_bucket_count{std::numeric_limits< std::size_t >::max()}, arg::max_recycled_size<> max_recycled_size=arg::max_recycled_size<>{ 0}) -> std::shared_ptr< bucket_source< T > > |
| Create an instance. | |
|
inlineoverridevirtual |
Implements bucket source requirement.
This function will block if Blocking is true and the maximum bucket count has been reached. It will then unblock when an outstanding bucket is destroyed.
| tcspc::buffer_overflow_error | if Blocking is false and the maximum bucket count has been reached. |
Implements tcspc::bucket_source< T >.
|
inlinestatic |
Create an instance.
| max_bucket_count | the maximum number of buckets that can be outstanding from this bucket source at any given time. |
| max_recycled_size | the maximum bucket size whose storage is recycled; if 0, recycle all |