From b09dc815fc76e7952b6f05c60e9b8c20c81f5c00 Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Sun, 5 Oct 2025 15:19:16 +0530 Subject: [PATCH] Add StatementHandlerRegistry --- pythonbpf/functions/func_registry_handlers.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 pythonbpf/functions/func_registry_handlers.py diff --git a/pythonbpf/functions/func_registry_handlers.py b/pythonbpf/functions/func_registry_handlers.py new file mode 100644 index 0000000..010e3ed --- /dev/null +++ b/pythonbpf/functions/func_registry_handlers.py @@ -0,0 +1,22 @@ +from typing import Dict + + +class StatementHandlerRegistry: + """Registry for statement handlers.""" + + _handlers: Dict = {} + + @classmethod + def register(cls, stmt_type): + """Register a handler for a specific statement type.""" + + def decorator(handler): + cls._handlers[stmt_type] = handler + return handler + + return decorator + + @classmethod + def get_handler(cls, stmt_type): + """Get the handler for a specific statement type.""" + return cls._handlers.get(stmt_type, None)