Vectors

A vector is a sequence of values, all of which must have the same type, with an ability to access elements of the sequence by an integer index. A vector has a size, from a minimum of 0 to a maximum of 2 billion entries.

Semantics and Operations

Vectors use semantics inherited from C: when accessing elements by index, the first position in the vector is index 0.

You can declare vectors in Global or Local blocks via the syntax:
vector(valueType) variable;
For instance, you can declare a vector holding 32-bit integers:
vector(integer) pos;

You can perform the following operations on vectors:

There is no command to copy a vector. Therefore, the only way to make a copy of a vector is manually, by iterating through the elements. You can also iterate through all the elements in the vector (up to the first null element) using a for loop.

While dictionaries and vectors can be defined globally, design and use global structures with care. Recall that ESP is multi-threaded. Therefore, when accessing a structure that can be modified from multiple threads, be aware that the state of the structure when you are accessing it may not actually be what you assume it to be. Also consider the impact on performance, particularly when iterating over data structures. As a CCL query or flex operator iterates over a data structure, the query or flex operator locks the structure, blocking other threads. Thus, performance degrades significantly with the number of concurrent queries iterating over the global structure.

Global use of these data structures should be limited to relatively static data (such as country codes) that will not need to be updated during processing, but will be read by multiple streams. Writing the data to the dictionary or vector must be completed before any streams read it.

All operations that read a global dictionary or vector should perform an isnull check, as shown in this example.
>typeof(streamname) rec := dict[symbol];
if( not (isnull(rec)) {
// use rec
}