This module contains API functions to handle the scope of variables.
More...
This module contains API functions to handle the scope of variables.
◆ svm_variable_scope_is_global()
◆ svm_variable_scope_is_local()
◆ svm_variable_scope_is_shared()
This function checks whether a variable is shared.
- Parameters
-
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | variable | The variable to check. |
- Returns
- TRUE when the variable is shared, FALSE otherwise.
- Exceptions
-
FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.) |
- See also
- svm_variable_scope_set_shared
-
svm_variable_scope_reset_shared
◆ svm_variable_scope_reset_shared()
This function alters the scope of the given variable.
- Parameters
-
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | variable | The variable to downgrade as regular variable. |
When a variable is reset as regular, svm_variable_scope_set_global and svm_variable_scope_set_local API function calls become idempotents. If svm_variable_scope_set_global is called several times on the same variable, only one call to svm_variable_scope_set_local will set the variable as local.
- Exceptions
-
FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.) |
- See also
- svm_variable_scope_set_global
-
svm_variable_scope_set_local
◆ svm_variable_scope_set_global()
This function alters the scope of the given variable.
- Parameters
-
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | variable | The variable to upgrade as global variable. |
This variable becomes visible in all further callbacks of the plugin, until either svm_variable_scope_set_local or svm_variable_delete is called on the same variable.
The object associated to this variable is also kept alive when its scope is set global.
- Exceptions
-
FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.) |
◆ svm_variable_scope_set_local()
This function alters the scope of the given variable.
- Parameters
-
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | variable | The variable to downgrade as local variable. |
This variable becomes visible only in the current callback of the plugin, unless svm_variable_scope_set_global is called on the same variable before the end of the callback.
The object associated to this variable may be deleted when the callback reaches its end.
- Note
- This scope is the default one. This allows automatic clean-up of all transient values created during a plugin callback call.
- Exceptions
-
FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.) |
◆ svm_variable_scope_set_shared()
This function alters the scope of the given variable.
- Parameters
-
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | variable | The variable to upgrade as shared variable. |
When a variable is set as shared, svm_variable_scope_set_global and svm_variable_scope_set_local API function calls are no longer idempotents. If svm_variable_scope_set_global is called several times on the same variable, it will require the same number of calls to svm_variable_scope_set_local to set the variable as local.
This mechanism allows a variable to be shared by several C/C++ structures within a plugin.
- Note
- If the variable is already global when passed to shared, all previous calls to svm_variable_scope_set_global are counted as one unique call.
- Exceptions
-
FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.) |
- See also
- svm_variable_scope_set_global
-
svm_variable_scope_set_local