cprover
cow.h File Reference
#include "invariant.h"
#include "small_shared_ptr.h"
#include <limits>
Include dependency graph for cow.h:

Go to the source code of this file.

Classes

class  copy_on_writet< T >
 A utility class for writing types with copy-on-write behaviour (like irep). More...
 
class  copy_on_write_pointeet< Num >
 A helper class to store use-counts of copy-on-write objects. More...
 

Functions

template<typename Num >
void pointee_increment_use_count (copy_on_write_pointeet< Num > &p)
 The following functions are required by copy_on_writet, and by default pass through to the member functions of copy_on_write_pointeet by the same name. More...
 
template<typename Num >
void pointee_decrement_use_count (copy_on_write_pointeet< Num > &p)
 
template<typename Num >
Num pointee_use_count (const copy_on_write_pointeet< Num > &p)
 
template<typename Num , typename T >
void pointee_set_use_count (copy_on_write_pointeet< Num > &p, T count)
 
template<typename Num >
void pointee_set_shareable (copy_on_write_pointeet< Num > &p, bool u)
 
template<typename Num >
bool pointee_is_shareable (const copy_on_write_pointeet< Num > &p)
 

Function Documentation

◆ pointee_decrement_use_count()

template<typename Num >
void pointee_decrement_use_count ( copy_on_write_pointeet< Num > &  p)
inline

Definition at line 225 of file cow.h.

References copy_on_write_pointeet< Num >::decrement_use_count().

◆ pointee_increment_use_count()

template<typename Num >
void pointee_increment_use_count ( copy_on_write_pointeet< Num > &  p)
inline

The following functions are required by copy_on_writet, and by default pass through to the member functions of copy_on_write_pointeet by the same name.

We provide these as non-members just in case a future client wants to implement a copy-on-write class, which is unable to inherit from copy_on_write_pointeet for some reason. In this case, new overloads for the functions below can be provided, with appropriate behavior for the new type.

Definition at line 219 of file cow.h.

References copy_on_write_pointeet< Num >::increment_use_count().

◆ pointee_is_shareable()

template<typename Num >
bool pointee_is_shareable ( const copy_on_write_pointeet< Num > &  p)
inline

Definition at line 249 of file cow.h.

References copy_on_write_pointeet< Num >::is_shareable().

Referenced by copy_on_writet< T >::copy_on_writet().

◆ pointee_set_shareable()

template<typename Num >
void pointee_set_shareable ( copy_on_write_pointeet< Num > &  p,
bool  u 
)
inline

Definition at line 243 of file cow.h.

References copy_on_write_pointeet< Num >::set_shareable().

Referenced by copy_on_writet< T >::write().

◆ pointee_set_use_count()

template<typename Num , typename T >
void pointee_set_use_count ( copy_on_write_pointeet< Num > &  p,
count 
)
inline

Definition at line 237 of file cow.h.

◆ pointee_use_count()

template<typename Num >
Num pointee_use_count ( const copy_on_write_pointeet< Num > &  p)
inline

Definition at line 231 of file cow.h.

References copy_on_write_pointeet< Num >::use_count().

Referenced by copy_on_writet< T >::write().