lsst.afw  13.0-98-g5a654715e+2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
lsst::afw::geom::CoordinateExpr< N > Class Template Reference

A boolean coordinate. More...

#include <CoordinateExpr.h>

Inheritance diagram for lsst::afw::geom::CoordinateExpr< N >:
lsst::afw::geom::CoordinateBase< CoordinateExpr< N >, bool, N >

Public Types

typedef bool Element
 
typedef Eigen::Matrix< bool, N,
1, Eigen::DontAlign > 
EigenVector
 

Public Member Functions

 CoordinateExpr (bool val=false)
 Construct a CoordinateExpr with all elements set to the same scalar value. More...
 
template<typename Vector >
 CoordinateExpr (Eigen::MatrixBase< Vector > const &vector)
 Construct a CoordinateExpr from an Eigen vector. More...
 
bool & operator[] (int n)
 
boolconst & operator[] (int n) const
 
bool & coeffRef (int n)
 
boolconst & coeffRef (int n) const
 
EigenVector const & asEigen () const
 Return a fixed-size Eigen representation of the coordinate object. More...
 
Logical operators

These operators do not provide interoperability with scalars.

CoordinateExpr and_ (CoordinateExpr const &rhs) const
 
CoordinateExpr or_ (CoordinateExpr const &rhs) const
 
CoordinateExpr not_ () const
 

Static Public Attributes

static int const dimensions
 

Protected Member Functions

void _swap (CoordinateBase &other)
 

Protected Attributes

EigenVector _vector
 

Detailed Description

template<int N>
class lsst::afw::geom::CoordinateExpr< N >

A boolean coordinate.

CoordinateExpr is intended to be used as a temporary in coordinate comparisons:

Point2D a(3.5,1.2);
Point2D b(-1.5,4.3);
std::cout << all(a.lt(b)) << std::endl;  // false
std::cout << any(a.lt(b)) << std::endl;  // true

CoordinateExpr is not a true lazy-evaluation expression template, as that seems unnecessary when the object is typically only two bools large (smaller than the raw pointers necessary to implement a lazy solution). The consequence is that there's no short-circuiting of logical operators, but I don't think that will even remotely matter for most use cases. The any() and all() functions do support short-circuiting.

Definition at line 54 of file CoordinateExpr.h.

Member Typedef Documentation

typedef Eigen::Matrix<bool , N, 1, Eigen::DontAlign> lsst::afw::geom::CoordinateBase< CoordinateExpr< N > , bool , N >::EigenVector
inherited

Definition at line 56 of file CoordinateBase.h.

typedef bool lsst::afw::geom::CoordinateBase< CoordinateExpr< N > , bool , N >::Element
inherited

Definition at line 54 of file CoordinateBase.h.

Constructor & Destructor Documentation

template<int N>
lsst::afw::geom::CoordinateExpr< N >::CoordinateExpr ( bool  val = false)
inlineexplicit

Construct a CoordinateExpr with all elements set to the same scalar value.

Definition at line 59 of file CoordinateExpr.h.

template<int N>
template<typename Vector >
lsst::afw::geom::CoordinateExpr< N >::CoordinateExpr ( Eigen::MatrixBase< Vector > const &  vector)
inlineexplicit

Construct a CoordinateExpr from an Eigen vector.

Definition at line 63 of file CoordinateExpr.h.

Member Function Documentation

void lsst::afw::geom::CoordinateBase< CoordinateExpr< N > , bool , N >::_swap ( CoordinateBase< CoordinateExpr< N >, bool, N > &  other)
inlineprotectedinherited

Definition at line 87 of file CoordinateBase.h.

template<int N>
CoordinateExpr lsst::afw::geom::CoordinateExpr< N >::and_ ( CoordinateExpr< N > const &  rhs) const
EigenVector const& lsst::afw::geom::CoordinateBase< CoordinateExpr< N > , bool , N >::asEigen ( ) const
inlineinherited

Return a fixed-size Eigen representation of the coordinate object.

The fact that this returns by const reference rather than by value should not be considered part of the API; this is merely an optimization enabled by the implementation.

Definition at line 69 of file CoordinateBase.h.

bool & lsst::afw::geom::CoordinateBase< CoordinateExpr< N > , bool , N >::coeffRef ( int  n)
inlineinherited

Definition at line 60 of file CoordinateBase.h.

bool const& lsst::afw::geom::CoordinateBase< CoordinateExpr< N > , bool , N >::coeffRef ( int  n) const
inlineinherited

Definition at line 61 of file CoordinateBase.h.

template<int N>
CoordinateExpr lsst::afw::geom::CoordinateExpr< N >::not_ ( ) const
bool & lsst::afw::geom::CoordinateBase< CoordinateExpr< N > , bool , N >::operator[] ( int  n)
inlineinherited

Definition at line 58 of file CoordinateBase.h.

bool const& lsst::afw::geom::CoordinateBase< CoordinateExpr< N > , bool , N >::operator[] ( int  n) const
inlineinherited

Definition at line 59 of file CoordinateBase.h.

template<int N>
CoordinateExpr lsst::afw::geom::CoordinateExpr< N >::or_ ( CoordinateExpr< N > const &  rhs) const

Member Data Documentation

EigenVector lsst::afw::geom::CoordinateBase< CoordinateExpr< N > , bool , N >::_vector
protectedinherited

Definition at line 88 of file CoordinateBase.h.

int const lsst::afw::geom::CoordinateBase< CoordinateExpr< N > , bool , N >::dimensions
staticinherited

Definition at line 55 of file CoordinateBase.h.


The documentation for this class was generated from the following file: