Class ObjectVisitor#
Defined in File object_functor.h
Inheritance Relationships#
Base Type#
public tvm::ffi::StructuralVisitorObj(Class StructuralVisitorObj)
Derived Type#
public tvm::ExprVisitor(Class ExprVisitor)
Class Documentation#
-
class ObjectVisitor : public tvm::ffi::StructuralVisitorObj#
Native visiting with exact dispatch and structural fallback.
Allocate visitors with ffi::make_object<Derived>(). Inputs are borrowed; interrupts and errors own their values. A hook controls descent into its node. One visitor must not be shared by overlapping traversals.
Subclassed by tvm::ExprVisitor
Public Functions
-
inline ObjectVisitor()#
Construct a visitor using structural fallback for every value.
-
ObjectVisitor(const ObjectVisitor &other) = delete#
-
ObjectVisitor &operator=(const ObjectVisitor &other) = delete#
-
inline virtual ffi::Optional<VisitInterrupt> Visit(ffi::AnyView value)#
Visit a borrowed object or inline value, throwing on failure.
Note
A qualified Parent::Visit bypasses this entry override only; recursive child visits still use virtual dispatch.
- Parameters:
value – The borrowed value to visit.
- Returns:
None on completion or an owning interrupt that halts traversal.
-
inline Expected<ffi::Optional<VisitInterrupt>> VisitExpected(ffi::AnyView value) noexcept#
Adapt the virtual throwing entrypoint to the structural ABI.
Note
Follows the FFI safe-call exception contract: Error retains its identity, and other standard exceptions become InternalError.
- Parameters:
value – The borrowed value to visit.
- Returns:
Completion, interrupt, or the caught error.
Protected Types
-
using VTable = ObjectFunctor<ffi::Optional<VisitInterrupt>(const ffi::Object*, ObjectVisitor*)>#
Exact native dispatch table with owning interrupt results.
Protected Functions
Protected Static Functions
-
static inline void InitVTable(VTable *vtable)#
Initialize the base registrations in a fresh mutable table.
- Parameters:
vtable – The table to initialize before adding derived registrations.
-
template<typename Self, typename Node>
static inline void SetDispatch(VTable *vtable)# Register an exact node type in a fresh table initialized by its parent. Derived node types require separate registrations.
- Template Parameters:
Self – The visitor implementing the hook.
Node – The exact node type handled by the hook.
- Parameters:
vtable – The mutable table to receive the registration.
-
inline ObjectVisitor()#