Documentation for pp_lib

Generated by IDLdoc

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

./

pp_buffered_vector__define.pro


Author information

Author

Paulo Penteado (pp.penteado@gmail.com), Sep/2009

Class description for pp_buffered_vector

Properties

Properties in pp_buffered_vector

buffersize init

Fields

Fields in pp_buffered_vector

BUFFERSIZE 0L
COUNT 0L
DATA ptr_new()
SIZE 0L

Routines

Routines from pp_buffered_vector__define.pro

result = pp_buffered_vector::init( [initvec] [, buffersize=buffersize])

Creates a pp_buffered_vector object, with the contents of the given array, or empty if it is not provided.

pp_buffered_vector::append, data

Adds the given data (scalar or array) to the end of the buffered vector, expanding its allocated size if necessary.

result = pp_buffered_vector::getdata( [nget] [, all=all] [, count=count])

Retrieves one or more data elements currently stored in the buffered vector.

result = pp_buffered_vector::getcount()

Returns the number of elements currently stored in the buffered vector.

result = pp_buffered_vector::getsize()

Returns the currently allocated length for the buffered vector.

result = pp_buffered_vector::getbuffersize()

Returns the step by which the buffered vector is incremented when necessary.

pp_buffered_vector__define

Object to keep an adjustable length vector, using a buffer to decrease the frequency of resizing

Routine details

top source pp_buffered_vector::init

result = pp_buffered_vector::init( [initvec] [, buffersize=buffersize])

Creates a pp_buffered_vector object, with the contents of the given array, or empty if it is not provided. The buffered vector can contain elements of any type. The type is determined by the type of the first element put into it (if not at initialization, at the first append operation).

Parameters

initvec in optional

An array whose elements are to be placed in the object on creation.

Keywords

buffersize in optional default=100

Size of the step to use when incrementing the number of elements contained by the object.

Examples

See the example in pp_bufferedvector__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Other attributes

Uses:

Statistics

Lines:
14 lines
Cyclomatic complexity:
4
Modified cyclomatic complexity:
4

top source pp_buffered_vector::append

pp_buffered_vector::append, data

Adds the given data (scalar or array) to the end of the buffered vector, expanding its allocated size if necessary.

Parameters

data in required

The scalar or array to be put at the end of the buffered vector.

Examples

See the example in pp_bufferedvector__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Other attributes

Uses:

Statistics

Lines:
29 lines
Cyclomatic complexity:
7
Modified cyclomatic complexity:
7

top source pp_buffered_vector::getdata

result = pp_buffered_vector::getdata( [nget] [, all=all] [, count=count])

Retrieves one or more data elements currently stored in the buffered vector.

Return value

If the buffered vector is empty, returns 0, with a count of 0. Otherwise, returns an array with the selected elements from the buffered vector, and the number of elements in count.

Parameters

nget in optional default=1

The number of elements to retrieve. If positive, the nget first elements are returned. If negative, the last -nget elements are returned. If abs(nget) is larger than the number of elements in the buffered vector, all the elements are returned. The value returned by count must be checked to find out how many elements were actually returned.

Keywords

all in optional default=0

If set, all the elements stored in the buffered vector are returned.

count out optional

Returns the number of elements retrieved.

Examples

See the example in pp_bufferedvector__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Other attributes

Uses:

Statistics

Lines:
19 lines
Cyclomatic complexity:
7
Modified cyclomatic complexity:
7

top source pp_buffered_vector::getcount

result = pp_buffered_vector::getcount()

Returns the number of elements currently stored in the buffered vector.

Examples

See the example in pp_bufferedvector__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Other attributes

Uses:

Statistics

Lines:
4 lines
Cyclomatic complexity:
2
Modified cyclomatic complexity:
2

top source pp_buffered_vector::getsize

result = pp_buffered_vector::getsize()

Returns the currently allocated length for the buffered vector.

Examples

See the example in pp_bufferedvector__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Other attributes

Uses:

Statistics

Lines:
4 lines
Cyclomatic complexity:
2
Modified cyclomatic complexity:
2

top source pp_buffered_vector::getbuffersize

result = pp_buffered_vector::getbuffersize()

Returns the step by which the buffered vector is incremented when necessary.

Examples

See the example in pp_bufferedvector__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Other attributes

Uses:

Statistics

Lines:
4 lines
Cyclomatic complexity:
2
Modified cyclomatic complexity:
2

top source pp_buffered_vector__define

pp_buffered_vector__define

Object to keep an adjustable length vector, using a buffer to decrease the frequency of resizing

It is a simple (without DLM) and relatively efficient implementation of a container similar to a list, intended for light use. For heavy use, it would take a DLM to implement a proper list.

Examples

Make a new empty buffered vector:

a=obj_new('pp_buffered_vector') print,a->getcount() ;0 a->append,indgen(10) print,a->getcount() ;10 print,a->getdata(5) ;0 1 2 3 4 rint,a->getdata(-5) ;5 6 7 8 9 print,a->getdata(/all) ;0 1 2 3 4 5 6 7 8 9 print,a->getsize() ;100 print,a->getbuffersize() ;100 obj_destroy,a

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Sep/2009

Other attributes

Uses:

Statistics

Lines:
4 lines
Cyclomatic complexity:
4
Modified cyclomatic complexity:
4

File attributes

Modification date: Fri Apr 25 01:37:03 2014
Lines: 82
Docformat: rst rst