#ifndef CODE_GENERATOR_H #define CODE_GENERATOR_H #include "data_structures.h" #include "json_parser.h" #include #include #include class CodeGenerator { private: Config config; std::map commonSetups; std::map variantSetups; std::map globalVariables; // Parse JSON helpers Instrument parseInstrument(std::shared_ptr json); Property parseProperty(std::shared_ptr json); Variable parseVariable(std::shared_ptr json); Setup parseSetup(std::shared_ptr json); SetupFile parseSetupFile(std::shared_ptr json); Template parseTemplate(std::shared_ptr json); TestExecution parseTestExecution(std::shared_ptr json); // Code generation helpers std::string generateInstrumentDefinitions(); std::string generateTestClass(const Template& tmpl, const TestExecution& testExec); std::string generateSetupMethod(const std::string& setupName, const std::string& instrumentName); std::string generateMainFile(const std::vector& testNames); // Variable substitution std::string substituteVariables(const std::string& expr, const std::map& localVars); std::string processVariableExpression(const std::string& expr); // Setup merging Setup mergeSetup(const std::string& setupName, const std::string& instrumentName); public: CodeGenerator(const Config& cfg); bool loadConfigurations(); bool generateCode(); }; #endif