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

Base class for managing template generation. More...

#include <TemplateManager.h>

Inheritance diagram for TemplateManagerBase:

Public Member Functions

 TemplateManagerBase (const std::string &templatesDir)
 Constructs a manager with a given templates directory.
 
virtual ~TemplateManagerBase ()=default
 
void generateTemplate (const std::string &templateName, const std::string &outputPath)
 Public entry point for template generation.
 
void setModelModifier (std::unique_ptr< ModelModifier > modifier)
 Injects a custom model modifier.
 
void setNumModelModifier (std::unique_ptr< GeneralNumModelModifier > modifier)
 Injects a numeric model modifier.
 
void setModelAndWilson (std::string model, std::string wilson)
 Sets both model and Wilson names used during generation.
 
std::unordered_set< InterpretedParamget_dependencies ()
 Returns the set of interpreted parameters used by the numeric modifier.
 

Protected Member Functions

virtual void generateTemplateImpl (const std::string &templateName, const std::string &outputPath)=0
 Actual implementation for generating a specific template.
 
bool already_generated (const std::string &path)
 Checks whether a file was already generated by this system.
 

Protected Attributes

std::string templatesDir
 Directory containing the template sources.
 
std::string wilson
 Wilson basis name.
 
std::string model
 Model name.
 
std::unique_ptr< ModelModifiermodelModifier
 Optional modifier for non-numeric templates.
 
std::unique_ptr< GeneralNumModelModifiernumModifier
 Optional modifier for numeric templates.
 

Detailed Description

Base class for managing template generation.

Provides common facilities for:

  • holding model / Wilson identifiers,
  • storing a ModelModifier and GeneralNumModelModifier,
  • checking if a file has already been generated (using the //42 marker),
  • exposing the set of interpreted dependencies (parameters).

Definition at line 31 of file TemplateManager.h.

Constructor & Destructor Documentation

◆ TemplateManagerBase()

TemplateManagerBase::TemplateManagerBase ( const std::string &  templatesDir)
inline

Constructs a manager with a given templates directory.

Parameters
templatesDirPath to the directory containing template sources.

Definition at line 37 of file TemplateManager.h.

◆ ~TemplateManagerBase()

virtual TemplateManagerBase::~TemplateManagerBase ( )
virtualdefault

Member Function Documentation

◆ already_generated()

bool TemplateManagerBase::already_generated ( const std::string &  path)
protected

Checks whether a file was already generated by this system.

The method scans the small generated-file header for the marker string "//42". If found, the file is considered already generated. This covers both numeric files (marker on line one) and analytical files (marker immediately after the preserved first template line).

Parameters
pathPath to the file to test.
Returns
true if file exists and contains the marker, false otherwise.

Definition at line 122 of file TemplateManager.cpp.

◆ generateTemplate()

void TemplateManagerBase::generateTemplate ( const std::string &  templateName,
const std::string &  outputPath 
)
inline

Public entry point for template generation.

Delegates to the virtual generateTemplateImpl method implemented by derived classes.

Parameters
templateNameName of the template (without extension).
outputPathFile path where the generated C++ file should be written.

Definition at line 50 of file TemplateManager.h.

◆ generateTemplateImpl()

virtual void TemplateManagerBase::generateTemplateImpl ( const std::string &  templateName,
const std::string &  outputPath 
)
protectedpure virtual

Actual implementation for generating a specific template.

Derived classes implement the logic that:

  • locates the template file,
  • creates directories,
  • copies or transforms the contents,
  • optionally writes parameter files.
Parameters
templateNameTemplate identifier (without extension).
outputPathDestination C++ file path.

◆ get_dependencies()

std::unordered_set< InterpretedParam > TemplateManagerBase::get_dependencies ( )

Returns the set of interpreted parameters used by the numeric modifier.

The set is built from the values of GeneralNumModelModifier::get_interpreted_param_map().

Returns
Unordered set of InterpretedParam representing all dependencies of the numeric template.

Definition at line 114 of file TemplateManager.cpp.

◆ setModelAndWilson()

void TemplateManagerBase::setModelAndWilson ( std::string  model,
std::string  wilson 
)
inline

Sets both model and Wilson names used during generation.

Parameters
modelModel name.
wilsonWilson basis name.

Definition at line 71 of file TemplateManager.h.

◆ setModelModifier()

void TemplateManagerBase::setModelModifier ( std::unique_ptr< ModelModifier modifier)
inline

Injects a custom model modifier.

Parameters
modifierUnique pointer owning the ModelModifier instance.

Definition at line 58 of file TemplateManager.h.

◆ setNumModelModifier()

void TemplateManagerBase::setNumModelModifier ( std::unique_ptr< GeneralNumModelModifier modifier)
inline

Injects a numeric model modifier.

Parameters
modifierUnique pointer owning the GeneralNumModelModifier instance.

Definition at line 64 of file TemplateManager.h.

Member Data Documentation

◆ model

std::string TemplateManagerBase::model
protected

Model name.

Definition at line 90 of file TemplateManager.h.

◆ modelModifier

std::unique_ptr<ModelModifier> TemplateManagerBase::modelModifier
protected

Optional modifier for non-numeric templates.

Definition at line 93 of file TemplateManager.h.

◆ numModifier

std::unique_ptr<GeneralNumModelModifier> TemplateManagerBase::numModifier
protected

Optional modifier for numeric templates.

Definition at line 95 of file TemplateManager.h.

◆ templatesDir

std::string TemplateManagerBase::templatesDir
protected

Directory containing the template sources.

Definition at line 86 of file TemplateManager.h.

◆ wilson

std::string TemplateManagerBase::wilson
protected

Wilson basis name.

Definition at line 88 of file TemplateManager.h.


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