|
1 | 1 | # SPDX-License-Identifier: BSD-3-Clause |
2 | | -# Copyright 2021, Intel Corporation |
| 2 | +# Copyright 2021-2022, Intel Corporation |
3 | 3 |
|
4 | 4 | /** @defgroup containers Containers |
5 | 5 | * Custom (but STL-like) containers for persistent memory. |
|
135 | 135 | * in libpmemobj-cpp it's transparent for user, so please focus on relationships between stages. |
136 | 136 | * Look at the diagram below: |
137 | 137 | * |
138 | | - *  |
| 138 | + *  |
139 | 139 | * |
140 | 140 | * To be more familiar with functions used in diagram read e.g. **pmemobj_tx_begin**(3) manpage |
141 | 141 | * (C API for [libpmemobj](https://pmem.io/pmdk/libpmemobj/), link below in *Additional resources*). |
|
208 | 208 | */ |
209 | 209 |
|
210 | 210 | /** @defgroup primitives Primitives |
211 | | - * Basic classes that provides PMEM-aware pointers and pool handlers. |
| 211 | + * Basic classes that provide PMEM-aware pointers and pool handlers. |
212 | 212 | * |
213 | 213 | * ## Pointers |
214 | 214 | * There are few types to handle data on PMEM. |
215 | 215 | * - @ref pmem::obj::persistent_ptr<T> - implements a smart pointer. |
216 | 216 | * It encapsulates the [PMEMoid](https://pmem.io/2015/06/11/type-safety-macros.html) fat |
217 | 217 | * pointer and provides member access, dereference and array access operators. |
218 | 218 | * - @ref pmem::obj::experimental::self_relative_ptr<T> - implements a smart ptr. |
219 | | - * It encapsulates the self offsetted pointer and provides member access, dereference and array access operators. |
| 219 | + * It encapsulates the self-offsetted pointer and provides member access, dereference and array access operators. |
220 | 220 | * self_relative_ptr in comparison to persistent_ptr is: |
221 | | - * - smaller size (8B vs 16B) |
222 | | - * - can be used with atomic operations |
223 | | - * - faster dereference (important in loop), also allows vectorization |
224 | | - * - if stored in a persistent memory pool, it can only points to elements within the same pool |
| 221 | + * - smaller in size (8B vs 16B), |
| 222 | + * - can be used with atomic operations, |
| 223 | + * - dereferenced faster (it's important, e.g., in loops), |
| 224 | + * - allows vectorization, |
| 225 | + * - if stored in a persistent memory pool, it can only points to elements within the same pool. |
225 | 226 | * - @ref pmem::obj::p<T> - template class that can be used for all variables (except persistent pointers), |
226 | 227 | * which are used in @ref transactions. |
227 | 228 | * This class is not designed to be used with compound types. For that see the @ref pmem::obj::persistent_ptr. |
|
231 | 232 | * exactly once per instance of the application. This class has 8 bytes of storage overhead. |
232 | 233 | * |
233 | 234 | * ## Pool handles |
234 | | - * Pool class provides basic operations on pmemobj [pools](https://pmem.io/2016/05/10/cpp-05.html). C++ API for pools should |
235 | | - * not be mixed with C API. For example explicitly calling pmemobj_set_user_data(pop) |
| 235 | + * Pool class provides basic operations on pmemobj [pools](https://pmem.io/2016/05/10/cpp-05.html). |
| 236 | + * C++ API for pools should not be mixed with C API. For example explicitly calling `pmemobj_set_user_data(pop)` |
236 | 237 | * on pool which is handled by C++ pool object is undefined behaviour. |
237 | 238 | * |
238 | 239 | * There are few pool handlers: |
|
249 | 250 | * Possible exceptions that could be thrown by the libpmemobj++. |
250 | 251 | * |
251 | 252 | * In runtime, some operations may fail, then all you need is to catch the exception. |
252 | | - * Every pmem exception has **std::runtime_error** in its inheritance tree |
253 | | - * and contains proper message with an error description. |
254 | | - * All exceptions can be caught using just **std::runtime_error**. |
| 253 | + * Every pmem exception has `std::runtime_error` in its inheritance tree, which means |
| 254 | + * that all exceptions can be caught using just this type. Each exception contains |
| 255 | + * proper message with an error description. |
| 256 | + * |
255 | 257 | * Look at the list on this page to explore all exceptions with their descriptions. |
256 | 258 | * |
257 | 259 | * Transaction handles uncaught exceptions thrown inside its scope, then aborts |
|
262 | 264 | * Let's consider following example: |
263 | 265 | * @snippet examples/mpsc_queue/mpsc_queue.cpp mpsc_main |
264 | 266 | * |
265 | | - * There are plenty of try-catch blocks placed to handle possible errors that can happen in some conditions. |
266 | | - * E.g. @ref pmem::obj::pool<T>::open can lead to @ref pmem::pool_error. |
267 | | - * Next exception, **std::exception**, is placed to handle possible errors during allocation, |
268 | | - * coming from @ref pmem::obj::make_persistent. Worth being careful using every new function |
269 | | - * because some of exceptions are not obvious, e.g., pmem::obj::pool<T>::close |
270 | | - * at the end of the code which may throw **std::logic_error**. |
| 267 | + * There are plenty of try-catch blocks placed to handle possible errors that can occur in some |
| 268 | + * conditions. E.g. @ref pmem::obj::pool<T>::open can lead to @ref pmem::pool_error. |
| 269 | + * The next exception, **std::exception**, is placed to handle possible errors during allocation, |
| 270 | + * coming from @ref pmem::obj::make_persistent. Worth being careful using any new function |
| 271 | + * because some exceptions are not obvious, e.g., pmem::obj::pool<T>::close |
| 272 | + * at the end of the code, which may throw **std::logic_error**. |
271 | 273 | * |
272 | | - * You should check every function you will use in context of possible |
273 | | - * exceptions and then handle them to avoid crash. |
| 274 | + * You should check every function you will use in the context of possible |
| 275 | + * exceptions and then handle them to avoid a crash. |
274 | 276 | */ |
0 commit comments