A type-safe, ordered collection of elements that can receive the buffer from outside (loan). More...
#include <LoanableSequence.hpp>

Public Types | |
| using | size_type = LoanableCollection::size_type |
| using | element_type = LoanableCollection::element_type |
Public Types inherited from LoanableCollection | |
| using | size_type = int32_t |
| using | element_type = void * |
Public Member Functions | |
| LoanableSequence ()=default | |
| Default constructor. | |
| LoanableSequence (size_type max) | |
| Pre-allocation constructor. | |
| ~LoanableSequence () | |
| Deallocate this sequence's buffer. | |
| LoanableSequence (const LoanableSequence &other) | |
| Construct a sequence with the contents of another sequence. | |
| LoanableSequence & | operator= (const LoanableSequence &other) |
| Copy the contents of another sequence into this one. | |
Public Member Functions inherited from LoanableTypedCollection< T, _NonConstEnabler > | |
| template<typename Enabler = _NonConstEnabler> | |
| std::enable_if< Enabler::value, T >::type & | operator[] (size_type n) |
| Set an element of the sequence. | |
| const T & | operator[] (size_type n) const |
| Get an element of the sequence. | |
Public Member Functions inherited from LoanableCollection | |
| const element_type * | buffer () const |
| Get the pointer to the elements buffer. | |
| bool | has_ownership () const |
| Get the ownership flag. | |
| size_type | maximum () const |
| Get the maximum number of elements currently allocated. | |
| size_type | length () const |
| Get the number of elements currently accessible. | |
| bool | length (size_type new_length) |
| Set the number of elements currently accessible. | |
| bool | loan (element_type *buffer, size_type new_maximum, size_type new_length) |
| Loan a buffer to the collection. | |
| element_type * | unloan (size_type &maximum, size_type &length) |
| Remove the loan from the collection. | |
| element_type * | unloan () |
| Remove the loan from the collection. | |
Protected Attributes | |
| size_type | maximum_ |
| size_type | length_ |
| element_type * | elements_ |
| bool | has_ownership_ |
Protected Attributes inherited from LoanableCollection | |
| size_type | maximum_ = 0 |
| size_type | length_ = 0 |
| element_type * | elements_ = nullptr |
| bool | has_ownership_ = true |
Additional Inherited Members | |
Protected Member Functions inherited from LoanableCollection | |
| LoanableCollection ()=default | |
| Default constructor. | |
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'.
| using element_type = LoanableCollection::element_type |
| using size_type = LoanableCollection::size_type |
|
default |
Default constructor.
Creates the sequence with no data.
|
inline |
Pre-allocation constructor.
Creates the sequence with an initial number of allocated elements. When the input parameter is less than or equal to 0, the behavior is equivalent to the default constructor. Otherwise, the post-conditions below will apply.
| [in] | max | Number of elements to pre-allocate. |
|
inline |
Deallocate this sequence's buffer.
|
inline |
Construct a sequence with the contents of another sequence.
This method performs a deep copy of the sequence received into this one. Allocations will happen when other.length() > 0
| [in] | other | The sequence from where contents are to be copied. |
|
inline |
Copy the contents of another sequence into this one.
This method performs a deep copy of the sequence received into this one. If this sequence had a buffer loaned, it will behave as if unloan has been called. Allocations will happen when (a) has_ownership() == false and other.length() > 0 (b) has_ownership() == true and other.length() > maximum()
| [in] | other | The sequence from where contents are to be copied. |
|
protected |
|
protected |
|
protected |
|
protected |