Chemical Data Processing Library C++ API - Version 1.4.0
Public Types | Public Member Functions | Friends | List of all members
CDPL::Math::HomogenousCoordsAdapter< V > Class Template Reference

Vector expression that exposes a vector V as its homogeneous-coordinate extension by appending an implicit 1 at the end. More...

#include <VectorAdapter.hpp>

+ Inheritance diagram for CDPL::Math::HomogenousCoordsAdapter< V >:

Public Types

typedef V VectorType
 The wrapped vector type. More...
 
typedef V::SizeType SizeType
 The size type used by the wrapped vector. More...
 
typedef V::DifferenceType DifferenceType
 The signed difference type used by the wrapped vector. More...
 
typedef V::ValueType ValueType
 The element value type of the wrapped vector. More...
 
typedef V::ConstReference ConstReference
 Constant reference type to an element. More...
 
typedef std::conditional< std::is_const< V >::value, typename V::ConstReference, typename V::Reference >::type Reference
 Mutable reference type (degrades to ConstReference when the wrapped vector is const). More...
 
typedef std::conditional< std::is_const< V >::value, typename V::ConstClosureType, typename V::ClosureType >::type VectorClosureType
 Closure type used to store the wrapped vector internally (mutable or const flavor). More...
 
typedef const SelfType ConstClosureType
 Constant closure type used when this adapter appears inside another expression. More...
 
typedef SelfType ClosureType
 Closure type used when this adapter appears inside another expression. More...
 
- Public Types inherited from CDPL::Math::VectorExpression< HomogenousCoordsAdapter< V > >
typedef HomogenousCoordsAdapter< V > ExpressionType
 The derived vector expression type. More...
 
- Public Types inherited from CDPL::Math::Expression< E >
typedef E ExpressionType
 The derived expression type (made available to expression-template machinery). More...
 

Public Member Functions

 HomogenousCoordsAdapter (VectorType &v)
 Constructs the adapter wrapping v. More...
 
Reference operator() (SizeType i)
 Returns a mutable reference to the element at index i of the view. More...
 
ConstReference operator() (SizeType i) const
 Returns a const reference to the element at index i of the view. More...
 
Reference operator[] (SizeType i)
 Returns a mutable reference to the element at index i of the view (alias for operator()). More...
 
ConstReference operator[] (SizeType i) const
 Returns a const reference to the element at index i of the view (alias for operator()). More...
 
SizeType getSize () const
 Returns the dimensionality of the view (wrapped vector size + 1). More...
 
bool isEmpty () const
 Tells whether the view is empty (always false; the view always has at least the extension element). More...
 
VectorClosureTypegetData ()
 Returns a reference to the wrapped vector (via its stored closure). More...
 
const VectorClosureTypegetData () const
 Returns a const reference to the wrapped vector (via its stored closure). More...
 
HomogenousCoordsAdapteroperator= (const HomogenousCoordsAdapter &va)
 Copies the elements of va into this view (writing through to the wrapped vector and to the extension element). More...
 
template<typename E >
HomogenousCoordsAdapteroperator= (const VectorExpression< E > &e)
 Assigns the vector expression e to this view (writing through to the wrapped vector). More...
 
template<typename E >
HomogenousCoordsAdapteroperator+= (const VectorExpression< E > &e)
 Adds the vector expression e componentwise to this view. More...
 
template<typename E >
HomogenousCoordsAdapteroperator-= (const VectorExpression< E > &e)
 Subtracts the vector expression e componentwise from this view. More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, HomogenousCoordsAdapter >::type & operator*= (const T &t)
 Multiplies every element of this view by the scalar t. More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, HomogenousCoordsAdapter >::type & operator/= (const T &t)
 Divides every element of this view by the scalar t. More...
 
template<typename E >
HomogenousCoordsAdapterassign (const VectorExpression< E > &e)
 Assigns the vector expression e to this view without intermediate temporary. More...
 
template<typename E >
HomogenousCoordsAdapterplusAssign (const VectorExpression< E > &e)
 Adds the vector expression e to this view without intermediate temporary. More...
 
template<typename E >
HomogenousCoordsAdapterminusAssign (const VectorExpression< E > &e)
 Subtracts the vector expression e from this view without intermediate temporary. More...
 
void swap (HomogenousCoordsAdapter &va)
 Swaps the contents of this view with those of va. More...
 
- Public Member Functions inherited from CDPL::Math::VectorExpression< HomogenousCoordsAdapter< V > >
const ExpressionTypeoperator() () const
 Returns a const reference to the derived vector expression. More...
 
ExpressionTypeoperator() ()
 Returns a reference to the derived vector expression. More...
 

Friends

void swap (HomogenousCoordsAdapter &va1, HomogenousCoordsAdapter &va2)
 ADL-enabled free-function form of swap(). More...
 

Additional Inherited Members

- Protected Member Functions inherited from CDPL::Math::VectorExpression< HomogenousCoordsAdapter< V > >
 VectorExpression ()
 
 ~VectorExpression ()
 
- Protected Member Functions inherited from CDPL::Math::Expression< E >
 Expression ()
 
 ~Expression ()
 

Detailed Description

template<typename V>
class CDPL::Math::HomogenousCoordsAdapter< V >

Vector expression that exposes a vector V as its homogeneous-coordinate extension by appending an implicit 1 at the end.

Template Parameters
VThe wrapped vector type.

Member Typedef Documentation

◆ VectorType

template<typename V >
typedef V CDPL::Math::HomogenousCoordsAdapter< V >::VectorType

The wrapped vector type.

◆ SizeType

template<typename V >
typedef V::SizeType CDPL::Math::HomogenousCoordsAdapter< V >::SizeType

The size type used by the wrapped vector.

◆ DifferenceType

template<typename V >
typedef V::DifferenceType CDPL::Math::HomogenousCoordsAdapter< V >::DifferenceType

The signed difference type used by the wrapped vector.

◆ ValueType

template<typename V >
typedef V::ValueType CDPL::Math::HomogenousCoordsAdapter< V >::ValueType

The element value type of the wrapped vector.

◆ ConstReference

template<typename V >
typedef V::ConstReference CDPL::Math::HomogenousCoordsAdapter< V >::ConstReference

Constant reference type to an element.

◆ Reference

template<typename V >
typedef std::conditional<std::is_const<V>::value, typename V::ConstReference, typename V::Reference>::type CDPL::Math::HomogenousCoordsAdapter< V >::Reference

Mutable reference type (degrades to ConstReference when the wrapped vector is const).

◆ VectorClosureType

template<typename V >
typedef std::conditional<std::is_const<V>::value, typename V::ConstClosureType, typename V::ClosureType>::type CDPL::Math::HomogenousCoordsAdapter< V >::VectorClosureType

Closure type used to store the wrapped vector internally (mutable or const flavor).

◆ ConstClosureType

template<typename V >
typedef const SelfType CDPL::Math::HomogenousCoordsAdapter< V >::ConstClosureType

Constant closure type used when this adapter appears inside another expression.

◆ ClosureType

template<typename V >
typedef SelfType CDPL::Math::HomogenousCoordsAdapter< V >::ClosureType

Closure type used when this adapter appears inside another expression.

Constructor & Destructor Documentation

◆ HomogenousCoordsAdapter()

template<typename V >
CDPL::Math::HomogenousCoordsAdapter< V >::HomogenousCoordsAdapter ( VectorType v)
inline

Constructs the adapter wrapping v.

Parameters
vThe vector to be viewed as its homogeneous-coordinate extension.

Member Function Documentation

◆ operator()() [1/2]

template<typename V >
Reference CDPL::Math::HomogenousCoordsAdapter< V >::operator() ( SizeType  i)
inline

Returns a mutable reference to the element at index i of the view.

Index getSize() - 1 returns the extension element (initialized to 1); all lower indices return the corresponding element of the wrapped vector.

Parameters
iThe zero-based index within the view.
Returns
A mutable reference to the element.

◆ operator()() [2/2]

template<typename V >
ConstReference CDPL::Math::HomogenousCoordsAdapter< V >::operator() ( SizeType  i) const
inline

Returns a const reference to the element at index i of the view.

Parameters
iThe zero-based index within the view.
Returns
A const reference to the element.

◆ operator[]() [1/2]

template<typename V >
Reference CDPL::Math::HomogenousCoordsAdapter< V >::operator[] ( SizeType  i)
inline

Returns a mutable reference to the element at index i of the view (alias for operator()).

Parameters
iThe zero-based index within the view.
Returns
A mutable reference to the element.

◆ operator[]() [2/2]

template<typename V >
ConstReference CDPL::Math::HomogenousCoordsAdapter< V >::operator[] ( SizeType  i) const
inline

Returns a const reference to the element at index i of the view (alias for operator()).

Parameters
iThe zero-based index within the view.
Returns
A const reference to the element.

◆ getSize()

template<typename V >
SizeType CDPL::Math::HomogenousCoordsAdapter< V >::getSize ( ) const
inline

Returns the dimensionality of the view (wrapped vector size + 1).

Returns
The view size.

◆ isEmpty()

template<typename V >
bool CDPL::Math::HomogenousCoordsAdapter< V >::isEmpty ( ) const
inline

Tells whether the view is empty (always false; the view always has at least the extension element).

Returns
false.

◆ getData() [1/2]

template<typename V >
VectorClosureType& CDPL::Math::HomogenousCoordsAdapter< V >::getData ( )
inline

Returns a reference to the wrapped vector (via its stored closure).

Returns
A reference to the wrapped vector closure.

◆ getData() [2/2]

template<typename V >
const VectorClosureType& CDPL::Math::HomogenousCoordsAdapter< V >::getData ( ) const
inline

Returns a const reference to the wrapped vector (via its stored closure).

Returns
A const reference to the wrapped vector closure.

◆ operator=() [1/2]

template<typename V >
HomogenousCoordsAdapter& CDPL::Math::HomogenousCoordsAdapter< V >::operator= ( const HomogenousCoordsAdapter< V > &  va)
inline

Copies the elements of va into this view (writing through to the wrapped vector and to the extension element).

Parameters
vaThe source adapter.
Returns
A reference to itself.

◆ operator=() [2/2]

template<typename V >
template<typename E >
HomogenousCoordsAdapter& CDPL::Math::HomogenousCoordsAdapter< V >::operator= ( const VectorExpression< E > &  e)
inline

Assigns the vector expression e to this view (writing through to the wrapped vector).

Template Parameters
EThe source vector expression type.
Parameters
eThe source vector expression.
Returns
A reference to itself.

◆ operator+=()

template<typename V >
template<typename E >
HomogenousCoordsAdapter& CDPL::Math::HomogenousCoordsAdapter< V >::operator+= ( const VectorExpression< E > &  e)
inline

Adds the vector expression e componentwise to this view.

Template Parameters
EThe source vector expression type.
Parameters
eThe vector expression to add.
Returns
A reference to itself.

◆ operator-=()

template<typename V >
template<typename E >
HomogenousCoordsAdapter& CDPL::Math::HomogenousCoordsAdapter< V >::operator-= ( const VectorExpression< E > &  e)
inline

Subtracts the vector expression e componentwise from this view.

Template Parameters
EThe source vector expression type.
Parameters
eThe vector expression to subtract.
Returns
A reference to itself.

◆ operator*=()

template<typename V >
template<typename T >
std::enable_if<IsScalar<T>::value, HomogenousCoordsAdapter>::type& CDPL::Math::HomogenousCoordsAdapter< V >::operator*= ( const T &  t)
inline

Multiplies every element of this view by the scalar t.

Template Parameters
TThe scalar type.
Parameters
tThe scalar multiplier.
Returns
A reference to itself.

◆ operator/=()

template<typename V >
template<typename T >
std::enable_if<IsScalar<T>::value, HomogenousCoordsAdapter>::type& CDPL::Math::HomogenousCoordsAdapter< V >::operator/= ( const T &  t)
inline

Divides every element of this view by the scalar t.

Template Parameters
TThe scalar type.
Parameters
tThe scalar divisor.
Returns
A reference to itself.

◆ assign()

template<typename V >
template<typename E >
HomogenousCoordsAdapter& CDPL::Math::HomogenousCoordsAdapter< V >::assign ( const VectorExpression< E > &  e)
inline

Assigns the vector expression e to this view without intermediate temporary.

Template Parameters
EThe source vector expression type.
Parameters
eThe source vector expression.
Returns
A reference to itself.

◆ plusAssign()

template<typename V >
template<typename E >
HomogenousCoordsAdapter& CDPL::Math::HomogenousCoordsAdapter< V >::plusAssign ( const VectorExpression< E > &  e)
inline

Adds the vector expression e to this view without intermediate temporary.

Template Parameters
EThe source vector expression type.
Parameters
eThe source vector expression.
Returns
A reference to itself.

◆ minusAssign()

template<typename V >
template<typename E >
HomogenousCoordsAdapter& CDPL::Math::HomogenousCoordsAdapter< V >::minusAssign ( const VectorExpression< E > &  e)
inline

Subtracts the vector expression e from this view without intermediate temporary.

Template Parameters
EThe source vector expression type.
Parameters
eThe source vector expression.
Returns
A reference to itself.

◆ swap()

template<typename V >
void CDPL::Math::HomogenousCoordsAdapter< V >::swap ( HomogenousCoordsAdapter< V > &  va)
inline

Swaps the contents of this view with those of va.

Parameters
vaThe view to swap with.

Friends And Related Function Documentation

◆ swap

template<typename V >
void swap ( HomogenousCoordsAdapter< V > &  va1,
HomogenousCoordsAdapter< V > &  va2 
)
friend

ADL-enabled free-function form of swap().

Parameters
va1The first adapter.
va2The second adapter.

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