company logo

GlobalVariable :: GlobalVariable - Create global variable

Global variables are created with their variable name. When a global variable has not yet got a value, the global variable remains invalid. It can be reopened any time by calling refresh() .

Implementation overview

Implementation details

  1. Create global variable by name
    GlobalVariable  :: GlobalVariable ( odaba::String &sGlobalVariable )

    The constructor creates a global variable by name. When the global variable has not yet been created, the global variable remains invalid. create() might be called in order to create the global variable for the thread.

      GlobalVariable    userName("userName");

      if ( !userName.isValid() )

        userName.create(Value(""));

      userName.value() = "Paul";

    • sGlobalVariable - Name for global variable

      The global variable name refers to a thread global variable. Global variable names must be unique within a thread or process.

      In order to pass no variable name, an empty string ( String () ) may be passed.

  2. to list
  3. Create global variable from value
    GlobalVariable  :: GlobalVariable ( odaba::Value &cValue )

    The function creates a global variable for the value passed in cValue . The name for the global variable is extracted from the property definition ( PropertyDefinition ::name() ). When a global variable with this name already exists or when the value handle is not valid, the function throws an exception.

    • cValue - Value handle

      A value handle refers to a (usually) opened value. Invalid value handles may cause an exception.

  4. to list