Skip to content

05_28_00_template_hierarchy - Jerarquía de Plantillas por Nivel

Propósito

Sistema fundamental de organización de templates que espeja la estructura L0-L3 de AudioLab. Implementa el engine de templates, sistema de placeholders, herencia y composición.

Componentes

Core Implementation

  • TemplateLoader - Carga templates desde filesystem
  • TemplateResolver - Resuelve herencia y overrides
  • VariableContext - Contexto de variables para substitución
  • PlaceholderSubstituter - Reemplazo de {{PLACEHOLDERS}}

Template Organization

templates/
├── L0_kernel_templates/
│   ├── arithmetic/
│   ├── filter/
│   └── transform/
├── L1_atom_templates/
├── L2_cell_templates/
└── L3_engine_templates/

APIs

# Template loading
loader = TemplateLoader("templates/")
template = loader.load("L0_kernel_templates/arithmetic/add.hpp")

# Variable substitution
context = VariableContext({
    "CLASS_NAME": "VectorAdd",
    "INPUT_TYPE": "float",
    "SIMD_WIDTH": "4"
})
result = template.render(context)

Entregables

  • Sistema de directorios L0-L3
  • Template engine funcional
  • Sistema de herencia
  • Tests >90% coverage
  • 20+ templates base

Estimación: 2 semanas