Creates a lookup table with a storage size of size.
Initial contents of table is undefined. Use the zero()
function if initialzation is needed.
LookupTableCI(sampleType* aTable, int size);
Borrows a lookup table from another source. size is the number
of emements in the borrowed array. It is up to the user of the
borrowed table to ensure that it remains valid. Use the
setSize() function to stop borrowing a table and create
an internal table.
LookupTableCI(LookupTableCI& aTable);
Copies the parameters of aTable. If aTable has
an internal table, that table will be copied into an internal table
of the newly created object. If the table was borrowed, then the
new object will borrow the same table.
~LookupTable();
Deletes the table array if it is not borrowed.
sampleType* base(void) const;
Returns the base address of the table's storage array.
This function can be used to borrow tables between LookupTable
objects.
void borrow(sampleType* aTable, int size);
Borrows the array aTable with the specified number
of elements. Will delete previous used array if owned by table.
It is up to the user to guarentee that the borrowed table
remains valid.
int borrowQ(void) const;
Returns true if a table is being borrowed; false if
using an internal table.
long getSize(void); const
Returns the number of elements in the table.
LookupTableCI& operator=(LookupTableCI& aTable);
Allow for copying objects from other object. If table is
borrowed, then in the new object it will also be borrowed.
If the table is internal, then in the new object it will
be made internal.
LookupTableCI& operator+=(LookupTableCI& aTable);
Adds the contents of aTable into the lookup table.
Size of aTable must equal size of this object.
LookupTableCI& operator-=(LookupTableCI& aTable);
Subtracts the contents of aTable into the lookup table.
Size of aTable must equal size of this object.
LookupTableCI& operator*=(LookupTableCI& aTable);
Multiplies the contents of aTable into the lookup table.
Size of aTable must equal size of this object.
Multiplies the contents of the lookup table by the constant
amplitude.
sampleType& operator[](long readIndex);
Returns the table element at index readIndex in the
table's array.
sampleType operator[](double readIndex);
Returns the table element at index Floor(readIndex) in the
Table's array. Constant interpolation between indexes.
void setSize(long size);
Sets the size of the table array. If borrowing a table, stop
borrowing the table and make own table with given size.
Contents of table is undefined after calling the setSize
function. Use the zero() function if you need to
initialize the table.
void zero(sampleType aValue = 0);
Sets all elements of the table array to aValue.
You can zero a borrowed table, but you better know what
you are doing...