Halide
Halide::Internal::ObjectInstanceRegistry Class Reference

#include <ObjectInstanceRegistry.h>

Public Types

enum  Kind {
  Invalid, Generator, GeneratorParam, GeneratorInput,
  GeneratorOutput, FilterParam
}
 

Static Public Member Functions

static void register_instance (void *this_ptr, size_t size, Kind kind, void *subject_ptr, const void *introspection_helper)
 Add an instance to the registry. More...
 
static void unregister_instance (void *this_ptr)
 Remove an instance from the registry. More...
 
static std::vector< void * > instances_in_range (void *start, size_t size, Kind kind)
 Returns the list of subject pointers for objects that have been directly registered within the given range. More...
 

Detailed Description

Definition at line 22 of file ObjectInstanceRegistry.h.

Member Enumeration Documentation

◆ Kind

Enumerator
Invalid 
Generator 
GeneratorParam 
GeneratorInput 
GeneratorOutput 
FilterParam 

Definition at line 24 of file ObjectInstanceRegistry.h.

Member Function Documentation

◆ register_instance()

static void Halide::Internal::ObjectInstanceRegistry::register_instance ( void *  this_ptr,
size_t  size,
Kind  kind,
void *  subject_ptr,
const void *  introspection_helper 
)
static

Add an instance to the registry.

The size may be 0 for Param Kinds, but not for Generator. subject_ptr is the value actually associated with this instance; it is usually (but not necessarily) the same as this_ptr. Assert if this_ptr is already registered.

If 'this' is directly heap allocated (not a member of a heap-allocated object) and you want the introspection subsystem to know about it and its members, set the introspection_helper argument to a pointer to a global variable with the same true type as 'this'. For example:

MyObject *obj = new MyObject; static MyObject *introspection_helper = nullptr; register_instance(obj, sizeof(MyObject), kind, obj, &introspection_helper);

I.e. introspection_helper should be a pointer to a pointer to an object instance. The inner pointer can be null. The introspection subsystem will then assume this new object is of the matching type, which will help its members deduce their names on construction.

◆ unregister_instance()

static void Halide::Internal::ObjectInstanceRegistry::unregister_instance ( void *  this_ptr)
static

Remove an instance from the registry.

Assert if not found.

◆ instances_in_range()

static std::vector<void *> Halide::Internal::ObjectInstanceRegistry::instances_in_range ( void *  start,
size_t  size,
Kind  kind 
)
static

Returns the list of subject pointers for objects that have been directly registered within the given range.

If there is another containing object inside the range, instances within that object are skipped.


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