![]() |
![]() |
![]() |
![]() |
select_array
Synopsis
module _select_array {
boolean+notify+read _select[];
group+notify+read *array_input[];
group+write _*array_output[];
};Description
The select_array module inputs an array of pointers to groups and a parallel array of booleans. If the boolean is set for a particular element of the input array, this element is added to the output array. Thus the output array of groups will contain a subset of the groups in the input array. The size of the output array is equal to the number of "true" values in the select array.
This module runs whenever the select array's value changes or when elements are added to or deleted from the array_input array. The module does not run when subobjects of the elements pointed to by array_input change.
Input
Specifies an array of booleans that defines which elements of the array_input array are to be placed into the array_output array. If the array_input array is smaller or larger than the select array, only the array elements that overlap are processed.
Specifies the list of array objects to be processed. The array must be a one-dimensional array of groups, but the groups themselves can be of any type.
Output Port
Example
group foo[3] {
int a => index_of(foo);
};
int sel_array[3] = {0,1,1};
GMOD.select_array sel { // foo[1] and foo[2] in array_output
select => sel_array;
array_input => foo;
};
![]() |
![]() |
![]() |
![]() |