WebSphere Message Service Client for C/C++, Version 2.0.2 Operating Systems: AIX, Linux, Solaris, Windows

Iterator

An iterator encapsulates a list of objects. An application uses an iterator to access object in turn.

Inheritance hierarchy:
None

An iterator also encapsulates a cursor that maintains the current position in the list. When an iterator is created, the position of the cursor is before the first object.

An application cannot create an iterator directly using a constructor. An iterator is created only by certain methods in order to pass a list of objects back to the application.

This class is a helper class.

Methods

Summary of methods:
Method Description
~Iterator Delete the iterator.
getHandle Get the handle that a C application would use to access the iterator.
getNext Move the cursor to the next object and get the object at the new position of the cursor.
hasNext Check whether there are any more objects beyond the current position of the cursor.
isNull Determine whether the Iterator object is a null object.
reset Move the cursor back to a position before the first object.

~Iterator – Delete Iterator

Interface:
virtual ~Iterator();

Delete the iterator.

If an application tries to delete an iterator that is already deleted, the call is ignored.

Parameters:
None
Thread context:
Any
Exceptions:
  • XMS_X_GENERAL_EXCEPTION

getHandle – Get Handle

Interface:
xmsHIterator getHandle() const;

Get the handle that a C application would use to access the iterator.

Parameters:
None
Returns:
The handle for the iterator.
Thread context:
Any
Exceptions:
  • XMS_X_GENERAL_EXCEPTION

getNext – Get Next Object

Interface:
xmsVOID * getNext() const;

Move the cursor to the next object and get the object at the new position of the cursor.

Parameters:
None
Returns:
A pointer to the object.
Note: Because the method returns a pointer to an object the application must release the object using the C++ delete operator.
Thread context:
Any
Exceptions:
  • XMS_X_GENERAL_EXCEPTION

hasNext – Check for More Objects

Interface:
xmsBOOL hasNext();

Check whether there are any more objects beyond the current position of the cursor. The call does not move the cursor.

Parameters:
None
Returns:
  • xmsTRUE, if there are more objects beyond the current position of the cursor.
  • xmsFALSE, if there are no more objects beyond the current position of the cursor.
Thread context:
Any
Exceptions:
  • XMS_X_GENERAL_EXCEPTION

isNull – Check Whether Null

Interface:
xmsBOOL isNull() const;

Determine whether the Iterator object is a null object.

Parameters:
None
Returns:
  • xmsTRUE, if the Iterator object is a null object.
  • xmsFALSE, if the Iterator object is not a null object.
Thread context:
Any
Exceptions:
  • XMS_X_GENERAL_EXCEPTION

reset – Reset Iterator

Interface:
xmsVOID reset();

Move the cursor back to a position before the first object.

Parameters:
None
Returns:
Void
Thread context:
Any
Exceptions:
  • XMS_X_GENERAL_EXCEPTION

Reference topic

Terms of Use | Rate this page

Last updated: 24 May 2011

(C) Copyright IBM Corporation 2005, 2011. All Rights Reserved.