Defines methods to manipulate thread-safe collections intended for producer/consumer usage. This interface provides a unified representation for producer/consumer collections so that higher level abstractions such as xtd::collections::concurrent::blocking_collection <type_t> can use the collection as the underlying storage mechanism.
Public Properties | |
| virtual auto | count () const noexcept -> xtd::usize=0 |
| Gets the number of elements contained in the xtd::collections::generic::icollection. | |
| virtual auto | is_synchronized () const noexcept -> bool=0 |
| Gets a value indicating whether access to the xtd::collections::generic::icollection is synchronized (thread safe). | |
| virtual auto | sync_root () const noexcept -> const object &=0 |
| Gets an object that can be used to synchronize access to the the xtd::collections::generic::icollection <type_t>. | |
Public Methods | |
| virtual auto | copy_to (xtd::array< type_t > &array, xtd::usize array_index) const -> void=0 |
| Copies the elements of the xtd::collections::generic::icollection <type_t> to an xtd::array, starting at a particular xtd::array index. | |
| virtual auto | get_enumerator () const -> xtd::collections::generic::enumerator< type_t >=0 |
| Returns an enumerator that iterates through a collection. | |
| virtual auto | to_array () const -> xtd::array< type_t >=0 |
| Copies the elements contained in the xtd::collections::concurrent::iproducer_consumer_collection <type_t> to a new array. | |
| virtual auto | try_add (const type_t &item) -> bool=0 |
| Attempts to add an object to the xtd::collections::concurrent::iproducer_consumer_collection <type_t>. | |
| virtual auto | try_take (type_t &item) -> bool=0 |
| Attempts to remove and return an object from the xtd::collections::concurrent::iproducer_consumer_collection <type_t>. | |
|
nodiscardpure virtualnoexcept |
Gets the number of elements contained in the xtd::collections::generic::icollection.
Implemented in xtd::collections::concurrent::concurrent_bag< type_t >.
|
nodiscardpure virtualnoexcept |
Gets a value indicating whether access to the xtd::collections::generic::icollection is synchronized (thread safe).
Implemented in xtd::collections::concurrent::concurrent_bag< type_t >.
|
nodiscardpure virtualnoexcept |
Gets an object that can be used to synchronize access to the the xtd::collections::generic::icollection <type_t>.
|
pure virtual |
Copies the elements of the xtd::collections::generic::icollection <type_t> to an xtd::array, starting at a particular xtd::array index.
| array | The one-dimensional xtd::array that is the destination of the elements copied from xtd::collections::generic::icollection <type_t>. The xtd::array must have zero-based indexing. |
| array_index | The zero-based index in array at which copying begins. |
| xtd::argument_exception | The number of elements in the source xtd::collections::generic::icollection <type_t> is greater than the available space from `array_index` to the end of the destination `array`. |
|
nodiscardpure virtual |
Returns an enumerator that iterates through a collection.
Implemented in xtd::collections::concurrent::concurrent_bag< type_t >.
|
nodiscardpure virtual |
Copies the elements contained in the xtd::collections::concurrent::iproducer_consumer_collection <type_t> to a new array.
Implemented in xtd::collections::concurrent::concurrent_bag< type_t >.
|
pure virtual |
Attempts to add an object to the xtd::collections::concurrent::iproducer_consumer_collection <type_t>.
| item | The object to add to the xtd::collections::concurrent::iproducer_consumer_collection <type_t>. |
|
pure virtual |
Attempts to remove and return an object from the xtd::collections::concurrent::iproducer_consumer_collection <type_t>.
| item | When this method returns, if the object was removed and returned successfully, item contains the removed object. If no object was available to be removed, the value is unspecified. |