AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
Aqua::InputOutput::Variable Class Referenceabstract

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

#include <Variable.hpp>

Inheritance diagram for Aqua::InputOutput::Variable:

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.
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 (bool UNUSED_PARAM synced=true)
 Get variable pointer basis pointer.
void * get_async ()
 Get variable pointer basis pointer.
virtual void set (void *ptr, bool synced=true)
 Set variable from memory.
void set_async (void *ptr)
 Set variable from memory.
virtual PyObject * getPythonObject (int UNUSED_PARAM i0=0, int UNUSED_PARAM n=0)
 Get a Python interpretation of the variable.
virtual bool setFromPythonObject (PyObject UNUSED_PARAM *obj, int UNUSED_PARAM i0=0, int UNUSED_PARAM n=0)
 Set the variable from a Python object.
virtual const std::string asString (bool UNUSED_PARAM synced=true)
 Get the variable text representation.
void setEvent (cl_event event)
 Set the variable current writing event.
void setWritingEvent (cl_event event)
 Alias of InputOutput::Variable::setEvent()
cl_event getEvent () const
 Returns the last writing event associated to this variable.
cl_event getWritingEvent () const
 Alias of InputOutput::Variable::getEvent()
void addReadingEvent (cl_event event)
 Add a new reading event to the variable.
std::vector< cl_event > getReadingEvents () const
 Get the list of reading events.
void sync (bool readonly=false)
 Wait for variable reading and writing events to be completed.

Protected Member Functions

void cleanReadingEvents ()
 Clean up the list of reading events.

Static Protected Member Functions

static cl_event createDummyEvent ()
 Create a competed user event to be set as the writing event when synced writing operations are carried out.

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()

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

Destructor.

Here is the call graph for this function:

Member Function Documentation

◆ asString()

virtual const std::string Aqua::InputOutput::Variable::asString ( bool UNUSED_PARAM synced = true)
inlinevirtual

Get the variable text representation.

Returns
The variable represented as a string, NULL in case of errors.

◆ createDummyEvent()

cl_event Aqua::InputOutput::Variable::createDummyEvent ( )
staticprotected

Create a competed user event to be set as the writing event when synced writing operations are carried out.

Returns
The completed event
Exceptions
std::runtime_errorIf the OpenCL event creation fails
Here is the call graph for this function:

◆ get()

virtual void * Aqua::InputOutput::Variable::get ( bool UNUSED_PARAM synced = true)
inlinevirtual

Get variable pointer basis pointer.

Parameters
syncedtrue if the operation shall block the execution until the variable events are dispatched
Returns
Implementation pointer, NULL for this class.

Reimplemented in Aqua::InputOutput::ArrayVariable.

◆ get_async()

void * Aqua::InputOutput::Variable::get_async ( )
inline

Get variable pointer basis pointer.

Sometimes a tool would make events micromanagement, becoming useful to can retrieve the value in an asynchronous way. That is for instance the case of events manipulated in callbacks

Returns
Implementation pointer
Here is the call graph for this function:

◆ getPythonObject()

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

Get a Python interpretation of the variable.

Parameters
i0First component to be read, just for array variables.
nNumber of component to be read, just for array variables.
Returns
Python object, NULL for this class.

◆ isArray()

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

◆ isScalar()

bool Aqua::InputOutput::Variable::isScalar ( )
inline

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()

void Aqua::InputOutput::Variable::set ( void * ptr,
bool synced = true )
virtual

Set variable from memory.

If synced, this method is setting a completed user event as the variable writing event. Remeber to call this at the end of any overloaded function

Parameters
ptrUnused parameter, it is of use for overloaded functions
syncedtrue if the operation shall block the execution until the variable events are dispatched

Reimplemented in Aqua::InputOutput::ArrayVariable, Aqua::InputOutput::ScalarVariable< T >, Aqua::InputOutput::ScalarVariable< dcl >, Aqua::InputOutput::ScalarVariable< fcl >, Aqua::InputOutput::ScalarVariable< icl >, Aqua::InputOutput::ScalarVariable< lcl >, Aqua::InputOutput::ScalarVariable< uicl >, and Aqua::InputOutput::ScalarVariable< ulcl >.

Here is the call graph for this function:

◆ set_async()

void Aqua::InputOutput::Variable::set_async ( void * ptr)
inline

Set variable from memory.

Sometimes a tool would make events micromanagement, becoming useful to can retrieve the value in an asynchronous way. That is for instance the case of events manipulated in callbacks

Parameters
ptrMemory to copy
Here is the call graph for this function:

◆ setFromPythonObject()

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

Set the variable from a Python object.

Parameters
objPython object.
i0First component to be set, just for array variables.
nNumber of component to be set, just for array variables.
Returns
true, i.e. an error.

◆ 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:

◆ type()

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

Type of the variable.

Returns
The type of the variable

◆ typesize()


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