Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Chart User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

8.4 Structure Data Model

The Standard and Dynamic data models store the chart's data in special objects that are created and destroyed automatically (more or less) by the main chart object. In this sense, these data objects are internal to the chart system.

Objective Chart also supports more general data access from external memory buffers.

Data logging applications, for example, often acquire measurements of a fixed number of variables repeatedly over time. They store all the measurements from one observation cycle in a block or structure, followed by a similar block for the next observation. The values of the different variables often require different storage space. The resulting data buffer can be thought of as an array of structures, where each structure contains the various data types required for all the variables.

The Structure data model provides access to data within this external array of structures. The data values for a selected variable can be accessed in situ. No replication or movement of the data is required.

This concept of an array of structures is quite general. The structure can be a single variable of a simple data type. Or, it can be an array itself— even a multidimensional array. The details of the Structure data model are presented in the following topics.


Any memory block in which the data values to be plotted are uniformly spaced in memory is a candidate for access using the Structure model.

8.4.1 SRGStructureData

SRGStructureData is an abstract class that forms the basis of the Structure data storage model. Derived from SRGraphDynamicData, SRGStructureData provides a same set of methods for extracting data from any array of structures. The same data access functions are used regardless of the memory model used.

SRGStructureData maintains a set of pointers and indices that are used to access the data. These members are shown in Figure 120.

Figure 120: The SRGStructureData object

The following example illustrates how these variables are used to access data in a memory block. The code below defines a simple C++ structure, MyStruct.

An array of these structures would produce the memory block that is shown in Figure 121.

Figure 121: How SRGStructureData accesses memory

After initialization:

8.4.2 Data-type Specific Classes

SRGStructureData is an abstract class. A class derived from SRGStructureData must be used to access the memory block. Objective Chart assumes that all data to be plotted is a double precision floating-point number, but the members of the structure may be of any numeric data type. Therefore, several classes, based upon SRGStructureData, are provided to handle various data types.

The following derived classes are provided:

Classes to extract other data types can be derived by simply adding new overloads of the GetValue() and SetValue() functions, following the example shown by these classes. The Chart AppWizard can create a skeleton implementation for new Structure data classes.

8.4.3 Structure Model Features

The Structure data model has these features:

8.4.4 Using the Structure Model

To initialize a chart using the Structure data storage model:

  1. Create an SRGraph or SRDynamicGraph object in your application.

  2. Create an SRGraphDataList object for the desired group.

  3. Create and initialize a Structure data object.

  4. Add the prepared Structure data object to the SRGraphDataList object of the selected group.

Once configured, the Structure data buffer can be accessed with the same GetValue() and SetValue() functions that are used in the Standard model. Different Structure classes are provided for a variety of data types. In addition, the SetValue() and GetValue() functions of the Structure data classes can be used for more direct, sequential access.

Integrating these classes with the Objective Chart system is simple. Continuing the MyStruct example, the following code sets up an SRGIntStructData object to display the temperature member of the MyStruct structure.

Now the chart components can read integers from the external memory block and plot them on the screen. The ExData sample application demonstrates the use of the Structure data classes.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.