BenchGen
BenchGen is a tool for generating benchmarks to stress-test a computing system.
Loading...
Searching...
No Matches
GeneratorScope Class Reference

The GeneratorScope class manages scopes in the generator. More...

#include <generatorScope.h>

Public Member Functions

 GeneratorScope (int identation=1)
 Constructs a GeneratorScope with an optional initial indentation level.
 
 GeneratorScope (std::vector< int > parentVars, std::vector< int > parentParams, int parentIndentation)
 Constructs a GeneratorScope based on a parent scope.
 
 ~GeneratorScope ()
 Destructor for the GeneratorScope class.
 
int getVarCounter ()
 Gets the number of available variables in the current scope.
 
int getIndentation ()
 Retrieves the current indentation level.
 
std::string getIndentationTabs (int=0)
 Generates a string of tabs for code indentation.
 
void addVar (int id)
 Adds a variable ID to the current scope.
 
int addParam ()
 Adds a new parameter ID to the current scope.
 

Public Attributes

int numberOfAddedVars
 
std::vector< int > avaiableVarsID
 
std::vector< int > avaiableParamsID
 

Detailed Description

The GeneratorScope class manages scopes in the generator.

This class is responsible for handling the scope of variables and parameters, managing indentation levels, and tracking the number of variables added to the current scope.

Constructor & Destructor Documentation

◆ GeneratorScope() [1/2]

GeneratorScope::GeneratorScope ( int identation = 1)
inline

Constructs a GeneratorScope with an optional initial indentation level.

Initializes a new scope with no variables or parameters and a specified level of indentation.

Parameters
identationThe initial level of indentation (default is 1).

◆ GeneratorScope() [2/2]

GeneratorScope::GeneratorScope ( std::vector< int > parentVars,
std::vector< int > parentParams,
int parentIndentation )
inline

Constructs a GeneratorScope based on a parent scope.

Initializes a new scope by inheriting variables, parameters, and indentation from a parent scope.

Parameters
parentVarsList of variable IDs from the parent scope.
parentParamsList of parameter IDs from the parent scope.
parentIndentationThe indentation level of the parent scope.

◆ ~GeneratorScope()

GeneratorScope::~GeneratorScope ( )
inline

Destructor for the GeneratorScope class.

Currently, this destructor does not perform any special operations.

Member Function Documentation

◆ addParam()

int GeneratorScope::addParam ( )

Adds a new parameter ID to the current scope.

Adds a new parameter by pushing the next available parameter ID to the list and returning its position.

Returns
The index of the newly added parameter.

◆ addVar()

void GeneratorScope::addVar ( int id)

Adds a variable ID to the current scope.

Increases the count of added variables and stores the given variable ID in the list of available variable IDs.

Parameters
idThe ID of the variable to add.

◆ getIndentation()

int GeneratorScope::getIndentation ( )

Retrieves the current indentation level.

Returns
The current indentation level.

◆ getIndentationTabs()

std::string GeneratorScope::getIndentationTabs ( int d = 0)

Generates a string of tabs for code indentation.

This method creates a string containing tabs based on the current indentation level and an additional depth parameter.

Parameters
dAdditional depth to add to the current indentation (default is 0).
Returns
A string of tabs representing the indentation.

◆ getVarCounter()

int GeneratorScope::getVarCounter ( )

Gets the number of available variables in the current scope.

Returns
The number of available variables.

Member Data Documentation

◆ avaiableParamsID

std::vector<int> GeneratorScope::avaiableParamsID

◆ avaiableVarsID

std::vector<int> GeneratorScope::avaiableVarsID

◆ numberOfAddedVars

int GeneratorScope::numberOfAddedVars

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