A FixedArray is a simple copy-by-value array providing random access to its elements.
More...
#include <ocean/eagle/FixedArray.hpp>
List of all members.
Classes
- struct subarray
- Helper class for retrieve a subset of the current array. More...
Public Types
Public Member Functions
-
const Element_t * const_element_ptr () const
-
const ElementAsFixedArray_t * const_elements_as_fixed_array () const
-
const value * const_ptr (int i=0) const
-
template<typename T > FixedArray & copy (const FixedArray< T, N > &F)
-
Element_t * element_ptr ()
-
ElementAsFixedArray_t * elements_as_fixed_array ()
-
void expandMax (FixedArray &MaxValues) const
-
void expandMin (FixedArray &MinValues) const
-
void expandMinMax (FixedArray &MinValues, FixedArray &MaxValues) const
- Expand a range given by MinValues,MaxValues to include the values of this array, done per component.
-
FixedArray (const value &a, const value &b, const value &c, const value &d)
- Convenience Constructor: initialize the first four elements.
-
FixedArray (const value &a, const value &b, const value &c)
- Convenience Constructor: initialize the first three elements.
-
FixedArray (const value &a, const value &b)
- Convenience Constructor: initialize the first two elements.
-
FixedArray (const value &a)
- Convenience Constructor: initialize the first element.
-
template<class AType , class BType , OperatorID_t CompType> FixedArray (const FixedArray< AType, N > &l, const FixedArray< BType, N > &r, const Operator< CompType > &)
- Computational constructor for binary operations on two fixed arrays, calls the Operator's ternary() member function for each element.
-
template<typename T , typename ConversionFunctor > FixedArray (const FixedArray< T, N > &F, const ConversionFunctor &CF, const FA_CONVERT &)
- Construct array from another array type of same length.
-
FixedArray ()
- Default constructor (no explicit initialization!).
-
const FlattenedArray_t & flattened () const
-
FlattenedArray_t & flattened ()
-
const value & get (int i) const
- read-only element access
-
value & get (int i)
- writable element access
- template<int subsize, int offset> const FixedArray< value,
subsize > * get_subarray () const
- Same functionality as the subarray template member class, but simpler interface.
-
const FixedArray< value, SIZE-1 > & get_subdim () const
- Mainly introduced because of Interpolate::operator[].
- template<typename T > bool operator!= (const FixedArray< T, N > &F) const
- Compare two arrays.
-
template<typename T > FixedArray & operator= (const FixedArray< T, N > &F)
-
Assignment< FixedArray, 0 > operator= (const value &x)
- template<typename T > bool operator== (const FixedArray< T, N > &F) const
- Compare two arrays.
-
const value & operator[] (int i) const
- read-only element access operator
-
value & operator[] (int i)
- writeable element access operator
-
value * ptr (int i=0)
- Return a pointer to the ith element, no range checking.
-
template<class Value > void set (const Value &x)
- Set all array elements to the same value.
- void setFromArray (const value *x, int length=SIZE, int offset=0)
- Set all array elements to an array's element value.
-
void sort (FixedArray< int, N > &I) const
- Sort the elements of an array into the index array.
-
template<int subsize, int offset> const FixedArray< value,
subsize > & suboffset () const
-
template<int subsize> const FixedArray< value,
subsize > & subset () const
Static Public Member Functions
- template<typename T , typename ConversionFunctor > static FixedArray convert (const FixedArray< T, N > &F, const ConversionFunctor &CF)
- Perform a type conversion on a given fixed array into another basis type:
-
static const FixedArray * fa_cast (const value *data)
-
static FixedArray * fa_cast (value *data)
-
static int size ()
- The number of elements here.
Protected Attributes
-
value data [SIZE]
- The actual data values.
Friends
Detailed Description
template<class value, int N>
class FixedArray< value, N >
A FixedArray is a simple copy-by-value array providing random access to its elements.
Its purpose is to implement small, light-weight types such as 3-vectors, 3x3 matrices and similar, useful for small efficient numerical operations, as they don't have an new/delete memory allocation overhead. The FixedArray does not provide operations on its elements - use class Vector for this purpose.
Copying or creating temporary FixedArray objects should be avoided, as the entire data fields are copied.
- See also:
- Vector
Member Function Documentation
template<class value, int N>
template<typename T , typename ConversionFunctor >
Perform a type conversion on a given fixed array into another basis type:
This is implemented as a type-safe static member function, thus allows explicit type conversion when calling polymorphic or template functions.
template<class value, int N>
template<int subsize, int offset>
Same functionality as the subarray template member class, but simpler interface.
Example:
const FixedArray<3 , CoordinateType>*P3D;
const FixedArray<2 , CoordinateType>*P2D;
P2D = P3D->get_subarray<2,0>();
template<class value, int N>
template<typename T >
Compare two arrays.
The types might differ, but the length must be identical. The comparision loop is terminated at the first type mismatch.
template<class value, int N>
template<typename T >
Compare two arrays.
The types might differ, but the length must be identical. The comparision loop is terminated at the first type mismatch.
template<class value, int N>
void FixedArray< value, N >::setFromArray |
( |
const value * |
x, |
|
|
int |
length = SIZE , |
|
|
int |
offset = 0 | |
|
) |
| | [inline] |
Set all array elements to an array's element value.
Note that the array must have at least the same length as the FixedArray.
Friends And Related Function Documentation
template<class value, int N>
template<typename T >
bool isEqual |
( |
const FixedArray< value, N > & |
L, |
|
|
const FixedArray< T, N > & |
R, |
|
|
double |
precision | |
|
) |
| | [friend] |
Compare two arrays with limited precision.
The types might differ, but the length must be identical. The comparision loop is terminated at the first type mismatch.
The documentation for this class was generated from the following file:
- ocean/eagle/FixedArray.hpp