PMDK C++ bindings  1.2.0
This is the C++ bindings documentation for PMDK's libpmemobj.
Public Member Functions | Private Member Functions | List of all members
pmem::obj::experimental::array< T, N > Struct Template Reference

pmem::obj::experimental::array - EXPERIMENTAL persistent container with std::array compatible interface. More...

#include <libpmemobj++/experimental/array.hpp>

Public Member Functions

 array ()=default
 Defaulted constructor.
 
 array (const array &)=default
 Defaulted copy constructor.
 
 array (array &&)=default
 Defaulted move constructor.
 
arrayoperator= (const array &other)
 Copy assignment operator - adds 'this' to a transaction. More...
 
arrayoperator= (array &&other)
 Move assignment operator - adds 'this' to a transaction. More...
 
reference at (size_type n)
 Access element at specific index and add it to a transaction. More...
 
const_reference at (size_type n) const
 Access element at specific index. More...
 
reference operator[] (size_type n)
 Access element at specific index and add it to a transaction. More...
 
const_reference operator[] (size_type n) const
 Access element at specific index. More...
 
T * data ()
 Returns raw pointer to the underlying data and adds entire array to a transaction. More...
 
const T * data () const noexcept
 Returns const raw pointer to the underlying data.
 
iterator begin ()
 Returns an iterator to the beginning. More...
 
iterator end ()
 Returns an iterator to the end. More...
 
const_iterator begin () const noexcept
 Returns const iterator to the beginning.
 
const_iterator cbegin () const noexcept
 Returns const iterator to the beginning.
 
const_iterator end () const noexcept
 Returns a const iterator to the end.
 
const_iterator cend () const noexcept
 Returns a const iterator to the end.
 
reverse_iterator rbegin ()
 Returns a reverse iterator to the beginning. More...
 
reverse_iterator rend ()
 Returns a reverse iterator to the end. More...
 
const_reverse_iterator rbegin () const noexcept
 Returns a const reverse iterator to the beginning.
 
const_reverse_iterator crbegin () const noexcept
 Returns a const reverse iterator to the beginning.
 
const_reverse_iterator rend () const noexcept
 Returns a const reverse iterator to the end.
 
const_reverse_iterator crend () const noexcept
 Returns a const reverse iterator to the beginning.
 
reference front ()
 Access the first element and add this element to a transaction. More...
 
reference back ()
 Access the last element and add this element to a transaction. More...
 
const_reference front () const
 Access the first element.
 
const_reference back () const
 Access the last element.
 
slice< range_snapshotting_iterator< T > > range (size_type start, size_type n, size_type snapshot_size=std::numeric_limits< size_type >::max())
 Adds requested range to a transaction and returns slice. More...
 
slice< const_iteratorrange (size_type start, size_type n) const
 Returns const slice. More...
 
slice< const_iteratorcrange (size_type start, size_type n) const
 Returns const slice. More...
 
constexpr size_type size () const noexcept
 Returns size of the array.
 
constexpr size_type max_size () const noexcept
 Returns the maximum size of the array.
 
constexpr bool empty () const noexcept
 Checks wheter array is empty.
 
void fill (const_reference value)
 Adds entire array to a transaction and fills array with specified value. More...
 
template<std::size_t Size = N>
std::enable_if< Size !=0 >::type swap (array &other)
 Swaps content with other array's content. More...
 
template<std::size_t Size = N>
std::enable_if< Size==0 >::type swap (array &other)
 Swap for zero-sized array.
 

Private Member Functions

template<std::size_t Size = N>
std::enable_if< Size !=0, T * >::type _get_data ()
 Support for non-zero sized array.
 
template<std::size_t Size = N>
std::enable_if< Size !=0, const T * >::type _get_data () const
 Support for non-zero sized array.
 
template<std::size_t Size = N>
std::enable_if< Size==0, T * >::type _get_data ()
 Support for zero sized array. More...
 
template<std::size_t Size = N>
std::enable_if< Size==0, const T * >::type _get_data () const
 Support for zero sized array.
 

Detailed Description

template<typename T, std::size_t N>
struct pmem::obj::experimental::array< T, N >

pmem::obj::experimental::array - EXPERIMENTAL persistent container with std::array compatible interface.

All methods which allow write access to specific element will add it to an active transaction.

All methods which return non-const pointer to raw data add entire array to a transaction.

When a non-const iterator is returned it adds part of the array to a transaction while traversing.

Member Function Documentation

◆ _get_data()

template<typename T, std::size_t N>
template<std::size_t Size = N>
std::enable_if<Size == 0, T *>::type pmem::obj::experimental::array< T, N >::_get_data ( )
inlineprivate

Support for zero sized array.

Return value is a unique address (address of the array itself);

◆ at() [1/2]

template<typename T, std::size_t N>
reference pmem::obj::experimental::array< T, N >::at ( size_type  n)
inline

Access element at specific index and add it to a transaction.

Exceptions
std::out_of_rangeif index is out of bound.
transaction_errorwhen adding the object to the transaction failed.

◆ at() [2/2]

template<typename T, std::size_t N>
const_reference pmem::obj::experimental::array< T, N >::at ( size_type  n) const
inline

Access element at specific index.

Exceptions
std::out_of_rangeif index is out of bound.

◆ back()

template<typename T, std::size_t N>
reference pmem::obj::experimental::array< T, N >::back ( )
inline

Access the last element and add this element to a transaction.

Exceptions
transaction_errorwhen adding the object to the transaction failed.

◆ begin()

template<typename T, std::size_t N>
iterator pmem::obj::experimental::array< T, N >::begin ( )
inline

Returns an iterator to the beginning.

Exceptions
transaction_errorwhen adding the object to the transaction failed.

◆ crange()

template<typename T, std::size_t N>
slice<const_iterator> pmem::obj::experimental::array< T, N >::crange ( size_type  start,
size_type  n 
) const
inline

Returns const slice.

Parameters
[in]startstart index of requested range.
[in]nnumber of elements in range.
Returns
slice from start to start + n.
Exceptions
std::out_of_rangeif any element of the range would be outside of the array.

◆ data()

template<typename T, std::size_t N>
T* pmem::obj::experimental::array< T, N >::data ( )
inline

Returns raw pointer to the underlying data and adds entire array to a transaction.

Exceptions
transaction_errorwhen adding the object to the transaction failed.

◆ end()

template<typename T, std::size_t N>
iterator pmem::obj::experimental::array< T, N >::end ( )
inline

Returns an iterator to the end.

Exceptions
transaction_errorwhen adding the object to the transaction failed.

◆ fill()

template<typename T, std::size_t N>
void pmem::obj::experimental::array< T, N >::fill ( const_reference  value)
inline

Adds entire array to a transaction and fills array with specified value.

Exceptions
transaction_errorwhen adding the object to the transaction failed.

◆ front()

template<typename T, std::size_t N>
reference pmem::obj::experimental::array< T, N >::front ( )
inline

Access the first element and add this element to a transaction.

Exceptions
transaction_errorwhen adding the object to the transaction failed.

◆ operator=() [1/2]

template<typename T, std::size_t N>
array& pmem::obj::experimental::array< T, N >::operator= ( const array< T, N > &  other)
inline

Copy assignment operator - adds 'this' to a transaction.

Exceptions
transaction_errorwhen adding the object to the transaction failed.

◆ operator=() [2/2]

template<typename T, std::size_t N>
array& pmem::obj::experimental::array< T, N >::operator= ( array< T, N > &&  other)
inline

Move assignment operator - adds 'this' to a transaction.

Exceptions
transaction_errorwhen adding the object to the transaction failed.

◆ operator[]() [1/2]

template<typename T, std::size_t N>
reference pmem::obj::experimental::array< T, N >::operator[] ( size_type  n)
inline

Access element at specific index and add it to a transaction.

No bounds checking is performed.

Exceptions
transaction_errorwhen adding the object to the transaction failed.

◆ operator[]() [2/2]

template<typename T, std::size_t N>
const_reference pmem::obj::experimental::array< T, N >::operator[] ( size_type  n) const
inline

Access element at specific index.

No bounds checking is performed.

◆ range() [1/2]

template<typename T, std::size_t N>
slice<range_snapshotting_iterator<T> > pmem::obj::experimental::array< T, N >::range ( size_type  start,
size_type  n,
size_type  snapshot_size = std::numeric_limits<size_type>::max() 
)
inline

Adds requested range to a transaction and returns slice.

Parameters
[in]startstart index of requested range.
[in]nnumber of elements in range.
[in]snapshot_sizenumber of elements which should be snapshotted in a bulk while traversing this slice If provided value is larger or equal to n, entire range is added to a transaction. If value is equal to 0 no snapshotting happens.
Returns
slice from start to start + n.
Exceptions
std::out_of_rangeif any element of the range would be outside of the array.

◆ range() [2/2]

template<typename T, std::size_t N>
slice<const_iterator> pmem::obj::experimental::array< T, N >::range ( size_type  start,
size_type  n 
) const
inline

Returns const slice.

Parameters
[in]startstart index of requested range.
[in]nnumber of elements in range.
Returns
slice from start to start + n.
Exceptions
std::out_of_rangeif any element of the range would be outside of the array.

◆ rbegin()

template<typename T, std::size_t N>
reverse_iterator pmem::obj::experimental::array< T, N >::rbegin ( )
inline

Returns a reverse iterator to the beginning.

Exceptions
transaction_errorwhen adding the object to the transaction failed.

◆ rend()

template<typename T, std::size_t N>
reverse_iterator pmem::obj::experimental::array< T, N >::rend ( )
inline

Returns a reverse iterator to the end.

Exceptions
transaction_errorwhen adding the object to the transaction failed.

◆ swap()

template<typename T, std::size_t N>
template<std::size_t Size = N>
std::enable_if<Size != 0>::type pmem::obj::experimental::array< T, N >::swap ( array< T, N > &  other)
inline

Swaps content with other array's content.

Adds both arrays to a transaction.

Exceptions
transaction_errorwhen adding the object to the transaction failed.

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