CBMC
|
A helper class to store use-counts of copy-on-write objects. More...
#include <cow.h>
Public Member Functions | |
copy_on_write_pointeet ()=default | |
copy_on_write_pointeet (const copy_on_write_pointeet &) | |
copy_on_write_pointeet & | operator= (const copy_on_write_pointeet &) |
copy_on_write_pointeet (copy_on_write_pointeet &&) | |
copy_on_write_pointeet & | operator= (copy_on_write_pointeet &&) |
void | increment_use_count () |
void | decrement_use_count () |
Num | use_count () const |
void | set_shareable (bool u) |
bool | is_shareable () const |
Protected Member Functions | |
~copy_on_write_pointeet ()=default | |
Private Attributes | |
Num | use_count_ = 0 |
Static Private Attributes | |
static const Num | unshareable |
A special sentry value which will be assigned to use_count_ if a mutable reference to the held object has been created. More... | |
A helper class to store use-counts of copy-on-write objects.
The suggested usage pattern is to have copy-on-write data types inherit from this class, and then to access them through a copy_on_writet.
Num | some numeric type, used to store a reference count |
|
default |
|
inline |
|
inline |
|
protecteddefault |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
staticprivate |
A special sentry value which will be assigned to use_count_ if a mutable reference to the held object has been created.
We check for this sentry value, and use it to decide whether the next copy constructor/assignment call should invoke a deep or shallow copy. Note that this is set to the max value that can be held by Num, but this cannot be done inline.
|
private |