AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
Aqua::CalcServer::Conditional Class Reference

Base class for conditional tools like While or If. More...

#include <Conditional.hpp>

Inheritance diagram for Aqua::CalcServer::Conditional:
Collaboration diagram for Aqua::CalcServer::Conditional:

Public Member Functions

 Conditional (const std::string name, const std::string condition, bool once=false)
 Constructor.
 ~Conditional ()
 Destructor.
void setup ()
 Initialize the tool.
virtual Toolnext_tool ()
int scope_modifier () const
Public Member Functions inherited from Aqua::CalcServer::ScalarExpression
 ScalarExpression (const std::string name, const std::string expr, const std::string type="float", bool once=false)
 Constructor.
 ~ScalarExpression ()
 Destructor.
const std::string getOutputType () const
 Get the output typesize.
void setOutputType (const std::string type)
 Set the output typesize.
const std::string getExpression () const
 Get the expression to evaluate.
const void * getValue () const
 Get the stored output value.
cl_event getUserEvent () const
 Get the user event generated by this tool to mark when is finished.
void solve ()
 Evaluate the expression and store the value.
Public Member Functions inherited from Aqua::CalcServer::Tool
 Tool (const std::string tool_name, bool once=false)
virtual ~Tool ()
virtual void execute ()
 Execute the tool measuring the elapsed time.
Toolprev_tool () const
void prev_tool (Tool *tool)
size_t allocatedMemory () const
unsigned int used_times () const
void addElapsedTime (float elapsed_time)
 Add new data to the average and squared elapsed times.
float elapsedTime (bool averaged=true) const
float elapsedTimeVariance () const
float elapsedTimeDeviation () const
std::vector< InputOutput::Variable * > getInputDependencies () const
 Get the input depedencies of the tool.
std::vector< InputOutput::Variable * > getOutputDependencies () const
 Get the output depedencies of the tool.
std::tuple< std::vector< InputOutput::Variable * >, std::vector< InputOutput::Variable * > > getDependencies () const
 Get the depedencies of the tool.
cl_event getEvent () const
 Get the tool event.
void parent (Tool *tool)
 Set the tool parent.
Toolparent ()
 Get the tool parent.
Public Member Functions inherited from Aqua::CalcServer::Named
 Named (const std::string name)
 ~Named ()
void name (const std::string tool_name)
const std::string name () const
 Get the name.
Public Member Functions inherited from Aqua::CalcServer::Profiler
 Profiler ()
 ~Profiler ()
std::vector< Profile * > substages () const
 Get the substages.

Protected Member Functions

void _solve ()
 Evaluate the expression and check whether it is true or false.
Protected Member Functions inherited from Aqua::CalcServer::ScalarExpression
virtual cl_event _execute (const std::vector< cl_event > events)
Protected Member Functions inherited from Aqua::CalcServer::Tool
int id_in_pipeline () const
std::string varPrefix () const
 Produce a variable name prefix.
void next_tool (Tool *tool)
void allocatedMemory (size_t mem_size)
virtual cl_event _execute (const UNUSED_PARAM std::vector< cl_event > events)
void setDependencies (std::vector< std::string > inputs, std::vector< std::string > outputs)
 Set the depedencies of the tool.
void setDependencies (std::vector< InputOutput::Variable * > inputs, std::vector< InputOutput::Variable * > outputs)
 Set the depedencies of the tool.
void setDependencies (std::vector< std::string > vars)
 Set the depedencies of the tool.
void setInputDependencies (std::vector< std::string > vars)
 Set the reading depedencies of the tool.
void setInputDependencies (std::vector< InputOutput::Variable * > vars)
 Set the reading depedencies of the tool.
void setOutputDependencies (std::vector< std::string > vars)
 Set the writing depedencies of the tool.
void setOutputDependencies (std::vector< InputOutput::Variable * > vars)
 Set the writing depedencies of the tool.
void setDependencies (std::vector< InputOutput::Variable * > vars)
 Set the depedencies of the tool.
const std::vector< cl_event > getEvents (dep_events which=dep_events::all) const
 Get the list of events that this tool shall wait for.
Protected Member Functions inherited from Aqua::CalcServer::Profiler
void substages (std::vector< Profile * > instances)
 Set the tool substages.

Protected Attributes

bool _result
 Condition result.

Additional Inherited Members

Protected Types inherited from Aqua::CalcServer::Tool
enum  dep_events { in = 0x01 , out = 0x02 , all = 0x03 }
Static Protected Member Functions inherited from Aqua::CalcServer::Tool
static std::vector< cl_kernel > compile (const std::string source, const std::vector< std::string > names, const std::string flags="")
 Compile an OpenCL source code and generate the corresponding kernel.
static cl_kernel compile_kernel (const std::string source, const std::string kernel_name, const std::string flags="")
 Compile an OpenCL source code and generate the corresponding kernel.

Detailed Description

Base class for conditional tools like While or If.

If the result of evaluating the condition expression is equal to 0, the result will be considered false, and therefore all the tools until the next End tool will be disabled

Constructor & Destructor Documentation

◆ Conditional()

Aqua::CalcServer::Conditional::Conditional ( const std::string name,
const std::string condition,
bool once = false )

Constructor.

Parameters
nameTool name.
conditionCondition to evaluate. If the result is 0, false will be considered and all the subsequent tools will be disabled until an End tool is reached.
onceRun this tool just once. Useful to make initializations.
Here is the call graph for this function:

◆ ~Conditional()

Aqua::CalcServer::Conditional::~Conditional ( )

Destructor.

Member Function Documentation

◆ _solve()

void Aqua::CalcServer::Conditional::_solve ( )
protectedvirtual

Evaluate the expression and check whether it is true or false.

Reimplemented from Aqua::CalcServer::ScalarExpression.

Reimplemented in Aqua::CalcServer::If.

Here is the call graph for this function:

◆ next_tool()

Tool * Aqua::CalcServer::Conditional::next_tool ( )
virtual

Get the next tool to be executed in the pipeline.

Depending on the condition value, that tool is the next one or the tool after the End tool which closes the scope

Returns
Next tool to be executed. NULL if no more tools shall be executed in the pipeline

Reimplemented from Aqua::CalcServer::Tool.

Reimplemented in Aqua::CalcServer::If.

Here is the call graph for this function:

◆ scope_modifier()

int Aqua::CalcServer::Conditional::scope_modifier ( ) const
inlinevirtual

Open a new scope

Returns
1
Note
The scope shall be close at some point by an EndIf tool

Reimplemented from Aqua::CalcServer::Tool.

◆ setup()

void Aqua::CalcServer::Conditional::setup ( )
virtual

Initialize the tool.

Reimplemented from Aqua::CalcServer::ScalarExpression.

Here is the call graph for this function:

Field Documentation

◆ _result

bool Aqua::CalcServer::Conditional::_result
protected

Condition result.


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