Mission Base

Program Base Library Functions

int pblCollectionAggregate

( PblCollection* collection,
  void* context,
  int (* aggregation ) ( void* context,
  int index, void* element ) )

Aggregates a collection by calling the aggregation function on every element of the collection while running through the collection with an iterator.

Documentation

Aggregates a collection by calling the aggregation function on every element of the collection while running through the collection with an iterator.

The application context supplied is passed to the aggregation function for each element.

If the aggregation function for an element returns a value > 0, the aggregation is terminated immediately and the return value of the aggregation function is given back to the caller.

Otherwise the aggregation is continued to the next element of the collection until the iterator reaches its end.

This method has a time complexity of O(N), with N being the size of the collection.

Parameters:
collection - The collection to aggregate.
context - The application context to pass to the aggregation function.
aggregation - The aggregation function called on every collection element.
context - The application context passed.
index - The index of the element passed.
element - The collection element to aggregate.
Returns:
int rc > 0: The aggregation was terminated with the return code of the aggregation function.
int rc == 0: The aggregation succeeded, all elements where aggregated.
int rc < 0: An error, see pbl_errno:
PBL_ERROR_PARAM_COLLECTION - The collection cannot be iterated.
PBL_ERROR_CONCURRENT_MODIFICATION - The collection was modified concurrently.

Alphabetic index



This page was generated with the help of DOC++.