Variables manager, which can interpret the types on the fly.
More...
#include <Variable.hpp>
Variables manager, which can interpret the types on the fly.
◆ Variables()
Aqua::InputOutput::Variables::Variables |
( |
| ) |
|
◆ ~Variables()
Aqua::InputOutput::Variables::~Variables |
( |
| ) |
|
◆ allocatedMemory()
size_t Aqua::InputOutput::Variables::allocatedMemory |
( |
| ) |
|
Get the allocated memory.
- Returns
- Allocated memory on device. Just the arrays can contribute to this value.
◆ exprVariables()
std::vector< Variable * > Aqua::InputOutput::Variables::exprVariables |
( |
const std::string & | expr | ) |
|
◆ get() [1/2]
Variable * Aqua::InputOutput::Variables::get |
( |
const std::string | name | ) |
|
Get a variable.
- Parameters
-
name | Name of the variable. |
- Returns
- Variable, NULL if the variable cannot be found.
◆ get() [2/2]
Variable * Aqua::InputOutput::Variables::get |
( |
unsigned int | index | ) |
|
Get a variable.
- Parameters
-
index | Index of the variable. |
- Returns
- Variable, NULL if the variable cannot be found.
◆ getAll()
std::vector< Variable * > Aqua::InputOutput::Variables::getAll |
( |
| ) |
const |
|
inline |
Get all the registered variables.
- Returns
- Variable, NULL if the variable cannot be found.
◆ isSameType()
bool Aqua::InputOutput::Variables::isSameType |
( |
const std::string | type_a, |
|
|
const std::string | type_b, |
|
|
bool | ignore_asterisk = true ) |
|
static |
Get if two types strings are the same one.
- Parameters
-
type_a | First type name. |
type_b | Second type name. |
ignore_asterisk | true to ignore the asterisk of arrays. |
- Returns
- true if it is the same type, false otherwise.
◆ populate() [1/2]
void Aqua::InputOutput::Variables::populate |
( |
const std::string | name = "" | ) |
|
Populate variables in order that the tokenizer may get the updated value.
- Parameters
-
name | Name of the variable to be populated, "" if all the variables should be populated. |
◆ populate() [2/2]
void Aqua::InputOutput::Variables::populate |
( |
Variable * | var | ) |
|
Populate a variable in order that the tokenizer may know the updated value.
- Parameters
-
◆ registerVariable()
void Aqua::InputOutput::Variables::registerVariable |
( |
const std::string | name, |
|
|
const std::string | type, |
|
|
const std::string | length, |
|
|
const std::string | value ) |
Register a new variable.
- Parameters
-
name | Name of the variable. |
type | Type of the variable. |
length | Array length, 1 for scalars, 0 for arrays that will not be allocated at the start (for instance the heads of chains, which requires the number of cells). |
value | Variable value, NULL for arrays. It is optional for scalar variables. |
◆ size()
unsigned int Aqua::InputOutput::Variables::size |
( |
| ) |
const |
|
inline |
Get the number of variables.
- Returns
- Number of registered variables.
◆ solve()
void Aqua::InputOutput::Variables::solve |
( |
const std::string | type_name, |
|
|
const std::string | value, |
|
|
void * | data, |
|
|
const std::string | name = "NULL" ) |
Solve a string, interpreting the variables.
- Parameters
-
type_name | Type of the output desired value. |
value | Expression to evaluate. |
data | Allocated memory where the result should be stored. |
name | Variable name to register in the tokenizer. |
- Note
- typeToBytes(type) bytes should be allocated in data.
◆ typeAlias()
std::string Aqua::InputOutput::Variables::typeAlias |
( |
const std::string & | t | ) |
|
|
static |
Resolve some type aliases.
Several types have aliases to make them easier to use, which might depend on the device arch:
- "int32" = "int"
- "int64" = "long"
- "uint32" = "unsigned int"
- "uint64" = "unsigned long"
- "size_t" = Either "unsigned int" or "unsigned long"
- "ssize_t" = Either "int" or "long"
- "svec" = Either "uivec" or "ulvec"
- "svec2" = Either "uivec2" or "ulvec2"
- "svec3" = Either "uivec3" or "ulvec3"
- "svec4" = Either "uivec4" or "ulvec4"
- "svec8" = Either "uivec8" or "ulvec8"
- "ssvec" = Either "ivec" or "lvec"
- "ssvec2" = Either "ivec2" or "lvec2"
- "ssvec3" = Either "ivec3" or "lvec3"
- "ssvec4" = Either "ivec4" or "lvec4"
- "ssvec8" = Either "ivec8" or "lvec8"
- Parameters
-
- Returns
- Base type
- See also
- Aqua::CalcServer::CalcServer::device_addr_bits()
◆ typeToBytes()
size_t Aqua::InputOutput::Variables::typeToBytes |
( |
const std::string | type | ) |
|
|
static |
Convert a type name to bytes.
- Parameters
-
- Returns
- Type size in bytes, 0 if the type is not recognized.
◆ typeToN()
unsigned int Aqua::InputOutput::Variables::typeToN |
( |
const std::string | type | ) |
|
|
static |
Get the number of components of a type name.
- Parameters
-
- Returns
- Number of components (1 for not recognized types).
The documentation for this class was generated from the following files: