The IDL_Container::Add procedure method adds one or more objects or pointers to the container.
Examples
Add three objects to a container, and then retrieve them all:
o = IDL_Container()
o.Add, IDL_Object()
o.Add, IDL_Object()
o.Add, IDL_Object()
PRINT, o.Get(/ALL)
IDL prints:
<ObjHeapVar2(IDL_OBJECT)><ObjHeapVar4(IDL_OBJECT)><ObjHeapVar6(IDL_OBJECT)>
If the container has three objects, a new object will be placed at the fourth position. Since positions begin at zero, this would be equivalent to setting POSITION=3.
Syntax
Obj->[IDL_Container::]Add, Heapvar [POSITION=index]
Arguments
Heapvar
A scalar or array of heap variables (object references or pointers) to be added to the container object.
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.
Keywords
POSITION
Set this keyword equal to a scalar or array of zero-based index values. The number of elements specified must be equal to the number of heap variables specified by the Heapvar argument. Each index value specifies the position within the container at which a new item should be placed. The default is to add new items at the end of the container.
Version History
5.0 |
Introduced |
8.4 |
Add support for pointers within containers |
See Also
IDL_Container::Count, IDL_Container::Equals, IDL_Container::Get, IDL_Container::IsContained, IDL_Container::Move, IDL_Container::Remove