Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
CompilerStrategy Class Referenceabstract

Abstract base class for compilation and run strategies. More...

#include <CompilerStrategy.h>

Inheritance diagram for CompilerStrategy:

Public Member Functions

 CompilerStrategy (std::string model, std::string wilson)
 Constructs a CompilerStrategy with a given model and Wilson label.
 
virtual ~CompilerStrategy ()=default
 Virtual destructor.
 
virtual void compile_run (const std::string &sourceFile, const std::string &outputBinary)=0
 Compiles (if needed) and then runs the resulting binary.
 
virtual void compile (const std::string &sourceFile, const std::string &outputBinary)=0
 Compiles the given source file into an output binary.
 
virtual bool check_if_compile (const std::string &outputBinary)
 Checks whether a compiled binary already exists and is non-empty.
 

Protected Attributes

std::string model
 Model name.
 
std::string wilson
 Wilson basis / label name.
 

Detailed Description

Abstract base class for compilation and run strategies.

CompilerStrategy encapsulates how generated C++ code is compiled and/or executed. Concrete strategies can:

Typical usage:

  • construct a strategy with a given (model, wilson) pair,
  • call compile_run() on the generated source and target binary.

Definition at line 61 of file CompilerStrategy.h.

Constructor & Destructor Documentation

◆ CompilerStrategy()

CompilerStrategy::CompilerStrategy ( std::string  model,
std::string  wilson 
)
inline

Constructs a CompilerStrategy with a given model and Wilson label.

Parameters
modelName of the physics model (e.g. "SM", "SUSY").
wilsonName of the Wilson basis or identifier.

Definition at line 69 of file CompilerStrategy.h.

◆ ~CompilerStrategy()

virtual CompilerStrategy::~CompilerStrategy ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ check_if_compile()

bool CompilerStrategy::check_if_compile ( const std::string &  outputBinary)
virtual

Checks whether a compiled binary already exists and is non-empty.

This is used to avoid recompiling unchanged binaries on repeated calls.

Parameters
outputBinaryPath to the binary.
Returns
true if the file exists and has non-zero size, false otherwise.

Definition at line 33 of file CompilerStrategy.cpp.

◆ compile()

virtual void CompilerStrategy::compile ( const std::string &  sourceFile,
const std::string &  outputBinary 
)
pure virtual

Compiles the given source file into an output binary.

Each concrete strategy is responsible for building the appropriate compiler command (e.g. g++, make, etc.) and calling executeCommand().

Parameters
sourceFilePath to the generated C++ source.
outputBinaryPath/name of the binary to produce.

Implemented in GppCompilerStrategy, and MakeCompilerStrategy.

◆ compile_run()

virtual void CompilerStrategy::compile_run ( const std::string &  sourceFile,
const std::string &  outputBinary 
)
pure virtual

Compiles (if needed) and then runs the resulting binary.

The typical implementation:

Parameters
sourceFilePath to the generated C++ source.
outputBinaryPath/name of the binary to produce and run.

Implemented in GppCompilerStrategy, and MakeCompilerStrategy.

Member Data Documentation

◆ model

std::string CompilerStrategy::model
protected

Model name.

Definition at line 110 of file CompilerStrategy.h.

◆ wilson

std::string CompilerStrategy::wilson
protected

Wilson basis / label name.

Definition at line 112 of file CompilerStrategy.h.


The documentation for this class was generated from the following files: