MGunit documentation

Unit testing for IDL

single page | use frames     summary     class     fields     routine details     file attributes

dist_tools/collection/

mgcoarraylist__define.pro

An array list is a way to have an arbitrary length list of any particular IDL variable (but all elements must be the same type). An MGcoArrayList implements the same interface as IDL_Container, but can contain any IDL type.

Examples

For example: a = obj_new('MGcoArrayList', type=7) a->add, 'a' a->add, ['b', 'c', 'd'] print, a->count() print, a->get(/all) print, a->get(position=1) obj_destroy, a

Class description for mgcoarraylist

Inheritance

Properties

count get

number of elements in the array list

block_size get set init

initial size of the data array; defaults to 1000 if not specified

example get init

type defined by an example instead of a type code (required for array lists of structures)

_ref_extra get

keywords to MGcoAbstractList::getProperty

type get set init

type code as in SIZE function to specify the type of elements in the list; TYPE or EXAMPLE keyword must be used when initializing the array list

Fields

pData ptr_new()

pointer to the data array

nUsed 0L

number of elements of the list actually in use

pExample ptr_new()

used if list of structures to specify the structure

type 0L

SIZE type code of the data array

blockSize 0L

size of the data array

Fields in mgcoabstractlist

Author information

Author

Michael Galloy

Version

1.0

Routines

mgcoarraylist::getProperty, type=type, block_size=block_size, example=example, count=count, _ref_extra=_ref_extra

Get properties of the list.

mgcoarraylist::setProperty, type=type, block_size=block_size

Set properties of the list.

mgcoarraylist::remove [, elements] [, position=long] [, /all]

Remove specified elements from the list.

mgcoarraylist::move, source, destination

Move an element of the list to another position.

result = mgcoarraylist::isContained(elements [, position=long])

Determines whether a list contains specified elements.

mgcoarraylist::add, elements [, position=long/lonarr]

Add elements to the list.

result = mgcoarraylist::isaGet( [position=lonarr], isa=string/strarr [, /all] [, count=long])

Private method to screen for given class(es).

result = mgcoarraylist::get( [/all] [, position=long/lonarr] [, count=integer] [, isa=string/strarr])

Get elements of the list.

result = mgcoarraylist::count()

Returns the number of elements in the list.

result = mgcoarraylist::iterator()

Creates an iterator to iterate through the elements of the ArrayList.

mgcoarraylist::cleanup

Cleanup list resources.

result = mgcoarraylist::init(type=type, example=example, block_size=block_size)

Create a list.

mgcoarraylist__define

Define member variables.

Routine details

topmgcoarraylist::getProperty

mgcoarraylist::getProperty, type=type, block_size=block_size, example=example, count=count, _ref_extra=_ref_extra

Get properties of the list.

Keywords

type

type code as in SIZE function to specify the type of elements in the list; TYPE or EXAMPLE keyword must be used when initializing the array list

block_size

initial size of the data array; defaults to 1000 if not specified

example

type defined by an example instead of a type code (required for array lists of structures)

count

number of elements in the array list

_ref_extra

keywords to MGcoAbstractList::getProperty

topmgcoarraylist::setProperty

mgcoarraylist::setProperty, type=type, block_size=block_size

Set properties of the list.

Keywords

type

type code as in SIZE function to specify the type of elements in the list; TYPE or EXAMPLE keyword must be used when initializing the array list

block_size

initial size of the data array; defaults to 1000 if not specified

topmgcoarraylist::remove

mgcoarraylist::remove [, elements] [, position=long] [, /all]

Remove specified elements from the list.

Parameters

elements in optional type=type of list

elements of the list to remove

Keywords

position in optional type=long

set to a scalar or vector array of indices to remove from the list

all in optional type=boolean

set to remove all elements of the list

topmgcoarraylist::move

mgcoarraylist::move, source, destination

Move an element of the list to another position.

Parameters

source in required type=long

index of the element to move

destination in required type=long

index of position to move element

topmgcoarraylist::isContained

result = mgcoarraylist::isContained(elements [, position=long])

Determines whether a list contains specified elements.

Return value

1B if contained or 0B if otherwise

Parameters

elements in required type=type of list

scalar or vector of elements of the same type as the list

Keywords

position out optional type=long

set to a named variable that will return the position of the first instance of the corresponding element of the specified elements

topmgcoarraylist::add

mgcoarraylist::add, elements [, position=long/lonarr]

Add elements to the list.

Parameters

elements in required type=list type

scalar or vector array of the same type as the list

Keywords

position in optional type=long/lonarr default=end of list

index or index array to insert elements at; if array, must match number of elements

topmgcoarraylist::isaGetprivate

result = mgcoarraylist::isaGet( [position=lonarr], isa=string/strarr [, /all] [, count=long])

Private method to screen for given class(es). Indices returned are indices POSITION (or data array if ALL is set).

Return value

index array or -1L if none

Keywords

position in optional type=lonarr

indices of elements to check

isa in required type=string/strarr

classes to check objects for

all in optional type=boolean

screen from all elements

count out optional type=long

number of matched items

topmgcoarraylist::get

result = mgcoarraylist::get( [/all] [, position=long/lonarr] [, count=integer] [, isa=string/strarr])

Get elements of the list.

Return value

element(s) of the list or -1L if no elements to return

Keywords

all in optional type=boolean

set to return all elements

position in optional type=long/lonarr

set to an index or an index array of elements to return; defaults to 0 if ALL keyword not set

count out optional type=integer

set to a named variable to get the number of elements returned by this function

isa in optional type=string/strarr

classname(s) of objects to return; only allowable if list type is object

topmgcoarraylist::count

result = mgcoarraylist::count()

Returns the number of elements in the list.

Return value

long integer

topmgcoarraylist::iterator

result = mgcoarraylist::iterator()

Creates an iterator to iterate through the elements of the ArrayList. The destruction of the iterator is the responsibility of the caller of this method.

Return value

MGcoArrayListIterator object

topmgcoarraylist::cleanup

mgcoarraylist::cleanup

Cleanup list resources.

topmgcoarraylist::init

result = mgcoarraylist::init(type=type, example=example, block_size=block_size)

Create a list.

Return value

1B for succes, 0B otherwise

Keywords

type

type code as in SIZE function to specify the type of elements in the list; TYPE or EXAMPLE keyword must be used when initializing the array list

example

type defined by an example instead of a type code (required for array lists of structures)

block_size

initial size of the data array; defaults to 1000 if not specified

topmgcoarraylist__define

object, collection

mgcoarraylist__define

Define member variables.

File attributes

Modification date: Wed Apr 22 23:29:03 2009
Lines: 493
Docformat: rst rst