A collection of generic opaque pointers allocated by the user. More...
#include <UserAllocatedSequence.hpp>
Public Types | |
using | size_type = LoanableCollection::size_type |
using | element_type = LoanableCollection::element_type |
![]() | |
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 | |
UserAllocatedSequence & | operator= (const UserAllocatedSequence &)=delete |
UserAllocatedSequence (UserAllocatedSequence &&)=delete | |
UserAllocatedSequence & | operator= (UserAllocatedSequence &&)=delete |
![]() | |
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 Member Functions | |
void | resize (size_type new_length) override |
![]() | |
LoanableCollection ()=default | |
Default constructor. | |
Protected Attributes | |
size_type | maximum_ |
size_type | length_ |
element_type * | elements_ |
bool | has_ownership_ |
![]() | |
size_type | maximum_ = 0 |
size_type | length_ = 0 |
element_type * | elements_ = nullptr |
bool | has_ownership_ = true |
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.
|
inline |
Construct a UserAllocatedSequence.
[in] | items | Pointer to the beginning of an array of num_items opaque pointers. |
[in] | num_items | Number of opaque pointers in items . |
|
default |
|
delete |
|
delete |
|
delete |
|
delete |
|
inlineoverrideprotectedvirtual |
Implements LoanableCollection.
|
protected |
|
protected |
|
protected |
|
protected |