AQUAgpusph 4.1.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions
Aqua::InputOutput::Variable Class Referenceabstract

A generic variable. Almost useless, use the overloaded classes instead of this one. More...

#include <Variable.h>

Inheritance diagram for Aqua::InputOutput::Variable:
Inheritance graph
[legend]

Public Member Functions

 Variable (const std::string varname, const std::string vartype)
 Constructor.
 
virtual ~Variable ()
 Destructor.
 
virtual bool isArray ()=0
 Let efficiently know whether the variable is an array or not.
 
virtual bool isScalar ()
 Let efficiently know whether the variable is a scalar or not.
 
std::string name () const
 Name of the variable.
 
virtual std::string type () const
 Type of the variable.
 
virtual size_t typesize () const
 Get the variable type size.
 
virtual size_t size () const
 Get the variable type size.
 
virtual void * get ()
 Get variable pointer basis pointer.
 
virtual void set (void *ptr)=0
 Set variable from memory.
 
virtual PyObject * getPythonObject (int i0=0, int n=0)
 Get a Python interpretation of the variable.
 
virtual bool setFromPythonObject (PyObject *obj, int i0=0, int n=0)
 Set the variable from a Python object.
 
virtual const std::string asString ()
 Get the variable text representation.
 
void setEvent (cl_event event)
 Set the variable current event.
 
cl_event getEvent ()
 Returns the last event associated to this variable.
 

Protected Member Functions

void sync ()
 Wait for variable underlying event to be complete.
 

Detailed Description

A generic variable. Almost useless, use the overloaded classes instead of this one.

Constructor & Destructor Documentation

◆ Variable()

Aqua::InputOutput::Variable::Variable ( const std::string  varname,
const std::string  vartype 
)

Constructor.

Parameters
varnameName of the variable.
vartypeType of the variable.
Here is the call graph for this function:

◆ ~Variable()

virtual Aqua::InputOutput::Variable::~Variable ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ asString()

virtual const std::string Aqua::InputOutput::Variable::asString ( )
inlinevirtual

◆ get()

virtual void * Aqua::InputOutput::Variable::get ( )
inlinevirtual

◆ getEvent()

cl_event Aqua::InputOutput::Variable::getEvent ( )
inline

Returns the last event associated to this variable.

Returns
OpenCL event

◆ getPythonObject()

virtual PyObject * Aqua::InputOutput::Variable::getPythonObject ( int  i0 = 0,
int  n = 0 
)
inlinevirtual

◆ isArray()

virtual bool Aqua::InputOutput::Variable::isArray ( )
pure virtual

◆ isScalar()

virtual bool Aqua::InputOutput::Variable::isScalar ( )
inlinevirtual

Let efficiently know whether the variable is a scalar or not.

Returns
true if the variable is a scalar, false if the variable is an array
Here is the call graph for this function:

◆ name()

std::string Aqua::InputOutput::Variable::name ( ) const
inline

Name of the variable.

Returns
The name of the variable

◆ set()

virtual void Aqua::InputOutput::Variable::set ( void *  ptr)
pure virtual

◆ setEvent()

void Aqua::InputOutput::Variable::setEvent ( cl_event  event)

Set the variable current event.

clRetainEvent() is called on top of the provided event, while any previous event is conveniently released calling clReleaseEvent()

Might exists other events linked to this variable, but since those are considered predecessors, we can just forgive about them.

Remarks
Events are used even for non-OpenCL variables
Parameters
eventOpenCL event
Here is the call graph for this function:

◆ setFromPythonObject()

virtual bool Aqua::InputOutput::Variable::setFromPythonObject ( PyObject *  obj,
int  i0 = 0,
int  n = 0 
)
inlinevirtual

◆ size()

virtual size_t Aqua::InputOutput::Variable::size ( ) const
inlinevirtual

Get the variable type size.

Returns
Variable type size (in bytes)

Reimplemented in Aqua::InputOutput::ArrayVariable.

Here is the call graph for this function:

◆ sync()

void Aqua::InputOutput::Variable::sync ( )
protected

Wait for variable underlying event to be complete.

This function is tracking the syncing state, avoiding calling clWaitForEvents() more than once, while the event is not updated.

This is obviously a blocking function

Here is the call graph for this function:

◆ type()

virtual std::string Aqua::InputOutput::Variable::type ( ) const
inlinevirtual

Type of the variable.

Returns
The type of the variable

◆ typesize()

virtual size_t Aqua::InputOutput::Variable::typesize ( ) const
inlinevirtual

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