inkcpp
Loading...
Searching...
No Matches
HInkGlobals Class Reference

Handle for the global variable store shared among ink runners. More...

#include <inkcpp.h>

Public Types

typedef void(* InkObserver) (InkValue new_value, InkValue old_value)
 

Public Member Functions

void ink_globals_delete (HInkGlobals *self)
 Deconstructs the globals store and frees all assoziated memories.
 
HInkSnapshotink_globals_create_snapshot (const HInkGlobals *self)
 Creates a snapshot for later reloading.
 
void ink_globals_observe (HInkGlobals *self, const char *variable_name, InkObserver observer)
 assignes a observer to the variable with the corresponding name.
 
InkValue ink_globals_get (const HInkGlobals *self, const char *variable_name)
 Gets the value of a global variable.
 
int ink_globals_set (HInkGlobals *self, const char *variable_name, InkValue value)
 Sets the value of a globals variable.
 

Detailed Description

Handle for the global variable store shared among ink runners.

Stores global variable values, visit counts, turn counts, etc.

Member Typedef Documentation

◆ InkObserver

typedef void(* InkObserver) (InkValue new_value, InkValue old_value)
Parameters
new_valuecontains the value newly assigned
old_valuecontains the previous value or a ValueTypeNone if the variable was previously unset.

Member Function Documentation

◆ ink_globals_create_snapshot()

HInkSnapshot * ink_globals_create_snapshot ( const HInkGlobals * self)

Creates a snapshot for later reloading.

Attention
All runners assoziated with the same globals will create the same snapshot. HInkSnapshot

◆ ink_globals_delete()

void ink_globals_delete ( HInkGlobals * self)

Deconstructs the globals store and frees all assoziated memories.

Attention
invalidates all assoziated HInkRunner

◆ ink_globals_get()

InkValue ink_globals_get ( const HInkGlobals * self,
const char * variable_name )

Gets the value of a global variable.

Parameters
variable_namename of variable (same as in ink script)
self
Return values
InkValue::Type::ValueTypeNoneiff the variable does not exist

◆ ink_globals_observe()

void ink_globals_observe ( HInkGlobals * self,
const char * variable_name,
InkObserver observer )

assignes a observer to the variable with the corresponding name.

The observer is called each time the value of the variable gets assigned. To monitor value changes compare the old with new value (see InkObserver)

◆ ink_globals_set()

int ink_globals_set ( HInkGlobals * self,
const char * variable_name,
InkValue value )

Sets the value of a globals variable.

Parameters
variable_namename of variable (same as in ink script)
self
value
Returns
false if the variable was not set, because the variable with this name does no exists or the value did not match.

The documentation for this class was generated from the following file: