DataPool User Guide

Version 2.13 | Published November 30, 2018 ©

Arrays of Data Objects

When dealing with multiple instances of the object type, an array of object types can be defined. Defining an array of objects simplifies data management when sending the information to the different objects.

Sometimes there is a need to maintain lists of objects. An example could be the display of a histogram of stocks. Each Viz object is attributed a DataPool object. But in this case, it would be very unwise to give a name to each of the objects because the number of the objects may be unknown. DataPool solves this problem by providing with a means of array of objects. Like in the case of the single object, the array has an object type. When defined the array builds a set of objects as its children. This scheme is shown in the following figure:

images/download/attachments/41793866/architecture_dataobjects-array.png
In the figure, an array of stocks of size four is shown. As can be seen each of its children are named Stocks[0], Stocks[1], and so on. To enter data to the array element number 2:

Stocks[2]/Price=85.3;

If we want to enter information to the whole array:

Stocks[0-3]={
{Ticker=IBM;Price=85.26;},
{Ticker=SGI;Price=1.09;},
{Ticker=AOL;Price=14.71;},
{Ticker=AA;Price=23.85;},
};

Note: There are two sets of brackets in the above statement: One for the array itself and a second for the objects themselves. Also note that because this is an array, the objects are separated by commas rather than by semicolons.