The IDL_Container::Get function method returns heap variables (objects or pointers) from the container. By default, IDL returns the first item in the container unless you specify the ALL or POSITION keywords. If the container is empty, the Get method returns -1 or !NULL if you set the NULL keyword.

Syntax


Result = Obj->[IDL_Container::]Get ([/ALL] [, ISA=class_name(s)] [, POSITION=index] [, COUNT=variable] [/NULL] )

Return Value


A scalar or array of heap variables (object references or pointers).

Note: Do not mix objects and pointers within the same IDL_Container. The first item added to the container determines whether it is an "object" container or a "pointer" container.

Arguments


None.

Keywords


ALL

Set this keyword to return all of the heap variables within in the container. If ALL is set then the POSITION keyword is not allowed.

COUNT

Set this keyword equal to a named variable that will contain the number of items returned. If the ALL keyword is also specified, specifying this keyword is the same as calling the IDL_Container::Count method.

ISA

Set this keyword equal to a class name or vector of class names. The ISA keyword returns only the objects that inherit from the class or classes specified.

This keyword only applies to containers of objects. If you use this keyword with a container of pointers, then nothing will be returned (-1 or !NULL).

NULL

If this keyword is set and no items are returned, then the Get method will return !NULL instead of -1.

Tip: The NULL keyword is useful when trying to quietly remove all objects of a certain type from the container. For example:

obj->Remove, obj->Get(/ALL, ISA='MyClass', /NULL)

POSITION

Set this keyword equal to a scalar or array containing the zero-based positions of the items to return.

Version History


5.0

Introduced

8.2 Added NULL keyword.
8.4 Add support for pointers within containers

See Also


IDL_Container::Add, IDL_Container::Count, IDL_Container::Equals, IDL_Container::IsContained, IDL_Container::Move, IDL_Container::Remove