GLG Toolkit, C / C++ API Library  Version 4.5
Performance Optimization

Resource Access Optimization, C Version

If NULL is passed as the resource_name parameter of functions for setting and querying resources, the data object supplied by the object parameter will be used directly, avoiding an overhead of a resource search. This can be used to optimize performance when the same resource is accessed repeatedly. The GlgGetResourceObject function of the Intermediate API may be used to obtain an object ID of a data object once and then use it repeatedly.

For example:

// Store a data object for repeated use.
GlgObject data_obj = GlgGetResourceObject( viewport, "WaterTank/Level" );
...
// Use the stored data object to update the drawing with data.
if( data_obj )
GlgSetDResource( data_obj, NULL, new_water_level_value );
struct GlgObjectData * GlgObject
Opaque GlgObject type that represents all GLG objects in the GLG C API.
Definition: GlgApi.h:3376
GlgObject GlgGetResourceObject(GlgObject parent, char *resource_name)
Retrieves an object ID of a resource object.
GlgBoolean GlgSetDResource(GlgObject object, char *resource_name, double value)
Sets a new value of a D (double) resource.

The GlgAddDataSampleNode function of the Intermediate API can also be used instead of setting values of chart entry points to prefill a chart with a large number of data samples.

Resource Access Optimization, C++ Version

If NULL is passed as the resource_name parameter of functions for setting and querying resources, the data object supplied by the object parameter will be used directly, avoiding an overhead of a resource search. This can be used to optimize performance when the same resource is accessed repeatedly. The GetResourceObject function of the Intermediate API may be used to obtain an object ID of a data object once and then use it repeatedly.

For example:

// Store a data object for repeated use.
GlgObjectC data_obj = viewport.GetResourceObject( "WaterTank/Level" );
...
// Use the stored data object to update the drawing with data.
if( !data_obj.IsNull() )
data_obj.SetDResource( NULL, new_water_level_value );
The main class of the GLG C++ bindings.
Definition: GlgClass.h:606
GlgObject GetResourceObject(char *resource_name)
Find a resource object.
GlgBoolean SetDResource(char *resource_name, double value)
Sets a new value of a D (double) resource of this object.
GlgBoolean IsNull(void)
Checks if a non-null object is stored in this instance.

The GlgAddDataSampleNode function of the C Intermediate API can also be used instead of setting values of chart entry points to prefill a chart with a large number of data samples.