PMDK C++ bindings
1.6.1
This is the C++ bindings documentation for PMDK's libpmemobj.
|
pmem::obj::experimental::string - EXPERIMENTAL persistent container with std::basic_string compatible interface. More...
#include <libpmemobj++/experimental/basic_string.hpp>
Public Member Functions | |
basic_string () | |
Default constructor. More... | |
basic_string (size_type count, CharT ch) | |
Construct the container with count copies of elements with value ch. More... | |
basic_string (const basic_string &other, size_type pos, size_type count=npos) | |
Construct the string with a substring [pos, min(pos+count, other.size()) of other. More... | |
basic_string (const CharT *s, size_type count) | |
Construct the string with the first count elements of C-style string s. More... | |
basic_string (const CharT *s) | |
Construct the string with the contents of s. More... | |
template<typename InputIt , typename Enable = typename std::enable_if< pmem::detail::is_input_iterator<InputIt>::value>::type> | |
basic_string (InputIt first, InputIt last) | |
Construct the string with the contents of the range [first, last). More... | |
basic_string (const basic_string &other) | |
Copy constructor. More... | |
basic_string (basic_string &&other) | |
Move constructor. More... | |
basic_string (std::initializer_list< CharT > ilist) | |
Construct the container with the contents of the initializer list init. More... | |
~basic_string () | |
Destructor. More... | |
basic_string & | operator= (const basic_string &other) |
Copy assignment operator. More... | |
basic_string & | operator= (basic_string &&other) |
Move assignment operator. More... | |
basic_string & | operator= (const CharT *s) |
Replace the contents with copy of C-style string s transactionally. More... | |
basic_string & | operator= (CharT ch) |
Replace the contents with character ch transactionally. More... | |
basic_string & | operator= (std::initializer_list< CharT > ilist) |
Replace the contents with those of the initializer list ilist transactionally. More... | |
basic_string & | assign (size_type count, CharT ch) |
Replace the contents with count copies of character ch transactionally. More... | |
basic_string & | assign (const basic_string &other) |
Replace the string with the copy of the contents of other transactionally. More... | |
basic_string & | assign (const basic_string &other, size_type pos, size_type count=npos) |
Replace the contents with a substring [pos, std::min(pos+count, other.size()) of other transactionally. More... | |
basic_string & | assign (const CharT *s, size_type count) |
Replace the contents with the first count elements of C-style string s transactionally. More... | |
basic_string & | assign (const CharT *s) |
Replace the contents with copy of C-style string s transactionally. More... | |
template<typename InputIt , typename Enable = typename pmem::detail::is_input_iterator< InputIt>::type> | |
basic_string & | assign (InputIt first, InputIt last) |
Replace the contents with copies of elements in the range [first, last) transactionally. More... | |
basic_string & | assign (basic_string &&other) |
Replace the string with the contents of other using move semantics transactionally. More... | |
basic_string & | assign (std::initializer_list< CharT > ilist) |
Replaces the contents with those of the initializer list ilist transactionally. More... | |
iterator | begin () |
Return an iterator to the beginning. More... | |
const_iterator | begin () const noexcept |
Return const iterator to the beginning. More... | |
const_iterator | cbegin () const noexcept |
Return const iterator to the beginning. More... | |
iterator | end () |
Return an iterator to past the end. More... | |
const_iterator | end () const noexcept |
Return const iterator to past the end. More... | |
const_iterator | cend () const noexcept |
Return const iterator to past the end. More... | |
reverse_iterator | rbegin () |
Return a reverse iterator to the beginning. More... | |
const_reverse_iterator | rbegin () const noexcept |
Return a const reverse iterator to the beginning. More... | |
const_reverse_iterator | crbegin () const noexcept |
Return a const reverse iterator to the beginning. More... | |
reverse_iterator | rend () |
Return a reverse iterator to the end. More... | |
const_reverse_iterator | rend () const noexcept |
Return a const reverse iterator to the end. More... | |
const_reverse_iterator | crend () const noexcept |
Return a const reverse iterator to the end. More... | |
reference | at (size_type n) |
Access element at specific index with bounds checking and snapshot it if there is an active transaction. More... | |
const_reference | at (size_type n) const |
Access element at specific index with bounds checking. More... | |
const_reference | const_at (size_type n) const |
Access element at specific index with bounds checking. More... | |
reference | operator[] (size_type n) |
Access element at specific index and snapshot it if there is an active transaction. More... | |
const_reference | operator[] (size_type n) const |
Access element at specific index. More... | |
CharT & | front () |
Access first element and snapshot it if there is an active transaction. More... | |
const CharT & | front () const |
Access first element. More... | |
const CharT & | cfront () const |
Access first element. More... | |
CharT & | back () |
Access last element and snapshot it if there is an active transaction. More... | |
const CharT & | back () const |
Access last element. More... | |
const CharT & | cback () const |
Access last element. More... | |
size_type | size () const noexcept |
CharT * | data () |
int | compare (size_type pos, size_type count1, const CharT *s, size_type count2) const |
Compares [pos, pos + count1) substring of this to [s, s + count2) substring of s. More... | |
int | compare (const basic_string &other) const |
Compares this string to other. More... | |
int | compare (size_type pos, size_type count, const basic_string &other) const |
Compares [pos, pos + count) substring of this to other. More... | |
int | compare (size_type pos1, size_type count1, const basic_string &other, size_type pos2, size_type count2=npos) const |
Compares [pos1, pos1 + count1) substring of this to [pos2, pos2 + count2) substring of other. More... | |
int | compare (const CharT *s) const |
Compares this string to s. More... | |
int | compare (size_type pos, size_type count, const CharT *s) const |
Compares [pos, pos + count) substring of this to s. More... | |
const CharT * | cdata () const noexcept |
const CharT * | data () const noexcept |
const CharT * | c_str () const noexcept |
size_type | length () const noexcept |
size_type | max_size () const noexcept |
size_type | capacity () const noexcept |
bool | empty () const noexcept |
Private Member Functions | |
template<typename InputIt , typename Enable = typename std::enable_if< pmem::detail::is_input_iterator<InputIt>::value>::type> | |
size_type | get_size (InputIt first, InputIt last) const |
Overload of generic get_size method used to calculate size based on provided parameters. More... | |
size_type | get_size (size_type count, value_type ch) const |
Overload of generic get_size method used to calculate size based on provided parameters. More... | |
size_type | get_size (const basic_string &other) const |
Overload of generic get_size method used to calculate size based on provided parameters. More... | |
template<typename... Args> | |
pointer | replace (Args &&... args) |
Generic function which replaces current content based on provided parameters. More... | |
template<typename... Args> | |
pointer | initialize (Args &&... args) |
Generic function which initializes memory based on provided parameters - forwards parameters to initialize function of either data_large or data_sso. More... | |
template<typename InputIt , typename Enable = typename std::enable_if< pmem::detail::is_input_iterator<InputIt>::value>::type> | |
pointer | assign_sso_data (InputIt first, InputIt last) |
Initialize sso data. More... | |
pointer | assign_sso_data (size_type count, value_type ch) |
Initialize sso data. More... | |
pointer | assign_sso_data (basic_string &&other) |
Initialize sso data. More... | |
template<typename InputIt , typename Enable = typename std::enable_if< pmem::detail::is_input_iterator<InputIt>::value>::type> | |
pointer | assign_large_data (InputIt first, InputIt last) |
Initialize data_large - call constructor of data_large. More... | |
pointer | assign_large_data (size_type count, value_type ch) |
Initialize data_large - call constructor of data_large. More... | |
pointer | assign_large_data (basic_string &&other) |
Initialize data_large - call constructor of data_large. More... | |
pool_base | get_pool () const |
Return pool_base instance and assert that object is on pmem. | |
void | check_pmem () const |
void | check_tx_stage_work () const |
void | check_pmem_tx () const |
Private Attributes | |
union { | |
}; | |
This union holds sso data inside of an array and non sso data inside a vector. More... | |
pmem::obj::experimental::string - EXPERIMENTAL persistent container with std::basic_string compatible interface.
The implementation is NOT complete.
|
inline |
Default constructor.
Construct an empty container.
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_error | if constructor wasn't called in transaction. |
|
inline |
Construct the container with count copies of elements with value ch.
[in] | count | number of elements to construct. |
[in] | ch | value of all constructed elements. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
pmem::transaction_error | if constructor wasn't called in transaction. |
|
inline |
Construct the string with a substring [pos, min(pos+count, other.size()) of other.
[in] | other | string from which substring will be copied. |
[in] | pos | start position of substring in other. |
[in] | count | length of substring. |
std::out_of_range | is pos > other.size() |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
pmem::transaction_error | if constructor wasn't called in transaction. |
|
inline |
Construct the string with the first count elements of C-style string s.
[in] | s | pointer to source string. |
[in] | count | length of the resulting string. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
pmem::transaction_error | if constructor wasn't called in transaction. |
|
inline |
Construct the string with the contents of s.
[in] | s | pointer to source string. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
pmem::transaction_error | if constructor wasn't called in transaction. |
|
inline |
Construct the string with the contents of the range [first, last).
This constructor only participates in overload resolution if InputIt satisfies InputIterator.
[in] | first | iterator to beginning of the range. |
[in] | last | iterator to end of the range. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
pmem::transaction_error | if constructor wasn't called in transaction. |
|
inline |
Copy constructor.
Construct the string with the copy of the contents of other.
[in] | other | reference to the string to be copied. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
pmem::transaction_error | if constructor wasn't called in transaction. |
|
inline |
Move constructor.
Construct the string with the contents of other using move semantics.
[in] | other | rvalue reference to the string to be moved from. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
pmem::transaction_error | if constructor wasn't called in transaction. |
|
inline |
Construct the container with the contents of the initializer list init.
[in] | ilist | initializer list with content to be constructed. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
pmem::transaction_error | if constructor wasn't called in transaction. |
|
inline |
Destructor.
XXX: implement free_data()
|
inline |
Replace the string with the contents of other using move semantics transactionally.
Other is left in valid state with size equal to 0.
[in] | other | rvalue reference to the string to be moved from. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inline |
Replace the string with the copy of the contents of other transactionally.
[in] | other | reference to the string to be copied. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inline |
Replace the contents with a substring [pos, std::min(pos+count, other.size()) of other transactionally.
[in] | other | string from which substring will be copied. |
[in] | pos | start position of substring in other. |
[in] | count | length of substring. |
std::out_of_range | is pos > other.size() |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inline |
Replace the contents with copy of C-style string s transactionally.
[in] | s | pointer to source string. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inline |
Replace the contents with the first count elements of C-style string s transactionally.
[in] | s | pointer to source string. |
[in] | count | length of the string. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inline |
Replace the contents with copies of elements in the range [first, last) transactionally.
This function participates in overload resolution only if InputIt satisfies InputIterator.
[in] | first | iterator to beginning of the range. |
[in] | last | iterator to end of the range. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inline |
Replace the contents with count copies of character ch transactionally.
[in] | count | number of characters. |
[in] | ch | character. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inline |
Replaces the contents with those of the initializer list ilist transactionally.
[in] | ilist | initializer_list of characters. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inlineprivate |
Initialize data_large - call constructor of data_large.
Overload for rvalue reference of basic_string.
|
inlineprivate |
Initialize data_large - call constructor of data_large.
Overload for pair of iterators.
|
inlineprivate |
Initialize data_large - call constructor of data_large.
Overload for (count, value).
|
inlineprivate |
Initialize sso data.
Overload for rvalue reference of basic_string.
|
inlineprivate |
Initialize sso data.
Overload for pair of iterators
|
inlineprivate |
Initialize sso data.
Overload for (count, value).
|
inline |
Access element at specific index with bounds checking and snapshot it if there is an active transaction.
[in] | n | index number. |
std::out_of_range | if n is not within the range of the container. |
pmem::transaction_error | when adding the object to the transaction failed. |
|
inline |
Access element at specific index with bounds checking.
[in] | n | index number. |
std::out_of_range | if n is not within the range of the container. |
|
inline |
Access last element and snapshot it if there is an active transaction.
pmem::transaction_error | when adding the object to the transaction failed. |
|
inline |
Access last element.
|
inline |
Return an iterator to the beginning.
|
inlinenoexcept |
Return const iterator to the beginning.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
Return const iterator to the beginning.
|
inlinenoexcept |
|
inlinenoexcept |
Return const iterator to past the end.
|
inline |
|
inlineprivate |
pmem::pool_error | if an object is not in persistent memory. |
|
inlineprivate |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_error | if called outside of a transaction. |
|
inlineprivate |
pmem::transaction_error | if called outside of a transaction. |
|
inline |
Compares this string to other.
[in] | other | string to compare to. |
|
inline |
Compares this string to s.
[in] | s | C-style string to compare to. |
|
inline |
Compares [pos, pos + count) substring of this to other.
If count > size() - pos, substring is equal to [pos, size()).
[in] | pos | beginning of the substring. |
[in] | count | length of the substring. |
[in] | other | string to compare to. |
std::out_of_range | is pos > size() |
|
inline |
Compares [pos, pos + count) substring of this to s.
If count > size() - pos, substring is equal to [pos, size()).
[in] | pos | beginning of the substring. |
[in] | count | length of the substring. |
[in] | s | C-style string to compare to. |
std::out_of_range | is pos > size() |
|
inline |
Compares [pos, pos + count1) substring of this to [s, s + count2) substring of s.
If count > size() - pos, substring is equal to [pos, size()).
[in] | pos | beginning of substring of this. |
[in] | count1 | length of substring of this. |
[in] | s | C-style string to compare to. |
[in] | count2 | length of substring of s. |
std::out_of_range | is pos > size() |
|
inline |
Compares [pos1, pos1 + count1) substring of this to [pos2, pos2 + count2) substring of other.
If count1 > size() - pos, substring is equal to [pos1, size()).
[in] | pos1 | beginning of substring of this. |
[in] | count1 | length of substring of this. |
[in] | other | string to compare to. |
[in] | pos2 | beginning of substring of other. |
[in] | count2 | length of substring of other. |
std::out_of_range | is pos1 > size() or pos2 > other.size() |
|
inline |
Access element at specific index with bounds checking.
In contradiction to at(), const_at() will return const_reference not depending on the const-qualification of the object it is called on. std::basic_string doesn't provide const_at() method.
[in] | n | index number. |
std::out_of_range | if n is not within the range of the container. |
|
inlinenoexcept |
Return a const reverse iterator to the beginning.
|
inlinenoexcept |
Return a const reverse iterator to the end.
|
inline |
transaction_error | when adding data to the transaction failed. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Return an iterator to past the end.
|
inlinenoexcept |
Return const iterator to past the end.
|
inline |
Access first element and snapshot it if there is an active transaction.
pmem::transaction_error | when adding the object to the transaction failed. |
|
inline |
Access first element.
|
inlineprivate |
Overload of generic get_size method used to calculate size based on provided parameters.
Return size of other basic_string
|
inlineprivate |
Overload of generic get_size method used to calculate size based on provided parameters.
Return std::distance(first, last) for pair of iterators.
|
inlineprivate |
Overload of generic get_size method used to calculate size based on provided parameters.
Return count for (count, value)
|
inlineprivate |
Generic function which initializes memory based on provided parameters - forwards parameters to initialize function of either data_large or data_sso.
Allowed parameters are:
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Move assignment operator.
Replace the string with the contents of other using move semantics transactionally.
[in] | other | rvalue reference to the string to be moved from. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inline |
Replace the contents with character ch transactionally.
[in] | ch | character. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inline |
Copy assignment operator.
Replace the string with contents of other transactionally.
[in] | other | reference to the string to be copied. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inline |
Replace the contents with copy of C-style string s transactionally.
[in] | s | pointer to source string. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inline |
Replace the contents with those of the initializer list ilist transactionally.
[in] | ilist | initializer_list of characters. |
pmem::transaction_alloc_error | when allocating memory for underlying storage in transaction failed. |
|
inline |
Access element at specific index and snapshot it if there is an active transaction.
No bounds checking is performed.
[in] | n | index number. |
pmem::transaction_error | when adding the object to the transaction failed. |
|
inline |
Access element at specific index.
No bounds checking is performed.
[in] | n | index number. |
|
inline |
Return a reverse iterator to the beginning.
|
inlinenoexcept |
Return a const reverse iterator to the beginning.
|
inline |
Return a reverse iterator to the end.
|
inlinenoexcept |
Return a const reverse iterator to the end.
|
inlineprivate |
Generic function which replaces current content based on provided parameters.
Allowed parameters are:
|
inlinenoexcept |
union { ... } |
This union holds sso data inside of an array and non sso data inside a vector.
If vector is used, it must be manually created and destroyed.