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

Abstract base class for variable generation. More...

#include <generatorVariable.h>

Inheritance diagram for GeneratorVariable:

Public Member Functions

virtual ~GeneratorVariable ()
 
virtual std::vector< std::string > new_ (bool inFunction=false)=0
 Creates a new variable.
 
virtual std::vector< std::string > insert ()=0
 Generates code to perform an insertion operation on the variable.
 
virtual std::vector< std::string > remove ()=0
 Generates code to perform a removal operation on the variable.
 
virtual std::vector< std::string > contains (bool shouldReturn=false)=0
 Generates code to perform a contains operation on the variable.
 
virtual std::vector< std::string > free ()=0
 Generates code to free or release resources associated with the variable.
 
virtual std::vector< std::string > genIncludes ()=0
 Generates necessary include statements for the variable.
 
virtual std::vector< std::string > genGlobalVars ()=0
 Generates global variable declarations for the variable type.
 
virtual std::vector< std::string > genParams (std::string paramName, std::vector< GeneratorVariable * > varsParams)=0
 Generates parameter handling code for functions using this variable type.
 

Public Attributes

int id
 
std::string name
 
std::string typeString
 

Detailed Description

Abstract base class for variable generation.

This class defines a common interface for different types of generator variables. It provides methods for common operations, which may vary in behavior depending on the specific type of variable.

Constructor & Destructor Documentation

◆ ~GeneratorVariable()

virtual GeneratorVariable::~GeneratorVariable ( )
inlinevirtual

Member Function Documentation

◆ contains()

virtual std::vector< std::string > GeneratorVariable::contains ( bool shouldReturn = false)
pure virtual

Generates code to perform a contains operation on the variable.

The behavior of this method varies depending on the type of the variable.

Parameters
shouldReturnIndicates whether the method should generate code that returns a value based on the condition.
Returns
A vector of strings representing the code to check the condition.

Implemented in GeneratorArray, and GeneratorSortedList.

◆ free()

virtual std::vector< std::string > GeneratorVariable::free ( )
pure virtual

Generates code to free or release resources associated with the variable.

This method generates code to clean up or release resources held by the variable, if necessary. The specific actions taken depend on the type of the variable and how resources are managed.

Returns
A vector of strings representing the code to free the variable.

Implemented in GeneratorArray, and GeneratorSortedList.

◆ genGlobalVars()

virtual std::vector< std::string > GeneratorVariable::genGlobalVars ( )
pure virtual

Generates global variable declarations for the variable type.

This method returns a vector of strings representing the typedefs and struct definitions necessary for the specific variable type.

Returns
A vector of strings, each representing a global variable or type definition.

Implemented in GeneratorArray, and GeneratorSortedList.

◆ genIncludes()

virtual std::vector< std::string > GeneratorVariable::genIncludes ( )
pure virtual

Generates necessary include statements for the variable.

This method returns a vector of strings containing the required include directives for working with the variable type.

Returns
A vector of strings representing include directives.

Implemented in GeneratorArray, and GeneratorSortedList.

◆ genParams()

virtual std::vector< std::string > GeneratorVariable::genParams ( std::string paramName,
std::vector< GeneratorVariable * > varsParams )
pure virtual

Generates parameter handling code for functions using this variable type.

This method generates code to handle parameters when functions utilize this variable type. It includes initialization and assignment for the parameters.

Parameters
paramNameThe name of the parameter.
varsParamsList of variables to be used as parameters.
Returns
A vector of strings representing the code for parameter handling.

Implemented in GeneratorArray, and GeneratorSortedList.

◆ insert()

virtual std::vector< std::string > GeneratorVariable::insert ( )
pure virtual

Generates code to perform an insertion operation on the variable.

The exact behavior of this method depends on the type of the variable.

Returns
A vector of strings representing the insertion operation code.

Implemented in GeneratorArray, and GeneratorSortedList.

◆ new_()

virtual std::vector< std::string > GeneratorVariable::new_ ( bool inFunction = false)
pure virtual

Creates a new variable.

This method generates code to initialize a new variable. The exact implementation depends on the specific type of the variable.

Parameters
inFunctionIndicates whether the variable is created within a function context.
Returns
A vector of strings representing the code to create the variable.

Implemented in GeneratorArray, and GeneratorSortedList.

◆ remove()

virtual std::vector< std::string > GeneratorVariable::remove ( )
pure virtual

Generates code to perform a removal operation on the variable.

The behavior of this method varies depending on the type of the variable.

Returns
A vector of strings representing the removal operation code.

Implemented in GeneratorArray, and GeneratorSortedList.

Member Data Documentation

◆ id

int GeneratorVariable::id

◆ name

std::string GeneratorVariable::name

◆ typeString

std::string GeneratorVariable::typeString

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