|
8404 | 8404 | \begin{codeblock} |
8405 | 8405 | namespace std::pmr { |
8406 | 8406 | class monotonic_buffer_resource : public memory_resource { |
8407 | | - memory_resource* upstream_rsrc; // \expos |
8408 | | - void* current_buffer; // \expos |
8409 | | - size_t next_buffer_size; // \expos |
| 8407 | + memory_resource* @\exposid{upstream-rsrc}@; // \expos |
| 8408 | + void* @\exposid{current-buffer}@; // \expos |
| 8409 | + size_t @\exposid{next-buffer-size}@; // \expos |
8410 | 8410 |
|
8411 | 8411 | public: |
8412 | 8412 | explicit monotonic_buffer_resource(memory_resource* upstream); |
|
8454 | 8454 |
|
8455 | 8455 | \pnum |
8456 | 8456 | \effects |
8457 | | -Sets \tcode{upstream_rsrc} to \tcode{upstream} and |
8458 | | -\tcode{current_buffer} to \keyword{nullptr}. |
| 8457 | +Sets \exposid{upstream-rsrc} to \tcode{upstream} and |
| 8458 | +\exposid{current-buffer} to \keyword{nullptr}. |
8459 | 8459 | If \tcode{initial_size} is specified, |
8460 | | -sets \tcode{next_buffer_size} to at least \tcode{initial_size}; |
8461 | | -otherwise sets \tcode{next_buffer_size} to an |
8462 | | -\impldef{default \tcode{next_buffer_size} for a \tcode{monotonic_buffer_resource}} size. |
| 8460 | +sets \exposid{next-buffer-size} to at least \tcode{initial_size}; |
| 8461 | +otherwise sets \exposid{next-buffer-size} to an |
| 8462 | +\impldef{default \exposid{next-buffer-size} for a \tcode{monotonic_buffer_resource}} size. |
8463 | 8463 | \end{itemdescr} |
8464 | 8464 |
|
8465 | 8465 | \indexlibraryctor{monotonic_buffer_resource}% |
|
8475 | 8475 |
|
8476 | 8476 | \pnum |
8477 | 8477 | \effects |
8478 | | -Sets \tcode{upstream_rsrc} to \tcode{upstream}, |
8479 | | -\tcode{current_buffer} to \tcode{buffer}, and |
8480 | | -\tcode{next_buffer_size} to \tcode{buffer_size} (but not less than 1), |
8481 | | -then increases \tcode{next_buffer_size} |
| 8478 | +Sets \exposid{upstream-rsrc} to \tcode{upstream}, |
| 8479 | +\exposid{current-buffer} to \tcode{buffer}, and |
| 8480 | +\exposid{next-buffer-size} to \tcode{buffer_size} (but not less than 1), |
| 8481 | +then increases \exposid{next-buffer-size} |
8482 | 8482 | by an \impldef{growth factor for \tcode{monotonic_buffer_resource}} growth factor (which need not be integral). |
8483 | 8483 | \end{itemdescr} |
8484 | 8484 |
|
|
8504 | 8504 | \begin{itemdescr} |
8505 | 8505 | \pnum |
8506 | 8506 | \effects |
8507 | | -Calls \tcode{upstream_rsrc->deallocate()} as necessary |
| 8507 | +Calls \tcode{\exposid{upstream-rsrc}->deallocate()} as necessary |
8508 | 8508 | to release all allocated memory. |
8509 | | -Resets \tcode{current_buffer} and \tcode{next_buffer_size} |
| 8509 | +Resets \exposid{current-buffer} and \exposid{next-buffer-size} |
8510 | 8510 | to their initial values at construction. |
8511 | 8511 |
|
8512 | 8512 | \pnum |
8513 | 8513 | \begin{note} |
8514 | | -The memory is released back to \tcode{upstream_rsrc} |
| 8514 | +The memory is released back to \exposid{upstream-rsrc} |
8515 | 8515 | even if some blocks that were allocated from \tcode{*this} |
8516 | 8516 | have not been deallocated from \tcode{*this}. |
8517 | 8517 | \end{note} |
|
8525 | 8525 | \begin{itemdescr} |
8526 | 8526 | \pnum |
8527 | 8527 | \returns |
8528 | | -The value of \tcode{upstream_rsrc}. |
| 8528 | +The value of \exposid{upstream-rsrc}. |
8529 | 8529 | \end{itemdescr} |
8530 | 8530 |
|
8531 | 8531 | \indexlibrarymember{do_allocate}{monotonic_buffer_resource}% |
|
8536 | 8536 | \begin{itemdescr} |
8537 | 8537 | \pnum |
8538 | 8538 | \effects |
8539 | | -If the unused space in \tcode{current_buffer} |
| 8539 | +If the unused space in \exposid{current-buffer} |
8540 | 8540 | can fit a block with the specified \tcode{bytes} and \tcode{alignment}, |
8541 | | -then allocate the return block from \tcode{current_buffer}; |
8542 | | -otherwise set \tcode{current_buffer} to \tcode{upstream_rsrc->allocate(n, m)}, |
8543 | | -where \tcode{n} is not less than \tcode{max(bytes, next_buffer_size)} and |
| 8541 | +then allocate the return block from \exposid{current-buffer}; |
| 8542 | +otherwise set \exposid{current-buffer} to \tcode{\exposid{upstream-rsrc}->allocate(n, m)}, |
| 8543 | +where \tcode{n} is not less than \tcode{max(bytes, \exposid{next-buffer-size})} and |
8544 | 8544 | \tcode{m} is not less than \tcode{alignment}, |
8545 | | -and increase \tcode{next_buffer_size} |
| 8545 | +and increase \exposid{next-buffer-size} |
8546 | 8546 | by an \impldef{growth factor for \tcode{monotonic_buffer_resource}} growth factor (which need not be integral), |
8547 | | -then allocate the return block from the newly-allocated \tcode{current_buffer}. |
| 8547 | +then allocate the return block from the newly-allocated \exposid{current-buffer}. |
8548 | 8548 |
|
8549 | 8549 | \pnum |
8550 | 8550 | \returns |
|
8555 | 8555 |
|
8556 | 8556 | \pnum |
8557 | 8557 | \throws |
8558 | | -Nothing unless \tcode{upstream_rsrc->allocate()} throws. |
| 8558 | +Nothing unless \tcode{\exposid{upstream-rsrc}->allocate()} throws. |
8559 | 8559 | \end{itemdescr} |
8560 | 8560 |
|
8561 | 8561 | \indexlibrarymember{do_deallocate}{monotonic_buffer_resource}% |
|
0 commit comments