GlobalVariable :: create - Create Global variable
A global property with the name of the global variable will be created, i.e. global variable name will be set as property name in the global property handle(propertyDefinition().name()). Since name of the property cannot be changed for subordinated properties, a transient property will be created in this case and set to the property passed.
Global variables created are available in the thread in which they have been created, only. When a global variable with the given name already exists, the function replaces the variable with the property passed.
// fragment
GlobalVariable userName("userName");
GlobalVariable userAge("age");
userName.create(Value("Paul")); // creates a string variable
if ( !userAge.exist() ) // create only, when not yet created
userAge.create(Value(20)); // creates an integer variable
A global variables is an odaba::Property, which may be accessed by name in the application context. When running multiple thread applications, each thread has its global variable list.
Implementation overview
- Create global Variable from property handle
GlobalVariable :: create ( cProperty ) - Create global Variable from value handle
GlobalVariable :: create ( cValue )
Implementation details
-
Create global Variable from property handle
odaba::GlobalVariable & GlobalVariable  :: create ( odaba::Property &cProperty )
The property handle passed in cProperty is used as pattern for setting the global variable. When passing an invalid property handle, the function throws an exception.
- cProperty
- Property reference
A property handle refers to a (usually) opened property. Invalid properties may cause an exception.
to list
- cProperty
- Property reference
-
Create global Variable from value handle
odaba::GlobalVariable & GlobalVariable  :: create ( odaba::Value &cValue )
The value handle passed in cValue is used as pattern for creating the global variable. When passing an invalid value handle, the function throws an exception.
- cValue
- Value handle
A value handle refers to a (usually) opened value. Invalid value handles may cause an exception.
to list
- cValue
- Value handle