STIR
6.2.0
|
class BasicCoordinate<int
num_dimensions
, typename
coordT>
defines num_dimensions
-dimensional coordinates.
More...
#include "stir/BasicCoordinate.h"
Public Member Functions | |
BasicCoordinate () | |
default constructor. NO initialisation | |
BasicCoordinate (const coordT &) | |
constructor that sets all elements equal to value. | |
template<typename coordT2 > | |
BasicCoordinate (const BasicCoordinate< num_dimensions, coordT2 > &c) | |
constructor from different type of coordT More... | |
BasicCoordinate & | operator= (const BasicCoordinate &c) |
assignment | |
bool | operator== (const BasicCoordinate &c) const |
comparison | |
bool | operator< (const BasicCoordinate &c) const |
less-than (using lexical ordering) | |
coordT & | operator[] (const int d) |
Return value at index t (which is 1-based) | |
coordT const & | operator[] (const int d) const |
Return value at index t (which is 1-based) if the BasicCoordinate object is const. More... | |
coordT & | at (const int d) |
Return value at index t (which is 1-based), but with range checking (throws std::out_of_range) | |
coordT const & | at (const int d) const |
Return value at index t (which is 1-based) if the BasicCoordinate object is const, but with range checking (throws std::out_of_range) | |
bool | empty () const |
arithmetic assignment operators | |
BasicCoordinate & | operator+= (const BasicCoordinate &c) |
BasicCoordinate & | operator-= (const BasicCoordinate &c) |
BasicCoordinate & | operator*= (const BasicCoordinate &c) |
BasicCoordinate & | operator/= (const BasicCoordinate &c) |
BasicCoordinate & | operator+= (const coordT &a) |
BasicCoordinate & | operator-= (const coordT &a) |
BasicCoordinate & | operator*= (const coordT &a) |
BasicCoordinate & | operator/= (const coordT &a) |
arithmetic operations with a BasicCoordinate, combining element by element | |
BasicCoordinate | operator+ (const BasicCoordinate &c) const |
BasicCoordinate | operator- (const BasicCoordinate &c) const |
BasicCoordinate | operator* (const BasicCoordinate &c) const |
BasicCoordinate | operator/ (const BasicCoordinate &c) const |
arithmetic operations with a coordT | |
BasicCoordinate | operator+ (const coordT &a) const |
BasicCoordinate | operator- (const coordT &a) const |
BasicCoordinate | operator* (const coordT &a) const |
BasicCoordinate | operator/ (const coordT &a) const |
BasicCoordinate | operator- () const |
basic iterator support | |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
Functions as in VectorWithOffset | |
void | fill (const coordT &) |
fill elements with value | |
static int | get_min_index () |
static int | get_max_index () |
static unsigned | size () |
class BasicCoordinate<int
num_dimensions
, typename
coordT>
defines num_dimensions
-dimensional coordinates.
A BasicCoordinate<num_dimensions
, coordT>
is essentially a vector of size num_dimensions
, but as the dimension is templated, it has better performance.
Access to the individual coordinates is through operator[].
num_dimensions
|
inlineexplicit |
constructor from different type of coordT
Uses assignment after
static_cast<coordT>
|
inline |
Return value at index t
(which is 1-based) if the BasicCoordinate object is const.
Note that the return type is not simply coordT
. This mimics the design of std::vector. One can argue about this (see e.g. http://groups.google.com/group/comp.lang.c%2B%2B.moderated/browse_thread/thread/e5c4898a5c259cc1/434f5a25df51781f%23434f5a25df51781f?sa=X&oi=groupsr&start=2&num=3), However, this alternative can have severe performance penalties if coordT
is a type for large objects.