Fast DDS  Version 3.1.0
Fast DDS
Loading...
Searching...
No Matches
UserAllocatedSequence Struct Reference

A collection of generic opaque pointers allocated by the user. More...

#include <UserAllocatedSequence.hpp>

Inheritance diagram for UserAllocatedSequence:

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

 UserAllocatedSequence (element_type *items, size_type num_items)
 Construct a UserAllocatedSequence.
 
 ~UserAllocatedSequence ()=default
 
 UserAllocatedSequence (const UserAllocatedSequence &)=delete
 
UserAllocatedSequenceoperator= (const UserAllocatedSequence &)=delete
 
 UserAllocatedSequence (UserAllocatedSequence &&)=delete
 
UserAllocatedSequenceoperator= (UserAllocatedSequence &&)=delete
 
- 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.
 

Protected Member Functions

void resize (size_type new_length) override
 
- Protected Member Functions inherited from LoanableCollection
 LoanableCollection ()=default
 Default constructor.
 

Protected Attributes

size_type maximum_
 
size_type length_
 
element_typeelements_
 
bool has_ownership_
 
- Protected Attributes inherited from LoanableCollection
size_type maximum_ = 0
 
size_type length_ = 0
 
element_typeelements_ = nullptr
 
bool has_ownership_ = true
 

Detailed Description

A collection of generic opaque pointers allocated by the user.

This kind of collection would always return true for has_ownership(), and thus would not be able to receive loans. It would also have an inmutable maximum(), so it would not allow length() to grow beyond the maximum value indicated on construction.

Member Typedef Documentation

◆ element_type

◆ size_type

Constructor & Destructor Documentation

◆ UserAllocatedSequence() [1/3]

UserAllocatedSequence ( element_type items,
size_type  num_items 
)
inline

Construct a UserAllocatedSequence.

Parameters
[in]itemsPointer to the beginning of an array of num_items opaque pointers.
[in]num_itemsNumber of opaque pointers in items.
Postcondition
buffer() == items
has_ownership() == true
length() == 0
maximum() == num_items

◆ ~UserAllocatedSequence()

~UserAllocatedSequence ( )
default

◆ UserAllocatedSequence() [2/3]

◆ UserAllocatedSequence() [3/3]

Member Function Documentation

◆ operator=() [1/2]

UserAllocatedSequence & operator= ( const UserAllocatedSequence )
delete

◆ operator=() [2/2]

UserAllocatedSequence & operator= ( UserAllocatedSequence &&  )
delete

◆ resize()

void resize ( size_type  new_length)
inlineoverrideprotectedvirtual

Implements LoanableCollection.

Member Data Documentation

◆ elements_

element_type* elements_
protected

◆ has_ownership_

bool has_ownership_
protected

◆ length_

size_type length_
protected

◆ maximum_

size_type maximum_
protected

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