Provides the C-style interface for ioda::Has_Variables objects.
More...
|
IODA_DL void | ioda_has_variables_destruct (struct ioda_has_variables *has_vars) |
| Deallocates a ioda_has_variables. More...
|
|
IODA_DL struct ioda_string_ret_t * | ioda_has_variables_list (const struct ioda_has_variables *) |
| List the names of the variables associated with an object. More...
|
|
IODA_DL int | ioda_has_variables_exists (const struct ioda_has_variables *has_vars, size_t sz_name, const char *name) |
| Check if a variable exists. More...
|
|
IODA_DL bool | ioda_has_variables_remove (struct ioda_has_variables *has_vars, size_t sz_name, const char *name) |
| Remove a variable. More...
|
|
IODA_DL struct ioda_variable * | ioda_has_variables_open (const struct ioda_has_variables *has_vars, size_t sz_name, const char *name) |
| Open (access) a variable by name. More...
|
|
ioda_string_ret_t * | ioda_has_variables_list (const ioda_has_variables *vars) |
|
int | ioda_has_variables_exists (const ioda_has_variables *vars, size_t sz, const char *name) |
|
ioda_variable * | ioda_has_variables_open (const ioda_has_variables *vars, size_t sz, const char *name) |
|
| C_TEMPLATE_FUNCTION_DEFINITION (ioda_has_variables_create, IODA_HAS_VARIABLES_CREATE_IMPL) |
|
Provides the C-style interface for ioda::Has_Variables objects.
◆ IODA_HAS_VARIABLES_CREATE_IMPL
#define IODA_HAS_VARIABLES_CREATE_IMPL |
( |
|
funcnamestr, |
|
|
|
Type |
|
) |
| |
Value:
const char*
name,
size_t n_dims,
const long* dims, \
const long* max_dims, \
ioda_variable*
res =
nullptr; \
C_TRY; \
Expects(has_vars != nullptr); \
Expects(
name !=
nullptr); \
Expects(dims != nullptr); \
Expects(max_dims != nullptr); \
std::vector<ioda::Dimensions_t> vdims(n_dims); \
for (
size_t i = 0;
i < n_dims; ++
i) vdims[
i] = (ioda::Dimensions_t)dims[
i]; \
std::vector<ioda::Dimensions_t> vmaxdims(n_dims); \
for (
size_t i = 0;
i < n_dims; ++
i) vmaxdims[
i] = (ioda::Dimensions_t)max_dims[
i]; \
Expects(
res !=
nullptr); \
res->var \
C_CATCH_RETURN_FREE(
res,
nullptr,
res); \
}
virtual Variable create(const std::string &name, const Type &in_memory_dataType, const std::vector< Dimensions_t > &dimensions={1}, const std::vector< Dimensions_t > &max_dimensions={}, const VariableCreationParameters ¶ms=VariableCreationParameters())
Create a Variable without setting its data.
#define IODA_DL
A preprocessor tag that indicates that a symbol is to be exported/imported.
Definition at line 66 of file Has_Variables_c.cpp.
◆ C_TEMPLATE_FUNCTION_DEFINITION()
◆ ioda_has_variables_destruct()
◆ ioda_has_variables_exists() [1/2]
int ioda_has_variables_exists |
( |
const ioda_has_variables * |
vars, |
|
|
size_t |
sz, |
|
|
const char * |
name |
|
) |
| |
◆ ioda_has_variables_exists() [2/2]
Check if a variable exists.
- Parameters
-
[in] | has_vars | is the base container of the variables. |
- See also
- ioda_group_vars to get the variable container from a group.
- Parameters
-
[in] | name | is the candidate variable name. |
| sz_name | is strlen(name). Needed for Fortran compatability. |
- Returns
- 1 if the variable exists.
-
0 if the variable does not exist.
-
-1 on failure, such as when a precondition is invalid.
- Precondition
- has_vars must be valid.
-
name must be valid.
◆ ioda_has_variables_list() [1/2]
◆ ioda_has_variables_list() [2/2]
List the names of the variables associated with an object.
◆ ioda_has_variables_open() [1/2]
◆ ioda_has_variables_open() [2/2]
Open (access) a variable by name.
- Parameters
-
[in] | has_vars | is the container of the variable. |
[in] | name | is the variable name. |
| sz_name | is strlen(name). Fortran compatability. |
- Returns
- A handle to the variable on success.
-
NULL on error.
- Precondition
- has_vars must be valid.
-
name must be a valid variable name. The variable must exist.
◆ ioda_has_variables_remove()
bool ioda_has_variables_remove |
( |
struct ioda_has_variables * |
has_vars, |
|
|
size_t |
sz_name, |
|
|
const char * |
name |
|
) |
| |
Remove a variable.
- Parameters
-
[in] | has_vars | is the container of the variable. |
[in] | name | is the variable name. |
| sz_name | is strlen(name). Fortran compatability. |
- Returns
- true if the variable is successfully removed.
-
false on error.
- Precondition
- has_vars must be valid.
-
name must be a valid variable name. The variable must exist.
-
The variable must not be opened (have a valid handle) elsewhere.
- Postcondition
- The variable no longer exists.
Definition at line 46 of file Has_Variables_c.cpp.