GlobalVariable - Global variables
Global variables are supported in order to provide dynamic thread global property handles. A global variable created once remains, until the application finishes or it is removed explicitly.
All global variables defined in OSI expressions can be accessed as global variables from within the application or reverse. Thus, global variables can also be used in order to pass data between the application and OSI expressions.
In case of multi thread applications, global variables are defined separately for each thread and must be unique for each thread, only.
When being opened successfully, the global variable is a valid property handle and Property functions might be called in order to access data of the variable. In order to get the global variable value, value() might be called. Since global variables may change the value, but also the property, the application might call GlobalVariable::provide() before accessing the property. There is no problem calling provide() several times, also, when the variable does not change.
When the property for a global variable has been set once, the specification cannot change, but the content (value), only. In order to replace a global variable by a global variable with another specification, the variable has to be removed before. (remove()).
// C++ fragment
GlobalVariable userName("UserName");
// ...
userName.provide(); // should have been defined already
if ( userName.value() == "Paul" ) // check current user name
// ... do something
// OSI fragment (instead of global, extern may be used
VARIABLES
global string userName; // is created on demand
PROCESS
userName = %USER_NAME%; // set global variable to option value
- 1. Administration - Administration functions
- 2. Properties - Global variable properties
- GlobalVariable - Create global variable
- create - Create Global variable
- exist - Does global variable exist
- name - Name property for global variable
- refresh - Refresh global variable
- remove - Remove global variable
- ~GlobalVariable - Destructor