|
ADOL-C: Automatic Differentiation in C/C++ 2.7.3
|
RAII type for a location in the current tape's value store. More...
#include <adtb_types.h>
Public Types | |
| enum | ownership_mode { INVALID = 0 , OWNING = 1 , BORROWED = 2 } |
Public Member Functions | |
| ~tape_location () | |
| Release an owned active-value location; leave borrowed locations alone. | |
| tape_location () | |
Constructs a tape_location with the next available location on the tape. | |
| tape_location (size_t loc, ownership_mode mode=OWNING) | |
| Constructs a tape location from an existing location. | |
| tape_location (const tape_location &)=delete | |
| Deleted copy constructor. | |
| tape_location & | operator= (const tape_location &)=delete |
| Deleted copy assignment operator. | |
| tape_location (tape_location &&other) noexcept | |
| Transfer the location and its ownership state; invalidate the source. | |
| tape_location & | operator= (tape_location &&other) noexcept |
| Release the old owned location and transfer the source state. | |
| size_t | loc () const |
| Retrieves the tape location. | |
| bool | owns_location () const |
| Returns whether this location owns tape memory. | |
| bool | is_valid () const |
| size_t | release () |
| Return the location index and invalidate this token. | |
RAII type for a location in the current tape's value store.
adouble and pdouble use this helper to allocate, transfer, borrow, and release locations. It stores only the location index, so construction, destruction, and use must occur while the corresponding ValueTape is current. User code should not call next_loc() or free_loc() directly.
| T | Either adouble or pdouble. |
| enum tape_location::ownership_mode |
State model:
This separation is required to prevent "use-after-release" while still allowing borrowed bridge objects from the C interface to participate in operations.
| Enumerator | |
|---|---|
| INVALID | |
| OWNING | |
| BORROWED | |
|
inline |
Release an owned active-value location; leave borrowed locations alone.
|
inline |
Constructs a tape_location with the next available location on the tape.
|
inlineexplicit |
Constructs a tape location from an existing location.
| loc | Existing tape location. |
| mode | Ownership mode (owning or borrowed). |
|
delete |
Deleted copy constructor.
|
inlinenoexcept |
Transfer the location and its ownership state; invalidate the source.
| other | The tape_location to move from. |
|
inline |
|
inline |
Retrieves the tape location.
|
delete |
Deleted copy assignment operator.
|
inlinenoexcept |
Release the old owned location and transfer the source state.
| other | The tape_location to move from. |
tape_location.
|
inline |
Returns whether this location owns tape memory.
|
inline |
Return the location index and invalidate this token.
The location remains allocated. The caller is responsible for its lifetime.