AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
Aqua::InputOutput::ScalarVariable< T > Class Template Referenceabstract

A generic Scalar variable. More...

#include <Variable.hpp>

Inheritance diagram for Aqua::InputOutput::ScalarVariable< T >:
Collaboration diagram for Aqua::InputOutput::ScalarVariable< T >:

Public Member Functions

 ScalarVariable (const std::string varname, const std::string vartype)
 Constructor.
 ~ScalarVariable ()
 Destructor.
bool isArray ()
 Report that the varaible is not an array.
size_t typesize () const
 Get the variable type size.
void * get (bool synced=true)
 Get variable pointer basis pointer.
void get (T &value, bool synced=true)
 Get variable value.
void set (void *ptr, bool synced=true)
 Set variable from memory.
void set (T &value, bool synced=true)
 Set variable value.
T value (bool synced=true)
 Get the variable value.
void value (T &value, bool synced=true)
 Set the variable value.
virtual PyObject * getPythonObject (int i0=0, int n=0)=0
 Get a Python Object representation of the variable.
virtual bool setFromPythonObject (PyObject *obj, int i0=0, int n=0)=0
 Set the variable from a Python object.
virtual const std::string asString (bool synced)=0
 Get the variable text representation.
Public Member Functions inherited from Aqua::InputOutput::Variable
 Variable (const std::string varname, const std::string vartype)
 Constructor.
virtual ~Variable ()
 Destructor.
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 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.
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 Attributes

T _value
 Variable value.

Additional Inherited Members

Protected Member Functions inherited from Aqua::InputOutput::Variable
void cleanReadingEvents ()
 Clean up the list of reading events.
Static Protected Member Functions inherited from Aqua::InputOutput::Variable
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

template<class T>
class Aqua::InputOutput::ScalarVariable< T >

A generic Scalar variable.

Constructor & Destructor Documentation

◆ ScalarVariable()

template<class T>
Aqua::InputOutput::ScalarVariable< T >::ScalarVariable ( const std::string varname,
const std::string vartype )
inline

Constructor.

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

◆ ~ScalarVariable()

template<class T>
Aqua::InputOutput::ScalarVariable< T >::~ScalarVariable ( )
inline

Destructor.

Member Function Documentation

◆ asString()

template<class T>
virtual const std::string Aqua::InputOutput::ScalarVariable< T >::asString ( bool synced)
pure virtual

Get the variable text representation.

Parameters
syncedtrue if the function shall block until the last writing event is dispatched, false otherwise
Returns
The variable represented as a string, NULL in case of errors.

Implemented in Aqua::InputOutput::ScalarNumberVariable< T >, Aqua::InputOutput::ScalarNumberVariable< dcl >, Aqua::InputOutput::ScalarNumberVariable< fcl >, Aqua::InputOutput::ScalarNumberVariable< icl >, Aqua::InputOutput::ScalarNumberVariable< lcl >, Aqua::InputOutput::ScalarNumberVariable< uicl >, Aqua::InputOutput::ScalarNumberVariable< ulcl >, and Aqua::InputOutput::ScalarVecVariable< T >.

◆ get() [1/2]

template<class T>
void * Aqua::InputOutput::ScalarVariable< T >::get ( bool synced = true)
inline

Get variable pointer basis pointer.

This is a blocking operation, that will retain the program until the underlying variable event is complete. For asynchronous variable retrieval see get_async()

Parameters
syncedtrue if the operation shall block the execution until the variable events are dispatched
Returns
Implementation pointer
Here is the call graph for this function:

◆ get() [2/2]

template<class T>
void Aqua::InputOutput::ScalarVariable< T >::get ( T & value,
bool synced = true )
inline

Get variable value.

This is a blocking operation, that will retain the program until the underlying variable event is complete. For asynchronous variable retrieval see get_async()

Parameters
valueOutput value
syncedtrue if the operation shall block the execution until the variable events are dispatched
Here is the call graph for this function:

◆ getPythonObject()

template<class T>
virtual PyObject * Aqua::InputOutput::ScalarVariable< T >::getPythonObject ( int i0 = 0,
int n = 0 )
pure virtual

Get a Python Object representation of the variable.

Parameters
i0ignored parameter.
nignored parameter.
Returns
Python object.

Implemented in Aqua::InputOutput::DoubleVariable, Aqua::InputOutput::FloatVariable, Aqua::InputOutput::IntVariable, Aqua::InputOutput::LongVariable, Aqua::InputOutput::ScalarVecVariable< T >, Aqua::InputOutput::UIntVariable, and Aqua::InputOutput::ULongVariable.

◆ isArray()

template<class T>
bool Aqua::InputOutput::ScalarVariable< T >::isArray ( )
inlinevirtual

Report that the varaible is not an array.

Returns
false

Implements Aqua::InputOutput::Variable.

◆ set() [1/2]

template<class T>
void Aqua::InputOutput::ScalarVariable< T >::set ( T & value,
bool synced = true )
inline

Set variable value.

This is a blocking operation, that will retain the program until the underlying variable event is complete.

Parameters
valueNew value
syncedtrue if the operation shall block the execution until the variable events are dispatched
Here is the call graph for this function:

◆ set() [2/2]

template<class T>
void Aqua::InputOutput::ScalarVariable< T >::set ( void * ptr,
bool synced = true )
inlinevirtual

Set variable from memory.

This is a blocking operation, that will retain the program until the underlying variable event is complete.

Parameters
ptrMemory to copy
syncedtrue if the operation shall block the execution until the variable events are dispatched

Reimplemented from Aqua::InputOutput::Variable.

Here is the call graph for this function:

◆ setFromPythonObject()

template<class T>
virtual bool Aqua::InputOutput::ScalarVariable< T >::setFromPythonObject ( PyObject * obj,
int i0 = 0,
int n = 0 )
pure virtual

Set the variable from a Python object.

Parameters
objPython object.
i0ignored parameter.
nignored parameter
Returns
false if all gone right, true otherwise.

Implemented in Aqua::InputOutput::DoubleVariable, Aqua::InputOutput::FloatVariable, Aqua::InputOutput::IntVariable, Aqua::InputOutput::LongVariable, Aqua::InputOutput::ScalarVecVariable< T >, Aqua::InputOutput::UIntVariable, and Aqua::InputOutput::ULongVariable.

◆ typesize()

template<class T>
size_t Aqua::InputOutput::ScalarVariable< T >::typesize ( ) const
inlinevirtual

Get the variable type size.

Returns
Variable type size (in bytes)

Reimplemented from Aqua::InputOutput::Variable.

◆ value() [1/2]

template<class T>
T Aqua::InputOutput::ScalarVariable< T >::value ( bool synced = true)
inline

Get the variable value.

Parameters
syncedtrue if the operation shall block the execution until the variable events are dispatched
Returns
Output value
Here is the call graph for this function:

◆ value() [2/2]

template<class T>
void Aqua::InputOutput::ScalarVariable< T >::value ( T & value,
bool synced = true )
inline

Set the variable value.

Parameters
syncedtrue if the operation shall block the execution until the variable events are dispatched
Returns
Output value
Here is the call graph for this function:

Field Documentation

◆ _value

template<class T>
T Aqua::InputOutput::ScalarVariable< T >::_value
protected

Variable value.


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