# Path: pyoptix/enums.py
# class ExceptionType:
#     program_id_invalid = RTexception.RT_EXCEPTION_PROGRAM_ID_INVALID
#     texture_id_invalid = RTexception.RT_EXCEPTION_TEXTURE_ID_INVALID
#     buffer_id_invalid = RTexception.RT_EXCEPTION_BUFFER_ID_INVALID
#     index_out_of_bounds = RTexception.RT_EXCEPTION_INDEX_OUT_OF_BOUNDS
#     stack_overflow = RTexception.RT_EXCEPTION_STACK_OVERFLOW
#     buffer_index_out_of_bounds = RTexception.RT_EXCEPTION_BUFFER_INDEX_OUT_OF_BOUNDS
#     invalid_ray = RTexception.RT_EXCEPTION_INVALID_RAY
#     internal_error = RTexception.RT_EXCEPTION_INTERNAL_ERROR
#     user = RTexception.RT_EXCEPTION_USER
#     all = RTexception.RT_EXCEPTION_ALL
# 
# Path: pyoptix/mixins/scoped.py
# class ScopedObject(DestroyableObject):
#     def __init__(self, native):
#         DestroyableObject.__init__(self, native)
#         self._variables = {}
# 
#     def __setitem__(self, key, value):
#         from pyoptix.variable import Variable
# 
#         variable_wrapper = self._safe_native.query_variable(key)
#         declared = False
# 
#         if variable_wrapper is None:
#             variable_wrapper = self._safe_native.declare_variable(key)
#             declared = True
# 
#         try:
#             optix_variable = Variable(variable_wrapper)
#             optix_variable.value = value
#             self._variables[key] = optix_variable
#         except Exception as e:
#             if declared:
#                 self._safe_native.remove_variable(variable_wrapper)
#             raise e
# 
#     def __getitem__(self, key):
#         return self._variables[key].value
# 
#     def __len__(self):
#         return len(self._variables)
# 
#     def __delitem__(self, key):
#         wrapped_variable = self._safe_native.query_variable(key)
#         if not wrapped_variable.is_valid():
#             raise ValueError("Variable not found")
# 
#         self._safe_native.remove_variable(wrapped_variable)
#         del self._variables[key]
# 
#     def __contains__(self, item):
#         return item in self._variables


import weakref
import atexit
from pyoptix._driver import NativeContextWrapper
from pyoptix.enums import ExceptionType
from pyoptix.mixins.scoped import ScopedObject
        return self._native.get_print_buffer_size()

    def set_print_buffer_size(self, print_buffer_size):
        if not isinstance(print_buffer_size, int) or print_buffer_size < 0:
            raise TypeError('Print buffer size is the number of bytes that must be a positive integer')

        self._native.set_print_buffer_size(print_buffer_size)

    def set_ray_generation_program(self, entry_point_index, program):
        self._native.set_ray_generation_program(entry_point_index, program._native)
        self._ray_gen_programs[entry_point_index] = program

    def get_ray_generation_program(self, entry_point_index):
        return self._ray_gen_programs[entry_point_index]

    def set_exception_program(self, entry_point_index, program):
        self._native.set_exception_program(entry_point_index, program._native)
        self._ray_gen_programs[entry_point_index] = program

    def get_exception_program(self, entry_point_index):
        return self._exception_programs[entry_point_index]

    def set_miss_program(self, ray_type_index, program):
        self._native.set_miss_program(ray_type_index, program._native)
        self._miss_programs[ray_type_index] = program

    def get_miss_program(self, ray_type_index):
        return self._miss_programs[ray_type_index]

    def set_all_exceptions_enabled(self, is_enabled):

# Path: pyoptix/enums.py
# class ExceptionType:
#     program_id_invalid = RTexception.RT_EXCEPTION_PROGRAM_ID_INVALID
#     texture_id_invalid = RTexception.RT_EXCEPTION_TEXTURE_ID_INVALID
#     buffer_id_invalid = RTexception.RT_EXCEPTION_BUFFER_ID_INVALID
#     index_out_of_bounds = RTexception.RT_EXCEPTION_INDEX_OUT_OF_BOUNDS
#     stack_overflow = RTexception.RT_EXCEPTION_STACK_OVERFLOW
#     buffer_index_out_of_bounds = RTexception.RT_EXCEPTION_BUFFER_INDEX_OUT_OF_BOUNDS
#     invalid_ray = RTexception.RT_EXCEPTION_INVALID_RAY
#     internal_error = RTexception.RT_EXCEPTION_INTERNAL_ERROR
#     user = RTexception.RT_EXCEPTION_USER
#     all = RTexception.RT_EXCEPTION_ALL
# 
# Path: pyoptix/mixins/scoped.py
# class ScopedObject(DestroyableObject):
#     def __init__(self, native):
#         DestroyableObject.__init__(self, native)
#         self._variables = {}
# 
#     def __setitem__(self, key, value):
#         from pyoptix.variable import Variable
# 
#         variable_wrapper = self._safe_native.query_variable(key)
#         declared = False
# 
#         if variable_wrapper is None:
#             variable_wrapper = self._safe_native.declare_variable(key)
#             declared = True
# 
#         try:
#             optix_variable = Variable(variable_wrapper)
#             optix_variable.value = value
#             self._variables[key] = optix_variable
#         except Exception as e:
#             if declared:
#                 self._safe_native.remove_variable(variable_wrapper)
#             raise e
# 
#     def __getitem__(self, key):
#         return self._variables[key].value
# 
#     def __len__(self):
#         return len(self._variables)
# 
#     def __delitem__(self, key):
#         wrapped_variable = self._safe_native.query_variable(key)
#         if not wrapped_variable.is_valid():
#             raise ValueError("Variable not found")
# 
#         self._safe_native.remove_variable(wrapped_variable)
#         del self._variables[key]
# 
#     def __contains__(self, item):
#         return item in self._variables


# Path: pyoptix/context.py
import weakref
import atexit
from pyoptix._driver import NativeContextWrapper
from pyoptix.enums import ExceptionType
from pyoptix.mixins.scoped import ScopedObject

        return self._native.get_print_buffer_size()

    def set_print_buffer_size(self, print_buffer_size):
        if not isinstance(print_buffer_size, int) or print_buffer_size < 0:
            raise TypeError('Print buffer size is the number of bytes that must be a positive integer')

        self._native.set_print_buffer_size(print_buffer_size)

    def set_ray_generation_program(self, entry_point_index, program):
        self._native.set_ray_generation_program(entry_point_index, program._native)
        self._ray_gen_programs[entry_point_index] = program

    def get_ray_generation_program(self, entry_point_index):
        return self._ray_gen_programs[entry_point_index]

    def set_exception_program(self, entry_point_index, program):
        self._native.set_exception_program(entry_point_index, program._native)
        self._ray_gen_programs[entry_point_index] = program

    def get_exception_program(self, entry_point_index):
        return self._exception_programs[entry_point_index]

    def set_miss_program(self, ray_type_index, program):
        self._native.set_miss_program(ray_type_index, program._native)
        self._miss_programs[ray_type_index] = program

    def get_miss_program(self, ray_type_index):
        return self._miss_programs[ray_type_index]

    def set_all_exceptions_enabled(self, is_enabled):

        self._native.set_exception_enabled(ExceptionType.all, is_enabled)