DataGroup Object Class


Overview

The DataGroup object class is used to build groups of related objects. This feature is especially useful for transferring groups of data between different views. For example, in a bar chart with multiple bars, a related group of data objects could be plotted simultaneously against the same axis and share the same label(s). The DataGroup object lets you:

A set of function calls can be used to manipulate ranges of data within specified arrays or individual data points in any array. You can also extend, replace, or shift data in an array.


Inherited Resources and Behavior

The DataGroup object class does not inherit behavior and resources from other classes.
The following resources are defined by the DataGroup object class:
NameTypeDefaultAccess
XmNhistoryLengthint0CSG
XmNlastViewDestroyBooleanTrueCSG
XmNlimitsXXintLimits *NULLCSG
XmNlimitsYXintLimits *NULLCSG
XmNlimitsZXintLimits *NULLCSG


XmNhistoryLength

This resource (not implemented yet) will allow you to specify the number of editing changes that can be saved to the history buffer for the current group. For example, if this number is set to five, the history buffer will save up to the last five editing changes. A special Undo feature will allow you to retrieve any set of historical changes and restore the data to that stage in the editing process.

XmNlastViewDestroy

Specifies whether or not to automatically destroy the data group when there are no more views connected to it. The DataGroup object will automatically change the value of resource XmNlastViewDestroy for every data object inserted into the group to match its own value.

XmNlimitsX, XmNlimitsY, XmNlimitsZ

These resources let you limit the range of displayed data in the entire group to a certain limit in the X, Y, and/or Z direction. If not specified, the range of interest is set by default to the actual minimum and maximum values of data in the data group.

The minimum/maximum limits are defined through the data structure XintLimits, which takes the following form:

   typedef struct {
                   float      minimum;
                   float      maximum;
   } XintLimits;

where:

MemberDescription
minimumMinimum value of data in the group.
maximumMaximum value of data in the group.


Callback Structure

The callback XmNupdateCallback is used to provide notification of changes to any of the data objects contained in the group. The callback structure takes the following form:

   typedef struct {
                   int         reason;
                   XEvent      *event;
                   Object      object;
                   union {
                          XintDataUpdateCallbackStruct        *data;
                          XintDataSampledUpdateCallbackStruct *sampled;
                          XintDataSeriesUpdateCallbackStruct  *series;
                          XintDataGridUpdateCallbackStruct    *grid;
                   } callback_struct;
   } XintDataGroupUpdateCallbackStruct;

This particular callback is especially convenient because it provides notification of updates to any child of the group, regardless of the data object type. Callback XmNupdateCallback and update callbacks structures are also provided for each separate data object type (e.g., XintDataSeriesUpdateCallbackStruct), but it is more convenient to use a single callback for the whole group than trying to install update notification for each member of the group.

The callback indicates which type of object was modified and why. This information can help optimize the redrawing and updating of the window. The following ordered table lists members of XintDataGroupUpdateCallbackStruct in their required sequence:

Data TypeMemberDescription
intreasonIndicates why the callback was invoked (see discussion below).
XEvent *eventStandard member of a Motif callback structure not used in this context (will always be NULL).
ObjectobjectID of the updated object.
XintDataLabelCallbackStruct *labelIndicates what update was performed if object is a DataLabel object..
XintDataSampledUpdateCallbackStruct *sampledIndicates what update was performed if object is a DataSampled object.
XintDataSeriesUpdateCallbackStruct *seriesIndicates what update was performed if object is a DataSeries object.
XintDataGridUpdateCallbackStruct *gridIndicates what update was performed if object is a DataGrid object.

The callback structure includes information explaining the reason why a particular update occurred. The possible reasons returned by this callback are:

ReasonDescription
XintCR_DATA_BATCHA batch update has been performed and any number of changes on the objects in the group could have happen. No information about the changes is available in the callback structure.
XintCR_DATA_GROUP_INSERT_CHILDChild was inserted using the XmNDataGroup resource of the child. The ID of the data object that was inserted is set in member object.
XintCR_DATA_GROUP_DELETE_CHILDChild was deleted through external command (e.g., XtDestroy). The ID of the data object that was destroyed is set in member object.
XintCR_DATA_GROUP_UPDATE_CHILDChild object was updated. Information about the type of update is available in callback structure (use member label if object is a DataLabel, use member sampled if object is a DataSampled, etc.)


Functions

The following functions are defined for creating and manipulating groups of data objects.

Function NameDescription
XintCreateDataGroupCreates a data group.
XintDataBatchUpdateTo turn on/off propagation of updates to views.
XintDataRangeXDetermines the total range of data in the X direction.
XintDataRangeYDetermines the total range of data in the Y direction.
XintDataRangeZDetermines the total range of data in the Z direction.
XintDataGroupFindFinds a data object of a certain name in a data group.
XintDataGroupIterateRetrieves the nth data object of a specified class from a data group.


XintCreateDataGroup

This function creates a data group of a certain name with a list of associated resource values.

     Object XintCreateDataGroup (...)

Widgetparent Name of the parent DataObject widget containing this new data group.
char *nameName of the new data group.
ArgListarglistList of resources to be set for the new data group.
CardinalargcountTotal number of resources set by arglist.


XintDataBatchUpdate

This function enables you to allow or disallow propagation of updates to the views of a data group. This function can be used to batch multiple updates in a data group to minimize flashing. To batch updates, first call this function with state flag set to True, perform the changes on the members of the data group, then call this function again with state flag set to False.

     Object XintDataBatchUpdate (...)

ObjectdataID of the data object (usually a data group).
BooleanstateSet to True to freeze updates. Set to False to allow updates.


XintDataRangeX, XintDataRangeY, XintDataRangeZ

These functions determine the total range of data for all objects in a group (i.e., the minimum and maximum values represented in all data arrays). This is useful for determining the length, end points, and increments along an axis that will be used to plot the objects. The function returns False if there are not enough samples to compute a maximum and minimum (ie, if there are no samples or all samples are set to null values).

   Boolean XintDataRangeX (...)
   Boolean XintDataRangeY (...)
   Boolean XintDataRangeZ (...)

ObjectobjectObject ID of the data group to be examined.
floatminimumMinimum value in the data range.
floatmaximumMaximum value in the data range.


XintDataGroupFind

This function lets you specify a data group and find an object by name. For instance, if you named an object MyData and inserted it into a group, you could retrieve it by name.

     Object XintDataGroupFind (...)

ObjectobjectObject ID of the data group to be searched.
char *nameName of object to be found.
Objectcontext Normally NULL, but can be used to search for multiple objects with the same name (e.g., if called with NULL and return value is not NULL, it uses the return value as the context argument of the next call).


XintDataGroupIterate

This function retrieves a specific type of data object from a group by index number. You can retrieve a series of objects of the same type by starting at index 0 and iterating on index numbers. The function returns NULL if no more objects are available to be retrieved.

     Object XintDataGroupIterate (...)

ObjectobjectID of the data group.
ObjectClassdata_classClass name of the data object class to be retrieved (e.g., xintDataSampledObjectClass). Specify NULL to retrieve data objects from any type.
intindexIndex number of the data object to be retrieved.


Macros

Macro XintIsDataGroup returns True if the specified object is a DataGroup object.

     Boolean XintIsDataGroup (Object object)