PMDK C++ bindings
1.12-git53.g67ba2be4
This is the C++ bindings documentation for PMDK's libpmemobj.
|
This class serves similar purpose to pmem::obj::string, but keeps the data within the same allocation as inline_string itself. More...
#include <libpmemobj++/experimental/inline_string.hpp>
Public Member Functions | |
basic_inline_string (basic_string_view< CharT, Traits > v) | |
Constructs inline string from a string_view. More... | |
basic_inline_string (size_type capacity) | |
Constructs empty inline_string with specified capacity. More... | |
basic_inline_string (const basic_inline_string &rhs) | |
Copy constructor. More... | |
basic_inline_string & | operator= (const basic_inline_string &rhs) |
Copy assignment operator. | |
basic_inline_string & | operator= (basic_string_view< CharT, Traits > rhs) |
Assignment operator from string_view. | |
operator basic_string_view< CharT, Traits > () const | |
Conversion operator to string_view. | |
size_type | size () const noexcept |
size_type | capacity () const noexcept |
pointer | data () |
Returns pointer to the underlying data and if there is an active transaction add entire data to a transaction. More... | |
const_pointer | data () const noexcept |
const_pointer | cdata () const noexcept |
Returns const pointer to the underlying data. More... | |
int | compare (const basic_inline_string &rhs) const noexcept |
Compares this inline_string with other. More... | |
reference | operator[] (size_type p) |
Returns reference to a character at position. More... | |
const_reference | operator[] (size_type p) const noexcept |
Returns reference to a character at position. More... | |
reference | at (size_type p) |
Returns reference to a character at position. More... | |
const_reference | at (size_type p) const |
Returns reference to a character at position. More... | |
slice< pointer > | range (size_type p, size_type count) |
Returns slice and snapshots (if there is an active transaction) requested range. More... | |
basic_inline_string & | assign (basic_string_view< CharT, Traits > rhs) |
Transactionally assign content of basic_string_view. More... | |
Private Member Functions | |
pointer | snapshotted_data (size_t p, size_t n) |
Return pointer to data at position p and if there is an active transaction snapshot elements from p to p + n. | |
This class serves similar purpose to pmem::obj::string, but keeps the data within the same allocation as inline_string itself.
The data is always kept right after the inline_string structure. It means that creating an object of inline_string must be done as follows:
Example:
pmem::obj::experimental::basic_inline_string< CharT, Traits >::basic_inline_string | ( | basic_string_view< CharT, Traits > | v | ) |
Constructs inline string from a string_view.
pool_error | if inline_string doesn't reside on pmem. |
pmem::obj::experimental::basic_inline_string< CharT, Traits >::basic_inline_string | ( | size_type | capacity | ) |
Constructs empty inline_string with specified capacity.
pool_error | if inline_string doesn't reside on pmem. |
pmem::obj::experimental::basic_inline_string< CharT, Traits >::basic_inline_string | ( | const basic_inline_string< CharT, Traits > & | rhs | ) |
Copy constructor.
pool_error | if inline_string doesn't reside on pmem. |
basic_inline_string< CharT, Traits > & pmem::obj::experimental::basic_inline_string< CharT, Traits >::assign | ( | basic_string_view< CharT, Traits > | rhs | ) |
Transactionally assign content of basic_string_view.
std::out_of_range | if rhs is larger than capacity. |
basic_inline_string< CharT, Traits >::reference pmem::obj::experimental::basic_inline_string< CharT, Traits >::at | ( | size_type | p | ) |
Returns reference to a character at position.
[in] | p | with bounds checking and snapshot it if there is an active transaction. |
pmem::transaction_error | when snapshotting failed. |
std::out_of_range | if p is not within the range of the container. |
basic_inline_string< CharT, Traits >::const_reference pmem::obj::experimental::basic_inline_string< CharT, Traits >::at | ( | size_type | p | ) | const |
Returns reference to a character at position.
[in] | p | with bounds checking. |
std::out_of_range | if p is not within the range of the container. |
|
noexcept |
The space actually occupied by inline_string is equal to sizeof(inline_string) + capacity() + sizeof('\0') and cannot be expanded.
|
noexcept |
|
noexcept |
Compares this inline_string with other.
Works in the same way as std::basic_string::compare.
basic_inline_string< CharT, Traits >::pointer pmem::obj::experimental::basic_inline_string< CharT, Traits >::data |
Returns pointer to the underlying data and if there is an active transaction add entire data to a transaction.
pmem::transaction_error | when snapshotting failed. |
|
noexcept |
basic_inline_string< CharT, Traits >::reference pmem::obj::experimental::basic_inline_string< CharT, Traits >::operator[] | ( | size_type | p | ) |
Returns reference to a character at position.
[in] | p | and snapshot it if there is an active transaction. No bounds checking is performed. |
pmem::transaction_error | when snapshotting failed. |
|
noexcept |
Returns reference to a character at position.
[in] | p | No bounds checking is performed. |
slice< typename basic_inline_string< CharT, Traits >::pointer > pmem::obj::experimental::basic_inline_string< CharT, Traits >::range | ( | size_type | start, |
size_type | n | ||
) |
Returns slice and snapshots (if there is an active transaction) requested range.
This method is not specified by STL standards.
[in] | start | start index of requested range. |
[in] | n | number of elements in range. |
std::out_of_range | if any element of the range would be outside of the container. |
pmem::transaction_error | when snapshotting failed. |
|
noexcept |