Halide
Halide::Internal::FunctionPtr Struct Reference

A possibly-weak pointer to a Halide function. More...

#include <FunctionPtr.h>

Public Member Functions

FunctionGroup * group () const
 Get a pointer to the group this Function belongs to. More...
 
FunctionContents * get () const
 Get the opaque FunctionContents object this pointer refers to. More...
 
FunctionContents & operator* () const
 
FunctionContents * operator-> () const
 
void weaken ()
 Convert from a strong reference to a weak reference. More...
 
void strengthen ()
 Convert from a weak reference to a strong reference. More...
 
bool defined () const
 Check if the reference is defined. More...
 
bool same_as (const FunctionPtr &other) const
 Check if two FunctionPtrs refer to the same Function. More...
 
bool operator< (const FunctionPtr &other) const
 Pointer comparison, for using FunctionPtrs as keys in maps and sets. More...
 

Public Attributes

IntrusivePtr< FunctionGroup > strong
 A strong and weak pointer to the group. More...
 
FunctionGroup * weak = nullptr
 
int idx = 0
 The index of the function within the group. More...
 

Detailed Description

A possibly-weak pointer to a Halide function.

Take care to follow the rules mentioned above. Preserves weakness/strength on copy.

Note that Function objects are always strong pointers to Halide functions.

Definition at line 27 of file FunctionPtr.h.

Member Function Documentation

◆ group()

FunctionGroup* Halide::Internal::FunctionPtr::group ( ) const
inline

Get a pointer to the group this Function belongs to.

Definition at line 39 of file FunctionPtr.h.

References Halide::Internal::IntrusivePtr< T >::get(), strong, and weak.

Referenced by same_as(), strengthen(), and weaken().

◆ get()

FunctionContents* Halide::Internal::FunctionPtr::get ( ) const

Get the opaque FunctionContents object this pointer refers to.

Wrap it in a Function to do anything interesting with it.

Referenced by operator*(), operator->(), and operator<().

◆ operator*()

FunctionContents& Halide::Internal::FunctionPtr::operator* ( ) const
inline

Definition at line 48 of file FunctionPtr.h.

References get().

◆ operator->()

FunctionContents* Halide::Internal::FunctionPtr::operator-> ( ) const
inline

Definition at line 52 of file FunctionPtr.h.

References get().

◆ weaken()

void Halide::Internal::FunctionPtr::weaken ( )
inline

Convert from a strong reference to a weak reference.

Does nothing if the pointer is undefined, or if the reference is already weak.

Definition at line 60 of file FunctionPtr.h.

References group(), strong, and weak.

◆ strengthen()

void Halide::Internal::FunctionPtr::strengthen ( )
inline

Convert from a weak reference to a strong reference.

Does nothing if the pointer is undefined, or if the reference is already strong.

Definition at line 68 of file FunctionPtr.h.

References group(), strong, and weak.

◆ defined()

bool Halide::Internal::FunctionPtr::defined ( ) const
inline

Check if the reference is defined.

Definition at line 74 of file FunctionPtr.h.

References Halide::Internal::IntrusivePtr< T >::defined(), strong, and weak.

Referenced by Halide::Internal::Function::Compare::operator()().

◆ same_as()

bool Halide::Internal::FunctionPtr::same_as ( const FunctionPtr other) const
inline

Check if two FunctionPtrs refer to the same Function.

Definition at line 79 of file FunctionPtr.h.

References group(), and idx.

Referenced by Halide::Internal::Function::same_as().

◆ operator<()

bool Halide::Internal::FunctionPtr::operator< ( const FunctionPtr other) const
inline

Pointer comparison, for using FunctionPtrs as keys in maps and sets.

Definition at line 85 of file FunctionPtr.h.

References get().

Member Data Documentation

◆ strong

IntrusivePtr<FunctionGroup> Halide::Internal::FunctionPtr::strong

A strong and weak pointer to the group.

Only one of these should be non-zero.

Definition at line 31 of file FunctionPtr.h.

Referenced by defined(), group(), strengthen(), and weaken().

◆ weak

FunctionGroup* Halide::Internal::FunctionPtr::weak = nullptr

Definition at line 32 of file FunctionPtr.h.

Referenced by defined(), group(), strengthen(), and weaken().

◆ idx

int Halide::Internal::FunctionPtr::idx = 0

The index of the function within the group.

Definition at line 36 of file FunctionPtr.h.

Referenced by same_as().


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