Common Pipeline Library Reference 7.3.2
|
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_iterator * | cpl_frameset_iterator_duplicate (const cpl_frameset_iterator *other) |
Create a frame set iterator from an existing frame set iterator. | |
cpl_frame * | cpl_frameset_iterator_get (cpl_frameset_iterator *self) |
Get the frame from the frame set at the current position of the iterator. | |
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. | |
cpl_frameset_iterator * | cpl_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. | |
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 struct _cpl_frameset_iterator_ cpl_frameset_iterator |
The frame set iterator data type.
This data type is opaque.
cpl_error_code cpl_frameset_iterator_advance | ( | cpl_frameset_iterator * | self, |
int | distance | ||
) |
Advance an iterator by a number of elements.
self | The frame set iterator to reposition. |
distance | The of number of elements by which the iterator is moved. |
CPL_ERROR_NONE
on success, or an appropriate CPL error code otherwise.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_error_code cpl_frameset_iterator_assign | ( | cpl_frameset_iterator * | self, |
const cpl_frameset_iterator * | other | ||
) |
Assign a frame set iterator to another.
self | The frame set iterator to assign to. |
other | The frame set iterator to be assigned. |
CPL_ERROR_NONE
on success, or an appropriate CPL error code otherwise.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.
void cpl_frameset_iterator_delete | ( | cpl_frameset_iterator * | self | ) |
Destroy a frame set iterator.
self | The frame set to destroy. |
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().
int cpl_frameset_iterator_distance | ( | const cpl_frameset_iterator * | self, |
const cpl_frameset_iterator * | other | ||
) |
Calculate the distance between two iterators.
self | First frame set iterator. |
other | Second frame set iterator. |
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 * cpl_frameset_iterator_duplicate | ( | const cpl_frameset_iterator * | other | ) |
Create a frame set iterator from an existing frame set iterator.
other | The frame set iterator to clone. |
NULL
otherwise.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_frame * cpl_frameset_iterator_get | ( | cpl_frameset_iterator * | self | ) |
Get the frame from the frame set at the current position of the iterator.
self | The frame set iterator to dereference. |
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).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().
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.
self | The frame set iterator to dereference. |
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).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 * cpl_frameset_iterator_new | ( | const cpl_frameset * | parent | ) |
Create a new frame set iterator.
parent | The frame set for which the iterator is created. |
NULL
if an error occurred.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.
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().
void cpl_frameset_iterator_reset | ( | cpl_frameset_iterator * | self | ) |
Reset a frame set iterator to the beginning of a frame set.
self | The iterator to reposition. |
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.
Referenced by cpl_dfs_setup_product_header().