Maps value in unit interval to a tabulated function. More...
#include <UnitMaps.h>
Public Member Functions | |
FunctionTable (uint32_t size=2048, const T &init=T(0)) | |
Constructor that allocates an internal table. | |
Array< T, A > & | array () |
Get array. | |
T | operator() (double x) const |
Returns f(x) where x lies in the function domain, [0,1) | |
FunctionTable & | endpoints (index_t min, index_t max) |
Set indexing interval for look-up [min, max) | |
template<class Gen > | |
FunctionTable & | operator+= (Gen &g) |
Sums generator stream with table elements. | |
T & | operator[] (uint32_t i) |
Get write reference to element. | |
const T & | operator[] (uint32_t i) const |
Get read-only reference to element. | |
ArrayBase & | assign (const T &v) |
Sets all elements to value. | |
ArrayBase & | assign (const T &v, uint32_t end, uint32_t stride=1, uint32_t start=0) |
Sets linear slice of elements to value. | |
T * | elems () |
Get writable pointer to elements. | |
const T * | elems () const |
Get read-only pointer to elements. | |
uint32_t | size () const |
Returns number of elements in array. | |
void | clear () |
Destroys all elements and frees memory. | |
void | own () |
Ensures ownership of elements. | |
bool | isSoleOwner () const |
Returns true if we are the sole owner of data internally allocated. | |
void | resize (uint32_t newSize, const T &c=T()) |
Resizes number of elements in array. | |
void | source (ArrayBase< T, SizeArray, A > &src) |
Sets source of array elements to another array. | |
void | source (T *src, uint32_t size) |
Sets source of array elements to another array. | |
Static Public Member Functions | |
static int | references (T *m) |
Returns number of pointers to memory address being managed. |
Maps value in unit interval to a tabulated function.
FunctionTable | ( | uint32_t | size = 2048 , |
const T & | init = T(0) |
||
) | [explicit] |
Constructor that allocates an internal table.
[in] | size | Number of elements (actual number is power of 2 ceiling) |
[in] | init | Initial value of elements |
ArrayBase& assign | ( | const T & | v, |
uint32_t | end, | ||
uint32_t | stride = 1 , |
||
uint32_t | start = 0 |
||
) | [inherited] |
Sets linear slice of elements to value.
[in] | v | value to be copied as new content |
[in] | end | end index (exclusive) |
[in] | stride | index stride amount |
[in] | start | start index (inclusive) |
void own | ( | ) | [inherited] |
Ensures ownership of elements.
If the array is not already the sole owner, new memory is allocated and the previously referenced array elements are copied.
void resize | ( | uint32_t | newSize, |
const T & | c = T() |
||
) | [inherited] |
Resizes number of elements in array.
If the new size is less than the old size, then elements are truncated. If the new size is greater than the old size, then the argument value is copied into the additional elements.