|
ESBMC
Efficient SMT-based Context-Bounded Model Checker
|
Reference counted container for irep2 nodes. More...
#include <irep2.h>
Public Member Functions | |
| constexpr | irep_container () noexcept |
| irep_container (const irep_container &ref) noexcept | |
| irep_container (irep_container &&ref) noexcept | |
| ~irep_container () | |
| irep_container & | operator= (const irep_container &ref) noexcept |
| irep_container & | operator= (irep_container &&ref) noexcept |
| const T & | operator* () const noexcept |
| const T * | operator-> () const noexcept |
| const T * | get () const noexcept |
| T * | get () |
| T & | operator* () |
| T * | operator-> () |
| operator bool () const noexcept | |
| void | reset () noexcept |
| void | detach () |
| void | swap (irep_container &b) noexcept |
| irep_container | simplify () const |
| size_t | crc () const |
Friends | |
| template<class U, class... Args> | |
| irep_container< typename U::base_type > | make_irep (Args &&... args) |
| Allocate a fresh irep2 node and adopt it into an irep_container. | |
| void | swap (irep_container &a, irep_container &b) noexcept |
| bool | operator== (const irep_container &a, const irep_container &b) |
| bool | operator!= (const irep_container &a, const irep_container &b) |
| bool | operator< (const irep_container &a, const irep_container &b) |
| bool | operator<= (const irep_container &a, const irep_container &b) |
| bool | operator>= (const irep_container &a, const irep_container &b) |
| bool | operator> (const irep_container &a, const irep_container &b) |
Reference counted container for irep2 nodes.
Holds a raw T * to an irep2-derived node and manages its intrusive refcount: construction increments, destruction decrements, the pointee is deleted when the count reaches zero. Single allocation per node — no separate control block, no shared_ptr indirection.
The container also implements the historic copy-on-write contract: the only way to obtain a non-const T * / T & is via the non-const get() / operator* / operator->, all of which call detach() first. If the underlying node is shared (refcount > 1), detach() allocates a fresh copy via T::clone() and rebinds the container to that copy; the other holders keep observing the original. This preserves the value semantics of the legacy string-irep irept while letting most subtree copies be cheap.
Threading. See irep2.h's preamble. The refcount is atomic (acq/rel on release/destruction, relaxed on construction copy) but the container is not designed for concurrent mutation: under the single-writer contract there is at most one mutator at a time, while readers may share the same node.
|
inlineconstexprnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenodiscardnoexcept |
|
inlineexplicitnoexcept |
|
inline |
|
inlinenodiscardnoexcept |
|
inline |
|
inlinenodiscardnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
friend |
Allocate a fresh irep2 node and adopt it into an irep_container.
The single canonical construction path for the intrusive refcount scheme. T must derive from an irep2 base (type2t / expr2t) that exposes base_type as its method-side base; the returned container is irep_container<T::base_type> (i.e. type2tc or expr2tc).
Single allocation, no separate control block, exception-safe (if any argument constructor throws, the new hasn't run yet; if the new itself throws, no leak; the only ordering between new succeeding and the container adopting it is straight-line code inside this function).
Callers should prefer this helper over a raw new-into-container so the allocation site stays in one place.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |