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

Class representing an array variable. More...

#include <generatorVariable.h>

Inheritance diagram for GeneratorArray:
Collaboration diagram for GeneratorArray:

Public Member Functions

 GeneratorArray ()
 Default constructor for the Array class.
 
 GeneratorArray (int totalSize, int id)
 Constructs an Array with a specified size, values, and identifier.
 
 ~GeneratorArray ()
 Destructor for the Array class.
 
std::vector< std::string > new_ (bool inFunction=false) override
 Creates a new variable.
 
std::vector< std::string > insert () override
 Generates code to perform an insertion operation on the variable.
 
std::vector< std::string > remove () override
 Generates code to perform a removal operation on the variable.
 
std::vector< std::string > contains (bool shouldReturn=false) override
 Generates code to perform a contains operation on the variable.
 
std::vector< std::string > free () override
 Generates code to free or release resources associated with the variable.
 
std::vector< std::string > genIncludes () override
 Generates necessary include statements for the variable.
 
std::vector< std::string > genGlobalVars () override
 Generates global variable declarations for the variable type.
 
std::vector< std::string > genParams (std::string paramName, std::vector< GeneratorVariable * > varsParams) override
 Generates parameter handling code for functions using this variable type.
 
- Public Member Functions inherited from GeneratorVariable
virtual ~GeneratorVariable ()
 

Public Attributes

int totalSize
 
- Public Attributes inherited from GeneratorVariable
int id
 
std::string name
 
std::string typeString
 

Detailed Description

Class representing an array variable.

This class provides methods for operations specific to array variables.

Constructor & Destructor Documentation

◆ GeneratorArray() [1/2]

GeneratorArray::GeneratorArray ( )
inline

Default constructor for the Array class.

◆ GeneratorArray() [2/2]

GeneratorArray::GeneratorArray ( int totalSize,
int id )

Constructs an Array with a specified size, values, and identifier.

Parameters
totalSizeThe size of the array.
valuesPointer to the array of integer values.
idThe unique identifier for the array.

◆ ~GeneratorArray()

GeneratorArray::~GeneratorArray ( )

Destructor for the Array class.

Member Function Documentation

◆ contains()

std::vector< std::string > GeneratorArray::contains ( bool shouldReturn = false)
overridevirtual

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.

Implements GeneratorVariable.

◆ free()

std::vector< std::string > GeneratorArray::free ( )
overridevirtual

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.

Implements GeneratorVariable.

◆ genGlobalVars()

std::vector< std::string > GeneratorArray::genGlobalVars ( )
overridevirtual

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.

Implements GeneratorVariable.

◆ genIncludes()

std::vector< std::string > GeneratorArray::genIncludes ( )
overridevirtual

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.

Implements GeneratorVariable.

◆ genParams()

std::vector< std::string > GeneratorArray::genParams ( std::string paramName,
std::vector< GeneratorVariable * > varsParams )
overridevirtual

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.

Implements GeneratorVariable.

◆ insert()

std::vector< std::string > GeneratorArray::insert ( )
overridevirtual

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.

Implements GeneratorVariable.

◆ new_()

std::vector< std::string > GeneratorArray::new_ ( bool inFunction = false)
overridevirtual

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.

Implements GeneratorVariable.

◆ remove()

std::vector< std::string > GeneratorArray::remove ( )
overridevirtual

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.

Implements GeneratorVariable.

Member Data Documentation

◆ totalSize

int GeneratorArray::totalSize

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