Fast DDS  Version 3.0.0
Fast DDS
Loading...
Searching...
No Matches
LoanableTypedCollection< T, _NonConstEnabler > Class Template Reference

A type-safe accessible collection of generic opaque pointers that can receive the buffer from outside (loan). More...

#include <LoanableTypedCollection.hpp>

Inheritance diagram for LoanableTypedCollection< T, _NonConstEnabler >:

Public Member Functions

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_typebuffer () 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_typeunloan (size_type &maximum, size_type &length)
 Remove the loan from the collection.
 
element_typeunloan ()
 Remove the loan from the collection.
 

Additional Inherited Members

- Public Types inherited from LoanableCollection
using size_type = int32_t
 
using element_type = void *
 
- Protected Member Functions inherited from LoanableCollection
 LoanableCollection ()=default
 Default constructor.
 
virtual void resize (size_type new_length)=0
 
- Protected Attributes inherited from LoanableCollection
size_type maximum_ = 0
 
size_type length_ = 0
 
element_typeelements_ = nullptr
 
bool has_ownership_ = true
 

Detailed Description

template<typename T, typename _NonConstEnabler = std::true_type>
class eprosima::fastdds::dds::LoanableTypedCollection< T, _NonConstEnabler >

A type-safe accessible collection of generic opaque pointers that can receive the buffer from outside (loan).

This is an abstract class. See LoanableSequence for details.

Member Function Documentation

◆ operator[]() [1/2]

template<typename T , typename _NonConstEnabler = std::true_type>
template<typename Enabler = _NonConstEnabler>
std::enable_if< Enabler::value, T >::type & operator[] ( size_type  n)
inline

Set an element of the sequence.

This is the operator that is invoked when the application indexes into a non-const sequence:

element = sequence[n];
sequence[n] = element;

Note that a reference to the element is returned (and not a copy)

Parameters
[in]nindex of element to access, must be >= 0 and less than length().
Returns
a reference to the element at position n

◆ operator[]() [2/2]

template<typename T , typename _NonConstEnabler = std::true_type>
const T & operator[] ( size_type  n) const
inline

Get an element of the sequence.

This is the operator that is invoked when the application indexes into a const sequence:

element = sequence[n];

Note that a reference to the element is returned (and not a copy)

Parameters
[in]nindex of element to access, must be >= 0 and less than length().
Returns
a const reference to the element at position

The documentation for this class was generated from the following file: