Common Pipeline Library Reference 7.3.2
Loading...
Searching...
No Matches
Typedefs | Functions
Frame Set Iterators

Iterator support for frame sets. More...

Typedefs

typedef struct _cpl_frameset_iterator_ cpl_frameset_iterator
 The frame set iterator data type.
 

Functions

cpl_error_code cpl_frameset_iterator_advance (cpl_frameset_iterator *self, int distance)
 Advance an iterator by a number of elements.
 
cpl_error_code cpl_frameset_iterator_assign (cpl_frameset_iterator *self, const cpl_frameset_iterator *other)
 Assign a frame set iterator to another.
 
void cpl_frameset_iterator_delete (cpl_frameset_iterator *self)
 Destroy a frame set iterator.
 
int cpl_frameset_iterator_distance (const cpl_frameset_iterator *self, const cpl_frameset_iterator *other)
 Calculate the distance between two iterators.
 
cpl_frameset_iteratorcpl_frameset_iterator_duplicate (const cpl_frameset_iterator *other)
 Create a frame set iterator from an existing frame set iterator.
 
cpl_framecpl_frameset_iterator_get (cpl_frameset_iterator *self)
 Get the frame from the frame set at the current position of the iterator.
 
const cpl_framecpl_frameset_iterator_get_const (const cpl_frameset_iterator *self)
 Get the frame from the frame set at the current position of the iterator.
 
cpl_frameset_iteratorcpl_frameset_iterator_new (const cpl_frameset *parent)
 Create a new frame set iterator.
 
void cpl_frameset_iterator_reset (cpl_frameset_iterator *self)
 Reset a frame set iterator to the beginning of a frame set.
 

Detailed Description

Iterator support for frame sets.

Frame set iterators allow to access the contents of a frame set sequentially, in an ordered manner. An iterator is created for a particular frame set, and it stays bound to that frame set until it is destroyed. However multiple iterators can be defined for the same frame set.

By default, the order of frames in a frame set is the order in which the individual frames have been inserted. However, a particular sorting order can be defined by sorting the frame set using a custom comparison function for frames.

Frame set iterators are supposed to be short-lived objects, and it is not recommended to use them for keeping, or passing around references to the frame set contents. In particular, changing the contents of the underlying frame set by erasing, or inserting frames may invalidate all existing iterators.

Typedef Documentation

◆ cpl_frameset_iterator

typedef struct _cpl_frameset_iterator_ cpl_frameset_iterator

The frame set iterator data type.

This data type is opaque.

Function Documentation

◆ cpl_frameset_iterator_advance()

cpl_error_code cpl_frameset_iterator_advance ( cpl_frameset_iterator self,
int  distance 
)

Advance an iterator by a number of elements.

Parameters
selfThe frame set iterator to reposition.
distanceThe of number of elements by which the iterator is moved.
Returns
The function returns CPL_ERROR_NONE on success, or an appropriate CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The given iterator offset would move the iterator beyond the beginning or the end of the frame set.

The functions moves the iterator by distance number of elements, with respect to its current position. The number of elements distance may be negative or positive, and the iterator position will move backward and forward respectively.

It is an error if the given distance would move the iterator either past the one-before-the-beginning position or the one-past-the-end position of the underlying frame set. In this case the iterator is not repositioned and an out of range error is returned.

References CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_NONE, and CPL_ERROR_NULL_INPUT.

Referenced by cpl_dfs_setup_product_header(), cpl_dfs_sign_products(), cpl_frameset_dump(), cpl_frameset_extract(), cpl_frameset_labelise(), and cpl_imagelist_load_frameset().

◆ cpl_frameset_iterator_assign()

cpl_error_code cpl_frameset_iterator_assign ( cpl_frameset_iterator self,
const cpl_frameset_iterator other 
)

Assign a frame set iterator to another.

Parameters
selfThe frame set iterator to assign to.
otherThe frame set iterator to be assigned.
Returns
The function returns CPL_ERROR_NONE on success, or an appropriate CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameters self or other is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameters self and other are not bound to the same frame set.

The function assigns the iterator other to the iterator self. Only iterators which are bound to the same frame set can be assigned to each other!

References CPL_ERROR_ILLEGAL_INPUT, CPL_ERROR_NONE, and CPL_ERROR_NULL_INPUT.

◆ cpl_frameset_iterator_delete()

void cpl_frameset_iterator_delete ( cpl_frameset_iterator self)

Destroy a frame set iterator.

Parameters
selfThe frame set to destroy.
Returns
Nothing.

The function destroys the frame set iterator object self. If self is NULL, no operation is performed.

Referenced by cpl_dfs_setup_product_header(), cpl_dfs_sign_products(), cpl_frameset_dump(), cpl_frameset_extract(), cpl_frameset_labelise(), and cpl_imagelist_load_frameset().

◆ cpl_frameset_iterator_distance()

int cpl_frameset_iterator_distance ( const cpl_frameset_iterator self,
const cpl_frameset_iterator other 
)

Calculate the distance between two iterators.

Parameters
selfFirst frame set iterator.
otherSecond frame set iterator.
Returns
The function returns the distance between the two input iterators. If an error occurs, the function returns a distance of 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or other is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The two iterators iterators are not bound to the same frame set.
CPL_ERROR_DATA_NOT_FOUND At least one input iterator is invalid.

The function calculates the distance between the iterators self and other.

To properly detect whether this function has failed or not it is recommended to reset the errors before it is called, since the returned value is not a distinctive feature.

References CPL_ERROR_DATA_NOT_FOUND, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_frameset_iterator_duplicate()

cpl_frameset_iterator * cpl_frameset_iterator_duplicate ( const cpl_frameset_iterator other)

Create a frame set iterator from an existing frame set iterator.

Parameters
otherThe frame set iterator to clone.
Returns
A copy of the frame set iterator other on success, or NULL otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter other is a NULL pointer.

The function creates a copy of the iterator object other. An iterator copy constructed by this function is bound to the same frame set other has been constructed for, and it points to the same frame that other points to.

References CPL_ERROR_NULL_INPUT.

◆ cpl_frameset_iterator_get()

cpl_frame * cpl_frameset_iterator_get ( cpl_frameset_iterator self)

Get the frame from the frame set at the current position of the iterator.

Parameters
selfThe frame set iterator to dereference.
Returns
The frame stored in the frame set at the position of the iterator, or NULL if an error occurs. The function also returns NULL if the iterator is positioned at the sentinel element (i.e. the one-before-the-beginning or one-past-the-end position).
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function dereferences the iterator self, i.e. it retrieves the frame at the position pointed to by self.

References CPL_ERROR_NULL_INPUT.

Referenced by cpl_frameset_labelise().

◆ cpl_frameset_iterator_get_const()

const cpl_frame * cpl_frameset_iterator_get_const ( const cpl_frameset_iterator self)

Get the frame from the frame set at the current position of the iterator.

Parameters
selfThe frame set iterator to dereference.
Returns
The frame stored in the frame set at the position of the iterator or NULL if an error occurs. The function also returns NULL if the iterator is positioned at the sentinel element (i.e. the one-before-the-beginning or one-past-the-end position).
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function dereferences the iterator self, i.e. it retrieves the frame at the position pointed to by self.

References CPL_ERROR_NULL_INPUT.

Referenced by cpl_dfs_setup_product_header(), cpl_dfs_sign_products(), cpl_frameset_dump(), cpl_frameset_extract(), and cpl_imagelist_load_frameset().

◆ cpl_frameset_iterator_new()

cpl_frameset_iterator * cpl_frameset_iterator_new ( const cpl_frameset parent)

Create a new frame set iterator.

Parameters
parentThe frame set for which the iterator is created.
Returns
The newly allocated frame set iterator object, or NULL if an error occurred.
Errors
CPL_ERROR_NULL_INPUT The parameter parent is a NULL pointer.

The function creates a new iterator object bound to the frame set parent. The iterator is initialized such that it points to the beginning of parent.

The beginning is defined by the current ordering defined for the frame set parent.

See also
cpl_frameset_sort()

References CPL_ERROR_NULL_INPUT.

Referenced by cpl_dfs_setup_product_header(), cpl_dfs_sign_products(), cpl_frameset_dump(), cpl_frameset_extract(), cpl_frameset_labelise(), and cpl_imagelist_load_frameset().

◆ cpl_frameset_iterator_reset()

void cpl_frameset_iterator_reset ( cpl_frameset_iterator self)

Reset a frame set iterator to the beginning of a frame set.

Parameters
selfThe iterator to reposition.
Returns
Nothing.

The function moves the frame set iterator self back to the beginning of its underlying frame set. The first frame in the frame set is defined by the established sorting order.

See also
cpl_frameset_sort()

Referenced by cpl_dfs_setup_product_header().