A type-safe, ordered collection of elements that can receive the buffer from outside (loan).
More...
template<typename T, typename _NonConstEnabler = std::true_type>
class eprosima::fastdds::dds::LoanableSequence< T, _NonConstEnabler >
A type-safe, ordered collection of elements that can receive the buffer from outside (loan).
For users who define data types in OMG IDL, this type corresponds to the IDL express sequence<T>.
For any user-data type Foo that an application defines for the purpose of data-distribution with Fast DDS, a 'using FooSeq = LoanableSequence<Foo>
' is generated. The sequence offers a subset of the methods defined by the standard OMG IDL to C++ mapping for sequences. We refer to an IDL 'sequence<Foo>
' as FooSeq
.
The state of a sequence is described by the properties 'maximum', 'length' and 'has_ownership'.
- The 'maximum' represents the size of the underlying buffer; this is the maximum number of elements it can possibly hold. It is returned by the maximum() operation.
- The 'length' represents the actual number of elements it currently holds. It is returned by the length() operation.
- The 'has_ownership' flag represents whether the sequence owns the underlying buffer. It is returned by the has_ownership() operation. If the sequence does not own the underlying buffer, the underlying buffer is loaned from somewhere else. This flag influences the lifecycle of the sequence and what operations are allowed on it. The general guidelines are provided below and more details are described in detail as pre-conditions and post-conditions of each of the sequence's operations:
- If has_ownership == true, the sequence has ownership on the buffer. It is then responsible for destroying the buffer when the sequence is destroyed.
- If has_ownership == false, the sequence does not have ownership on the buffer. This implies that the sequence is loaning the buffer. The sequence should not be destroyed until the loan is returned.
- A sequence with a zero maximum always has has_ownership == true