A single os_retain_address instance can track modifications made to a pointer. When the client releases address space, it iterates through all os_retain_address instances and dereferences their ptr_to_ptr to determine which address ranges should be retained. There are no error states: if ptr_to_ptr is NULL, or if it points to a pointer that does not point into persistent space, no error is signaled, and no address range is retained by the os_retain_address instance. Since address space is reserved in 64 KB units, the amount of address space reserved by a single os_retain_address is some multiple of 64 KB- usually, for objects 64 KB or smaller, it is just 64 KB.
Like os_pvars, os_retain_address inherits from basic_undo, and so all instances must be on the stack (correspond to automatic C++ variables). When an instance of os_retain_address is deleted, it is removed from consideration by the client.
More than one instance of os_retain_address can refer to the same persistent address. As long as at least one instance of os_retain_address refers to a persistent address when the client releases addresses, that persistent address is retained.
The retaining function member returns the persistent address pointed to by the ptr_to_ptr data member, or NULL if the ptr_to_ptr is NULL. Calling the release function member is equivalent to calling set_retain(NULL).
os_retain_address::os_retain_address(void **ptr_to_ptr);
void *os_retain_address::retaining() const;
void os_retain_address::release();
void os_retain_address::set_retain(void **ptr_to_ptr);The os_retain_address::set_retain() function member can be used to change the pointer to a transient pointer.
.
Updated: 03/31/98 17:25:09