Signal/Geometry Processing Library (SPL) 1.1.24 |

Classes | Typedefs | Functions
One-Dimensional Arrays
Arrays and Sequences

One-dimensional arrays. More...

## Classes
class | SPL::Array1< T >
| A one-dimensional array class with lazy copying and reference counting. More...

## Typedefs
typedef Array1< double > | SPL::RealArray1
| A one-dimensional array with real elements. More...
typedef Array1< int > | SPL::IntArray1
| A one-dimensional array with integer elements. More...

## Functions
template<class T >
std::ostream & | SPL::operator<< (std::ostream &out, const Array1< T > &a)
| Output an array to the specified stream. More...
template<class T >
std::istream & | SPL::operator>> (std::istream &in, Array1< T > &a)
| Input an array from the specified stream. More...
template<class T >
bool | SPL::operator== (const Array1< T > &a, const Array1< T > &b)
| Test two arrays for equality. More...
template<class T >
SPL_ARRAY1_INLINE bool | SPL::operator!= (const Array1< T > &a, const Array1< T > &b)
| Test two arrays for inequality. More...
| SPL::Array1< T >::Array1 ()
| Create an empty array. More...
| SPL::Array1< T >::Array1 (int size)
| Create an array of the specified size. More...
| SPL::Array1< T >::Array1 (const Array1 &a)
| Create a copy of an array. More...
| SPL::Array1< T >::Array1 (int size, const T &value)
| Create an array of the given size with all elements initialized to the specified value. More...
| SPL::Array1< T >::~Array1 ()
| Destroy an array. More...
Array1 & | SPL::Array1< T >::operator= (const Array1 &a)
| Assign one array to another. More...
template<class OtherType >
Array1< T > & | SPL::Array1< T >::operator= (const Array1< OtherType > &a)
| Assign an array with elements of arbitrary type to another array. More...
Array1 & | SPL::Array1< T >::operator+= (const Array1 &a)
| Add another array (elementwise) to this array. More...
Array1 & | SPL::Array1< T >::operator-= (const Array1 &a)
| Subtract another array (elementwise) from this array. More...
Array1 & | SPL::Array1< T >::operator*= (const Array1 &a)
| Multiply another array (elementwise) by this array. More...
Array1 & | SPL::Array1< T >::operator/= (const Array1 &a)
| Divide this array (elementwise) by another array. More...
Array1 & | SPL::Array1< T >::operator+= (const T &value)
| Add the specified value to each element in the array. More...
Array1 & | SPL::Array1< T >::operator-= (const T &value)
| Subtract the specified value from each element in the array. More...
Array1 & | SPL::Array1< T >::operator*= (const T &value)
| Multiply each element in the array by the specified value. More...
Array1 & | SPL::Array1< T >::operator/= (const T &value)
| Divide each element in the array by the specified value. More...
int | SPL::Array1< T >::getSize () const
| Get the number of elements in the array. More...
bool | SPL::Array1< T >::isShared () const
| Is the data for this array shared with another array? More...
bool | SPL::Array1< T >::isSharedWith (const Array1 &a) const
| Is the data for this array shared with the specified array? More...
T & | SPL::Array1< T >::operator() (int i)
| Get a mutable reference to the specified element in the array. More...
const T & | SPL::Array1< T >::operator() (int i) const
| Get a const reference to the specified element in the array. More...
Iterator | SPL::Array1< T >::begin ()
| Get a mutable iterator referring to the first element in the array. More...
Iterator | SPL::Array1< T >::end ()
| Get a mutable iterator referring to one past the last element in the array. More...
ConstIterator | SPL::Array1< T >::begin () const
| Get a const iterator referring to the first element in the array. More...
ConstIterator | SPL::Array1< T >::end () const
| Get a const iterator referring to one past the last element in the array. More...
void | SPL::Array1< T >::resize (int size)
| Change the size of the array. More...
template<class InputIterator >
void | SPL::Array1< T >::resize (int size, InputIterator data)
| Change the size of the array, initializing the resized array with the data obtained from the specified input iterator. More...
T | SPL::Array1< T >::max () const
| Get the maximum of the elements in the array. More...
T | SPL::Array1< T >::min () const
| Get the minimum of the elements in the array. More...
T | SPL::Array1< T >::sum () const
| Get the sum of the elements in the array. More...
std::ostream & | SPL::Array1< T >::output (std::ostream &out, int fieldWidth) const
| Output an array to a stream with a particular field width to be used for each element. More...
int | SPL::Array1< T >::load (const char *fileName)
| Load an array from the file with the specified name. More...
int | SPL::Array1< T >::save (const char *fileName) const
| Save an array to the file with the specified name. More...
void | SPL::Array1< T >::swap (Array1 &a)
| Swap the contents of the array with the contents of another array. More...
void | SPL::Array1< T >::fill (const T &value=T(0))
| Set all elements in the array to the specified value. More...
void | SPL::Array1< T >::dump (std::ostream &out) const
| Output information about an array to a stream for debugging. More...

## Detailed Description

One-dimensional arrays.

## Typedef Documentation

typedef Array1<int> SPL::IntArray1

A one-dimensional array with integer elements.

typedef Array1<double> SPL::RealArray1

A one-dimensional array with real elements.

## Function Documentation

template<class T >

SPL_ARRAY1_INLINE SPL::Array1< T >::Array1 | ( |  | ) |

Create an empty array.

template<class T >

SPL_ARRAY1_INLINE SPL::Array1< T >::Array1 | ( | int | size | ) |
| explicit

Create an array of the specified size.

template<class T >

SPL_ARRAY1_INLINE SPL::Array1< T >::Array1 | ( | int | size,
|  | const T & | value
| ) |  |

Create an array of the given size with all elements initialized to the specified value.

template<class T >

SPL_ARRAY1_INLINE SPL::Array1< T >::Array1 | ( | const Array1< T > & | a | ) |

Create a copy of an array.

template<class T >

SPL_ARRAY1_INLINE Array1< T >::ConstIterator SPL::Array1< T >::begin | ( |  | ) | const

Get a const iterator referring to the first element in the array.

template<class T >

SPL_ARRAY1_INLINE Array1< T >::Iterator SPL::Array1< T >::begin | ( |  | ) |

Get a mutable iterator referring to the first element in the array.

template<class T >

void SPL::Array1< T >::dump | ( | std::ostream & | out | ) | const

Output information about an array to a stream for debugging.

template<class T >

SPL_ARRAY1_INLINE Array1< T >::ConstIterator SPL::Array1< T >::end | ( |  | ) | const

Get a const iterator referring to one past the last element in the array.

template<class T >

SPL_ARRAY1_INLINE Array1< T >::Iterator SPL::Array1< T >::end | ( |  | ) |

Get a mutable iterator referring to one past the last element in the array.

template<class T >

SPL_ARRAY1_INLINE void SPL::Array1< T >::fill | ( | const T & | value = `T(0)` | ) |

Set all elements in the array to the specified value.

template<class T >

SPL_ARRAY1_INLINE int SPL::Array1< T >::getSize | ( |  | ) | const

Get the number of elements in the array.

template<class T >

SPL_ARRAY1_INLINE bool SPL::Array1< T >::isShared | ( |  | ) | const

Is the data for this array shared with another array?

Under most normal circumstances, one should never need to call this function. In some instances, however, it might be necessary to know whether data is shared in order to write more optimal code.

template<class T >

SPL_ARRAY1_INLINE bool SPL::Array1< T >::isSharedWith | ( | const Array1< T > & | a | ) | const

Is the data for this array shared with the specified array?

template<class T >

int SPL::Array1< T >::load | ( | const char * | fileName | ) |

Load an array from the file with the specified name.

template<class T >

SPL_ARRAY1_INLINE T SPL::Array1< T >::max | ( |  | ) | const

Get the maximum of the elements in the array.

The array must contain at least one element.

template<class T >

SPL_ARRAY1_INLINE T SPL::Array1< T >::min | ( |  | ) | const

Get the minimum of the elements in the array.

The array must contain at least one element.

template<class T >

SPL_ARRAY1_INLINE bool SPL::operator!= | ( | const Array1< T > & | a,
|  | const Array1< T > & | b
| ) |  |

Test two arrays for inequality.

template<class T >

SPL_ARRAY1_INLINE T & SPL::Array1< T >::operator() | ( | int | i | ) |

Get a mutable reference to the specified element in the array.

template<class T >

SPL_ARRAY1_INLINE const T & SPL::Array1< T >::operator() | ( | int | i | ) | const

Get a const reference to the specified element in the array.

template<class T >

SPL_ARRAY1_INLINE Array1< T > & SPL::Array1< T >::operator*= | ( | const Array1< T > & | a | ) |

Multiply another array (elementwise) by this array.

template<class T >

SPL_ARRAY1_INLINE Array1< T > & SPL::Array1< T >::operator*= | ( | const T & | value | ) |

Multiply each element in the array by the specified value.

template<class T >

SPL_ARRAY1_INLINE Array1< T > & SPL::Array1< T >::operator+= | ( | const Array1< T > & | a | ) |

Add another array (elementwise) to this array.

template<class T >

SPL_ARRAY1_INLINE Array1< T > & SPL::Array1< T >::operator+= | ( | const T & | value | ) |

Add the specified value to each element in the array.

template<class T >

SPL_ARRAY1_INLINE Array1< T > & SPL::Array1< T >::operator-= | ( | const Array1< T > & | a | ) |

Subtract another array (elementwise) from this array.

template<class T >

SPL_ARRAY1_INLINE Array1< T > & SPL::Array1< T >::operator-= | ( | const T & | value | ) |

Subtract the specified value from each element in the array.

template<class T >

SPL_ARRAY1_INLINE Array1< T > & SPL::Array1< T >::operator/= | ( | const Array1< T > & | a | ) |

Divide this array (elementwise) by another array.

template<class T >

SPL_ARRAY1_INLINE Array1< T > & SPL::Array1< T >::operator/= | ( | const T & | value | ) |

Divide each element in the array by the specified value.

template<class T >

std::ostream& SPL::operator<< | ( | std::ostream & | out,
|  | const Array1< T > & | a
| ) |  |

Output an array to the specified stream.

template<class T >

SPL_ARRAY1_INLINE Array1< T > & SPL::Array1< T >::operator= | ( | const Array1< T > & | a | ) |

Assign one array to another.

template<class T >
template<class OtherType >

Array1< T > & SPL::Array1< T >::operator= | ( | const Array1< OtherType > & | a | ) |

Assign an array with elements of arbitrary type to another array.

template<class T >

bool SPL::operator== | ( | const Array1< T > & | a,
|  | const Array1< T > & | b
| ) |  |

Test two arrays for equality.

template<class T >

std::istream& SPL::operator>> | ( | std::istream & | in,
|  | Array1< T > & | a
| ) |  |

Input an array from the specified stream.

template<class T >

std::ostream & SPL::Array1< T >::output | ( | std::ostream & | out,
|  | int | fieldWidth
| ) |  | const

Output an array to a stream with a particular field width to be used for each element.

template<class T >

void SPL::Array1< T >::resize | ( | int | size | ) |

Change the size of the array.

Effects: The array size is changed to the specified size. If the new size is the same as the old size, this function does nothing.

template<class T >
template<class InputIterator >

void SPL::Array1< T >::resize | ( | int | size,
|  | InputIterator | data
| ) |  |

Change the size of the array, initializing the resized array with the data obtained from the specified input iterator.

template<class T >

int SPL::Array1< T >::save | ( | const char * | fileName | ) | const

Save an array to the file with the specified name.

template<class T >

SPL_ARRAY1_INLINE T SPL::Array1< T >::sum | ( |  | ) | const

Get the sum of the elements in the array.

template<class T >

SPL_ARRAY1_INLINE void SPL::Array1< T >::swap | ( | Array1< T > & | a | ) |

Swap the contents of the array with the contents of another array.

template<class T >

SPL_ARRAY1_INLINE SPL::Array1< T >::~Array1 | ( |  | ) |

Destroy an array.