Array of fixed size.
More...
#include "Imagine/Common.h"
|
T | _data [S] |
| internal storage.
|
|
template<typename T, int S>
class Imagine::FArray< T, S >
Fixed size arrays.
- Parameters
-
- Examples:
- Common/test/test.cpp, and Graphics/test/test.cpp.
◆ FArray() [1/7]
template<typename T, int S>
Constructs an uninitialized array of S variables of type T
◆ FArray() [2/7]
template<typename T, int S>
Constructs an array of S variables of type T, each initialized to v
- Parameters
-
v | value used for initialization |
◆ FArray() [3/7]
template<typename T, int S>
template<typename T2 >
Constructs from a C array (with a possibly different type)
- Parameters
-
t | C array used for initialization |
- Template Parameters
-
char tt[]={'a','b','c'};
FArray<char,3> c(tt);
◆ FArray() [4/7]
template<typename T, int S>
template<typename T2 >
Constructs from another FArray (with a possibly different type)
- Parameters
-
a | FArray to be copied (has to be of the same size) |
- Template Parameters
-
◆ FArray() [5/7]
template<typename T, int S>
Short constructor for 2D FArray
- Parameters
-
v0 | value for index 0 component |
v1 | value for index 1 component |
FArray<char,2> e('a','b');
◆ FArray() [6/7]
template<typename T, int S>
Short constructor for 3D FArray
- Parameters
-
v0 | value for index 0 component |
v1 | value for index 1 component |
v2 | value for index 2 component |
FArray<char,3> f('a','b','c');
◆ FArray() [7/7]
template<typename T, int S>
Short constructor for 4D FArray
- Parameters
-
v0 | value for index 0 component |
v1 | value for index 1 component |
v2 | value for index 2 component |
v3 | value for index 3 component |
◆ begin() [1/2]
template<typename T, int S>
◆ begin() [2/2]
template<typename T, int S>
◆ copy() [1/2]
template<typename T, int S>
template<typename T2 >
Copies C array of different type
- Parameters
-
t | C array to be copied into FArray |
- Template Parameters
-
- Returns
- self reference
◆ copy() [2/2]
template<typename T, int S>
template<typename T2 >
Copies another FArray of possibly different type but same size.
- Parameters
-
b | C array to be copied into FArray |
- Template Parameters
-
- Returns
- self reference
◆ data() [1/2]
template<typename T, int S>
Pointer to data for reading
- Returns
- const pointer to FArray elements
◆ data() [2/2]
template<typename T, int S>
Pointer to data for writing
- Returns
- pointer to FArray elements
◆ empty()
template<typename T, int S>
True if FArray is empty
- Returns
- false
◆ end() [1/2]
template<typename T, int S>
◆ end() [2/2]
template<typename T, int S>
◆ fill()
template<typename T, int S>
Fills with constant value
- Parameters
-
v | value to be copied to each element |
- Returns
- self reference
◆ operator!=()
template<typename T, int S>
Inequality test (component wise)
- Parameters
-
- Returns
- true if *this is different from b
◆ operator=()
template<typename T, int S>
template<typename T2 >
Assigns from another FArray of possibly different type but same size
- Parameters
-
- Template Parameters
-
- Returns
- self reference
◆ operator==()
template<typename T, int S>
Equality test (component wise)
- Parameters
-
- Returns
- true if *this equals b
if (a==b) cout << "a equals b" << endl;
◆ operator[]() [1/2]
template<typename T, int S>
Reads ith element
- Parameters
-
i | element index (from 0 to S-1) |
- Returns
- const reference to ith element.
◆ operator[]() [2/2]
template<typename T, int S>
Writes ith element
- Parameters
-
i | element index (from 0 to S-1) |
- Returns
- Reference to ith element.
◆ size()
template<typename T, int S>
Dimension of FArray
- Returns
- size
cout << a.size() << endl;
◆ operator<<
template<typename T, int S>
std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const FArray< T, S > & |
a |
|
) |
| |
|
friend |
Writes FArray to stream
- Parameters
-
out | output stream |
a | FArray to write |
- Returns
- updated stream
out.open("tmp.txt");
out << a << endl;
◆ operator>>
template<typename T, int S>
std::istream& operator>> |
( |
std::istream & |
in, |
|
|
FArray< T, S > & |
a |
|
) |
| |
|
friend |
Reads FArray from stream
- Parameters
-
in | input stream |
a | FArray to read |
- Returns
- updated stream
in.open("tmp.txt");
in >> a;
◆ range
template<typename T, int S>
std::pair<T,T> range |
( |
const FArray< T, S > & |
a | ) |
|
|
friend |
Compute min and max of component values (provided comparisons are defined for type T)
- Parameters
-
- Returns
- pair of min,max values
◆ read
template<typename T, int S>
void read |
( |
std::istream & |
in, |
|
|
FArray< T, S > & |
a |
|
) |
| |
|
friend |
Reads FArray from binary stream
- Parameters
-
in | input stream |
a | FArray to read |
ifstream in("tmp.bin",ios::binary);
◆ write
template<typename T, int S>
void write |
( |
std::ostream & |
out, |
|
|
const FArray< T, S > & |
a |
|
) |
| |
|
friend |
Writes FArray to binary stream
- Parameters
-
out | output stream |
a | FArray to write |
ofstream out("tmp.bin",ios::binary);
The documentation for this class was generated from the following file:
- /home/pascal/Ponts/svn/ImagineQt/Imagine/Common/src/Imagine/Common/FArray.h