In file mydocsrc/iml_seq.h:

template class iml_sequence

This template class is a general purpose scalar-sequence manager

Public

A: The following are the constructors and destructors.


iml_sequence (Type Start, Type End, IML_USINT Len, iml_sequence_type SeqType= LINEAR)
A complete sequence constructor
iml_sequence (IML_USINT Len)
A simple sequence constructor
B: The following are methods used when constructing a sequence.


void generate_linear_sequence (Type Start, Type Delta)
Fills the array with a linear sequence beginning at Start and incremented by Delta along the way
void generate_logarithmic_sequence (Type Start, IML_DOUBLE Delta)
Fills the array with a logarithmic (multiplicative) sequence beginning at Start and multiplied by Delta along the way
void sin (IML_DOUBLE Mean, IML_DOUBLE Amplitude, IML_DOUBLE Period, IML_DOUBLE PhaseDeg)
Fills the array with a sinusoidally varying index sequence
void operator= (iml_sequence IML_REF Seq)
This method copies one sequence into another
Type IML_REF operator[] (IML_USINT I)
This method provides direct access to a sequence entry
Type IML_REF operator() (IML_USINT I)
This method provides direct access to a sequence entry
IML_USINT length (void)
This method returns the length of the array (sequence)
C: The following are methods for manipulating a previusly
void reverse (void)
Reverse the sequence by swapping the pairs (0,N-1), (1,N-2) etc
void rotate (IML_SINT Amount)
Rotate the sequence by the number of specified places
void shuffle (IML_USINT Times = 1)
Shuffles the sequence of values

Documentation

This template class is a general purpose scalar-sequence manager. It was written, really, because I wanted to make lists of unsigned integers to be used for specifying frame sequences of movie loops. This idea was stolen . . ahem . . borrowed from D. Brainard's MatLab interface to D.G. Pelli's VideoToolbox library.

After creating the class I have predefined a sequence manager for each scalar type:


// An 8-bit signed integer sequence manager.
typedef iml_sequence	iml_byte_sequence;

// An 8-bit unsigned integer sequence manager.
typedef iml_sequence	iml_ubyte_sequence;

// A 16-bit signed integer sequence manager.
typedef iml_sequence	iml_sint_sequence;

// A 16-bit unsigned integer sequence manager.
// This is the one we use to create the alias for
// our image frame index manager.
typedef iml_sequence	iml_usint_sequence;

// A 32-bit signed integer sequence manager.
typedef iml_sequence	iml_lint_sequence;

// A 32-bit unsigned integer sequence manager.
typedef iml_sequence	iml_ulint_sequence;

// A 32-bit floating point sequence manager. 
typedef iml_sequence	iml_float_sequence;

// A 64-bit floating point sequence manager.
typedef iml_sequence	iml_double_sequence;

I then use

typedef iml_usint_sequence		iml_imageframe_sequence;

as the type for an image frame sequence.
A: The following are the constructors and destructors.

iml_sequence(Type Start, Type End, IML_USINT Len, iml_sequence_type SeqType= LINEAR)
A complete sequence constructor. The default is a linear sequence, although you may also specify a logarithmic (that is, multiplicative) sequence.

iml_sequence(IML_USINT Len)
A simple sequence constructor. In this case you either construct the sequence yourself or use other methods to initialize the values. You can use the square-bracket (that is, operator[]) to modify each value on your own.

B: The following are methods used when constructing a sequence.

void sin(IML_DOUBLE Mean, IML_DOUBLE Amplitude, IML_DOUBLE Period, IML_DOUBLE PhaseDeg)
Fills the array with a sinusoidally varying index sequence. If these indices are frame numbers then you can get an approximation of sinsoidally varying motion direction/speed. :-) The PhaseDeg component might be unnecessary because you can also rotate the sequence, but it makes the specification a bit more complete.

void operator=(iml_sequence IML_REF Seq)
This method copies one sequence into another. If the destination sequence is shorter than the source, only the corresponding segment of the longer sequence is copied. If the destination sequence is longer than the source (this is the handy part) then the shorter source sequence is replicated (repeated) in the longer destination sequence.

Type IML_REF operator[](IML_USINT I)
This method provides direct access to a sequence entry. Array bounds checking is not done, by default. Use the operator() method to get array bounds checking.

Type IML_REF operator()(IML_USINT I)
This method provides direct access to a sequence entry. Array bounds checking is done, by default. Use the operator() method to get array bounds checking.

IML_USINT length(void)
This method returns the length of the array (sequence). This is provides so we can loop and fill it ourselves, but not have to keep track of which sequences are which length.

C: The following are methods for manipulating a previusly
constructed equence.

void rotate(IML_SINT Amount)
Rotate the sequence by the number of specified places. Positive values produce rotation to the left and negative values produce rotation to the right. Thus, for a sequence

0 1 2 3 4 5

a call rotate(2) produces the new sequence

2 3 4 5 0 1

void shuffle(IML_USINT Times = 1)
Shuffles the sequence of values. The algorithm is just
for length() times do
create a pair of random integers between 0 and length()-1
swap those entries in the sequence
The default is to shuffle just once, but it is possible to to shuffle the sequence an arbitrary number of times. A zero parameter value leaves the sequence unchanged.


This class has no child classes.

alphabetic index hierarchy of classes


generated by doc++