Halide 22.0.0 Halide compiler and libraries

Public Member Functions | Protected Attributes | List of all members
Halide::Internal::IntrusivePtr< T > Struct Template Reference

Intrusive shared pointers have a reference count (a RefCount object) stored in the class itself. More...

`#include <IntrusivePtr.h>`

## Public Member Functions
T * | get () const
| Access the raw pointer in a variety of ways. More...
T & | operator* () const
T * | operator-> () const
| ~IntrusivePtr ()
HALIDE_ALWAYS_INLINE | IntrusivePtr ()=default
HALIDE_ALWAYS_INLINE | IntrusivePtr (T *p)
HALIDE_ALWAYS_INLINE | IntrusivePtr (const IntrusivePtr< T > &other) noexcept
HALIDE_ALWAYS_INLINE | IntrusivePtr (IntrusivePtr< T > &&other) noexcept
IntrusivePtr< T > & | operator= (const IntrusivePtr< T > &other)
IntrusivePtr< T > & | operator= (IntrusivePtr< T > &&other) noexcept
HALIDE_ALWAYS_INLINE bool | defined () const
HALIDE_ALWAYS_INLINE bool | same_as (const IntrusivePtr &other) const
HALIDE_ALWAYS_INLINE bool | operator< (const IntrusivePtr< T > &other) const
HALIDE_ALWAYS_INLINE bool | is_sole_reference () const

## Protected Attributes
T * | ptr = nullptr

## Detailed Description

template<typename T>
struct Halide::Internal::IntrusivePtr< T >

Intrusive shared pointers have a reference count (a RefCount object) stored in the class itself.

This is perhaps more efficient than storing it externally, but more importantly, it means it's possible to recover a reference-counted handle from the raw pointer, and it's impossible to have two different reference counts attached to the same raw object. Seeing as we pass around raw pointers to concrete IRNodes and Expr's interchangeably, this is a useful property.

Definition at line 71 of file IntrusivePtr.h.

## Constructor & Destructor Documentation

## ◆ ~IntrusivePtr()

template<typename T >

Halide::Internal::IntrusivePtr< T >::~IntrusivePtr | ( |  | ) |
| inline

Definition at line 115 of file IntrusivePtr.h.

References Halide::Internal::IntrusivePtr< T >::ptr.

## ◆ IntrusivePtr() [1/4]

template<typename T >

HALIDE_ALWAYS_INLINE Halide::Internal::IntrusivePtr< T >::IntrusivePtr | ( |  | ) |
| default

## ◆ IntrusivePtr() [2/4]

template<typename T >

HALIDE_ALWAYS_INLINE Halide::Internal::IntrusivePtr< T >::IntrusivePtr | ( | T * | p | ) |
| inline

Definition at line 123 of file IntrusivePtr.h.

References Halide::Internal::IntrusivePtr< T >::ptr.

## ◆ IntrusivePtr() [3/4]

template<typename T >

HALIDE_ALWAYS_INLINE Halide::Internal::IntrusivePtr< T >::IntrusivePtr | ( | const IntrusivePtr< T > & | other | ) |
| inline noexcept

Definition at line 129 of file IntrusivePtr.h.

References Halide::Internal::IntrusivePtr< T >::ptr.

## ◆ IntrusivePtr() [4/4]

template<typename T >

HALIDE_ALWAYS_INLINE Halide::Internal::IntrusivePtr< T >::IntrusivePtr | ( | IntrusivePtr< T > && | other | ) |
| inline noexcept

Definition at line 135 of file IntrusivePtr.h.

## Member Function Documentation

## ◆ get()

template<typename T >

T * Halide::Internal::IntrusivePtr< T >::get | ( |  | ) | const
| inline

Access the raw pointer in a variety of ways.

Note that a "const IntrusivePtr<T>" is not the same thing as an IntrusivePtr<const T>. So the methods that return the ptr are const, despite not adding an extra const to T.

Definition at line 102 of file IntrusivePtr.h.

References Halide::Internal::IntrusivePtr< T >::ptr.

Referenced by Halide::Internal::equal(), Halide::Internal::graph_equal(), Halide::Internal::graph_less_than(), Halide::Internal::FunctionPtr::group(), Halide::Internal::less_than(), and Halide::Buffer< T, Dims >::same_as().

## ◆ operator*()

template<typename T >

T & Halide::Internal::IntrusivePtr< T >::operator* | ( |  | ) | const
| inline

Definition at line 106 of file IntrusivePtr.h.

References Halide::Internal::IntrusivePtr< T >::ptr.

## ◆ operator->()

template<typename T >

T * Halide::Internal::IntrusivePtr< T >::operator-> | ( |  | ) | const
| inline

Definition at line 110 of file IntrusivePtr.h.

References Halide::Internal::IntrusivePtr< T >::ptr.

## ◆ operator=() [1/2]

template<typename T >

IntrusivePtr< T > & Halide::Internal::IntrusivePtr< T >::operator= | ( | const IntrusivePtr< T > & | other | ) |
| inline

Definition at line 141 of file IntrusivePtr.h.

References Halide::Internal::IntrusivePtr< T >::ptr.

## ◆ operator=() [2/2]

template<typename T >

IntrusivePtr< T > & Halide::Internal::IntrusivePtr< T >::operator= | ( | IntrusivePtr< T > && | other | ) |
| inline noexcept

Definition at line 157 of file IntrusivePtr.h.

References Halide::Internal::IntrusivePtr< T >::ptr.

## ◆ defined()

template<typename T >

HALIDE_ALWAYS_INLINE bool Halide::Internal::IntrusivePtr< T >::defined | ( |  | ) | const
| inline

Definition at line 164 of file IntrusivePtr.h.

References Halide::Internal::IntrusivePtr< T >::ptr.

Referenced by Halide::Buffer< T, Dims >::defined(), Halide::Internal::FunctionPtr::defined(), Halide::Internal::ReductionDomain::defined(), Halide::Internal::Cost::defined(), Halide::Internal::equal(), Halide::Internal::graph_equal(), Halide::Internal::graph_less_than(), Halide::Internal::Interval::Interval(), Halide::Internal::less_than(), Halide::Internal::ReductionDomain::Compare::operator()(), Halide::Internal::GeneratorInput_Arithmetic< T >::set_def_min_max(), Halide::Param< T >::set_max_value(), and Halide::Param< T >::set_min_value().

## ◆ same_as()

template<typename T >

HALIDE_ALWAYS_INLINE bool Halide::Internal::IntrusivePtr< T >::same_as | ( | const IntrusivePtr< T > & | other | ) | const
| inline

Definition at line 171 of file IntrusivePtr.h.

References Halide::Internal::IntrusivePtr< T >::ptr.

Referenced by Halide::Internal::mutate_region(), Halide::Internal::Definition::same_as(), and Halide::Internal::ReductionDomain::same_as().

## ◆ operator<()

template<typename T >

HALIDE_ALWAYS_INLINE bool Halide::Internal::IntrusivePtr< T >::operator< | ( | const IntrusivePtr< T > & | other | ) | const
| inline

Definition at line 176 of file IntrusivePtr.h.

References Halide::Internal::IntrusivePtr< T >::ptr.

## ◆ is_sole_reference()

template<typename T >

HALIDE_ALWAYS_INLINE bool Halide::Internal::IntrusivePtr< T >::is_sole_reference | ( |  | ) | const
| inline

Definition at line 181 of file IntrusivePtr.h.

References Halide::Internal::RefCount::atomic_get(), Halide::Internal::IntrusivePtr< T >::ptr, and Halide::Internal::ref_count().

## Member Data Documentation

## ◆ ptr

template<typename T >

T* Halide::Internal::IntrusivePtr< T >::ptr = nullptr
| protected

Definition at line 94 of file IntrusivePtr.h.

Referenced by Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::IntrusivePtr< T >::get(), Halide::Internal::IntrusivePtr< T >::IntrusivePtr(), Halide::Internal::IntrusivePtr< T >::is_sole_reference(), Halide::Internal::Stmt::Compare::operator()(), Halide::Internal::IntrusivePtr< T >::operator*(), Halide::Internal::IntrusivePtr< T >::operator->(), Halide::Internal::IntrusivePtr< T >::operator<(), Halide::Internal::IntrusivePtr< T >::operator=(), Halide::Internal::IntrusivePtr< T >::same_as(), and Halide::Internal::IntrusivePtr< T >::~IntrusivePtr().

The documentation for this struct was generated from the following file:

- src/IntrusivePtr.h