|
libtcspc C++ API
Streaming TCSPC and time tag data processing
|
Abstract base class for polymorphic bucket sources.
Bucket source instances are handled via std::shared_ptr.
| T | the bucket data element type |
Inherited by tcspc::new_delete_bucket_source< T >, tcspc::recycling_bucket_source< T, Blocking, ClearRecycled >, tcspc::sharable_new_delete_bucket_source< T >, tcspc::sharable_recycling_bucket_source< T, Blocking, ClearRecycled >, and tcspc::test_bucket_source< T >.
Public Member Functions | |
| virtual auto | bucket_of_size (std::size_t size) -> bucket< T >=0 |
Create a bucket of size elements of type 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. | |
|
pure virtual |
Create a bucket of size elements of type T.
Implemented in tcspc::new_delete_bucket_source< T >, tcspc::recycling_bucket_source< T, Blocking, ClearRecycled >, tcspc::sharable_new_delete_bucket_source< T >, tcspc::sharable_recycling_bucket_source< T, Blocking, ClearRecycled >, and tcspc::test_bucket_source< T >.
|
inlinenodiscardvirtual |
Create a shared view bucket that is a read-only view of the given bucket but may outlive the original bucket.
When supported, this function creates a second bucket that shares ownership of the underlying storage of the given bkt. A shared view remains valid even if the original bucket is destroyed first.
For this reason, it is safe to pass a shared view bucket by non-const (rvalue) reference to other code, such as a downstream processor. This allows move-semantic transmission of the shared view bucket, allowing for, e.g., buffering without copying of the data.
Shared views may only be created from original non-view buckets; they cannot be created from existing shared views.
Depending on the bucket source, storage extraction from a shared view bucket may or may not be supported (even if the original buckets support it).
Sharability is an optional feature of bucket sources because managing shared storage may have overhead.
| bkt | the original bucket, which must have been returned by bucket_of_size() of this bucket source (and not by a previous call to shared_view_of()). |
Reimplemented in tcspc::sharable_new_delete_bucket_source< T >, tcspc::sharable_recycling_bucket_source< T, Blocking, ClearRecycled >, and tcspc::test_bucket_source< T >.
|
inlinenodiscardvirtualnoexcept |
Return whether this bucket source is a sharable bucket source.
A sharable bucket source supports the creation of shared views of buckets via shared_view_of().
Reimplemented in tcspc::sharable_new_delete_bucket_source< T >, tcspc::sharable_recycling_bucket_source< T, Blocking, ClearRecycled >, and tcspc::test_bucket_source< T >.