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

Quaternion expression that exposes a 4-element vector as a quaternion (component indices 0-3 map to C1-C4). More...

#include <VectorAdapter.hpp>

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

Public Types

typedef V VectorType
 The wrapped 4-element vector type. More...
 
typedef V::ValueType ValueType
 The element value type. More...
 
typedef V::ConstReference ConstReference
 Constant reference type to a component. 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. 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::QuaternionExpression< VectorQuaternionAdapter< V > >
typedef VectorQuaternionAdapter< V > ExpressionType
 The derived quaternion 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

 VectorQuaternionAdapter (VectorType &v)
 Constructs the adapter wrapping the 4-element vector v. More...
 
Reference getC1 ()
 Returns a mutable reference to component C1 (mapped to element 0 of the wrapped vector). More...
 
Reference getC2 ()
 Returns a mutable reference to component C2 (mapped to element 1 of the wrapped vector). More...
 
Reference getC3 ()
 Returns a mutable reference to component C3 (mapped to element 2 of the wrapped vector). More...
 
Reference getC4 ()
 Returns a mutable reference to component C4 (mapped to element 3 of the wrapped vector). More...
 
ConstReference getC1 () const
 Returns a const reference to component C1. More...
 
ConstReference getC2 () const
 Returns a const reference to component C2. More...
 
ConstReference getC3 () const
 Returns a const reference to component C3. More...
 
ConstReference getC4 () const
 Returns a const reference to component C4. 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...
 
VectorQuaternionAdapteroperator= (const VectorQuaternionAdapter &a)
 Copies the components of a into this view (writing through to the wrapped vector). More...
 
template<typename E >
VectorQuaternionAdapteroperator= (const QuaternionExpression< E > &e)
 Assigns the quaternion expression e to this view (writing through to the wrapped vector). More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, VectorQuaternionAdapter >::type & operator= (const T &t)
 Assigns the scalar t to this view (sets C1 to t and the remaining components to the default value). More...
 
template<typename E >
VectorQuaternionAdapteroperator+= (const QuaternionExpression< E > &e)
 Adds the quaternion expression e componentwise to this view. More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, VectorQuaternionAdapter >::type & operator+= (const T &t)
 Adds the scalar t to component C1 of this view. More...
 
template<typename E >
VectorQuaternionAdapteroperator-= (const QuaternionExpression< E > &e)
 Subtracts the quaternion expression e componentwise from this view. More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, VectorQuaternionAdapter >::type & operator-= (const T &t)
 Subtracts the scalar t from component C1 of this view. More...
 
template<typename E >
VectorQuaternionAdapteroperator*= (const QuaternionExpression< E > &e)
 Multiplies this view by the quaternion expression e (Hamilton-product semantics). More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, VectorQuaternionAdapter >::type & operator*= (const T &t)
 Multiplies every component of this view by the scalar t. More...
 
template<typename E >
VectorQuaternionAdapteroperator/= (const QuaternionExpression< E > &e)
 Divides this view by the quaternion expression e (Hamilton-quotient semantics). More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, VectorQuaternionAdapter >::type & operator/= (const T &t)
 Divides every component of this view by the scalar t. More...
 
template<typename E >
VectorQuaternionAdapterassign (const QuaternionExpression< E > &e)
 Assigns the quaternion expression e to this view without intermediate temporary (use only when e does not alias the wrapped vector). More...
 
template<typename E >
VectorQuaternionAdapterplusAssign (const QuaternionExpression< E > &e)
 Adds the quaternion expression e to this view without intermediate temporary. More...
 
template<typename E >
VectorQuaternionAdapterminusAssign (const QuaternionExpression< E > &e)
 Subtracts the quaternion expression e from this view without intermediate temporary. More...
 
void swap (VectorQuaternionAdapter &a)
 Swaps the components of this view with those of a. More...
 
void set (const ValueType &c1=ValueType(), const ValueType &c2=ValueType(), const ValueType &c3=ValueType(), const ValueType &c4=ValueType())
 Assigns the four supplied component values to this view (writing through to the wrapped vector). More...
 
- Public Member Functions inherited from CDPL::Math::QuaternionExpression< VectorQuaternionAdapter< V > >
const ExpressionTypeoperator() () const
 Returns a const reference to the derived quaternion expression. More...
 
ExpressionTypeoperator() ()
 Returns a reference to the derived quaternion expression. More...
 

Friends

void swap (VectorQuaternionAdapter &a1, VectorQuaternionAdapter &a2)
 ADL-enabled free-function form of swap(). More...
 

Additional Inherited Members

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

Detailed Description

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

Quaternion expression that exposes a 4-element vector as a quaternion (component indices 0-3 map to C1-C4).

Template Parameters
VThe wrapped 4-element vector type.

Member Typedef Documentation

◆ VectorType

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

The wrapped 4-element vector type.

◆ ValueType

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

The element value type.

◆ ConstReference

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

Constant reference type to a component.

◆ Reference

template<typename V >
typedef std::conditional<std::is_const<V>::value, typename V::ConstReference, typename V::Reference>::type CDPL::Math::VectorQuaternionAdapter< 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::VectorQuaternionAdapter< V >::VectorClosureType

Closure type used to store the wrapped vector internally.

◆ ConstClosureType

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

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

◆ ClosureType

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

Closure type used when this adapter appears inside another expression.

Constructor & Destructor Documentation

◆ VectorQuaternionAdapter()

template<typename V >
CDPL::Math::VectorQuaternionAdapter< V >::VectorQuaternionAdapter ( VectorType v)
inlineexplicit

Constructs the adapter wrapping the 4-element vector v.

Parameters
vThe 4-element vector to be viewed as a quaternion.

Member Function Documentation

◆ getC1() [1/2]

template<typename V >
Reference CDPL::Math::VectorQuaternionAdapter< V >::getC1 ( )
inline

Returns a mutable reference to component C1 (mapped to element 0 of the wrapped vector).

Returns
A mutable reference to C1.

◆ getC2() [1/2]

template<typename V >
Reference CDPL::Math::VectorQuaternionAdapter< V >::getC2 ( )
inline

Returns a mutable reference to component C2 (mapped to element 1 of the wrapped vector).

Returns
A mutable reference to C2.

◆ getC3() [1/2]

template<typename V >
Reference CDPL::Math::VectorQuaternionAdapter< V >::getC3 ( )
inline

Returns a mutable reference to component C3 (mapped to element 2 of the wrapped vector).

Returns
A mutable reference to C3.

◆ getC4() [1/2]

template<typename V >
Reference CDPL::Math::VectorQuaternionAdapter< V >::getC4 ( )
inline

Returns a mutable reference to component C4 (mapped to element 3 of the wrapped vector).

Returns
A mutable reference to C4.

◆ getC1() [2/2]

template<typename V >
ConstReference CDPL::Math::VectorQuaternionAdapter< V >::getC1 ( ) const
inline

Returns a const reference to component C1.

Returns
A const reference to C1.

◆ getC2() [2/2]

template<typename V >
ConstReference CDPL::Math::VectorQuaternionAdapter< V >::getC2 ( ) const
inline

Returns a const reference to component C2.

Returns
A const reference to C2.

◆ getC3() [2/2]

template<typename V >
ConstReference CDPL::Math::VectorQuaternionAdapter< V >::getC3 ( ) const
inline

Returns a const reference to component C3.

Returns
A const reference to C3.

◆ getC4() [2/2]

template<typename V >
ConstReference CDPL::Math::VectorQuaternionAdapter< V >::getC4 ( ) const
inline

Returns a const reference to component C4.

Returns
A const reference to C4.

◆ getData() [1/2]

template<typename V >
VectorClosureType& CDPL::Math::VectorQuaternionAdapter< 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::VectorQuaternionAdapter< 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/3]

template<typename V >
VectorQuaternionAdapter& CDPL::Math::VectorQuaternionAdapter< V >::operator= ( const VectorQuaternionAdapter< V > &  a)
inline

Copies the components of a into this view (writing through to the wrapped vector).

Parameters
aThe source adapter.
Returns
A reference to itself.

◆ operator=() [2/3]

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

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

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

◆ operator=() [3/3]

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

Assigns the scalar t to this view (sets C1 to t and the remaining components to the default value).

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

◆ operator+=() [1/2]

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

Adds the quaternion expression e componentwise to this view.

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

◆ operator+=() [2/2]

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

Adds the scalar t to component C1 of this view.

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

◆ operator-=() [1/2]

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

Subtracts the quaternion expression e componentwise from this view.

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

◆ operator-=() [2/2]

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

Subtracts the scalar t from component C1 of this view.

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

◆ operator*=() [1/2]

template<typename V >
template<typename E >
VectorQuaternionAdapter& CDPL::Math::VectorQuaternionAdapter< V >::operator*= ( const QuaternionExpression< E > &  e)
inline

Multiplies this view by the quaternion expression e (Hamilton-product semantics).

Template Parameters
EThe source quaternion expression type.
Parameters
eThe quaternion expression to multiply by.
Returns
A reference to itself.

◆ operator*=() [2/2]

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

Multiplies every component of this view by the scalar t.

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

◆ operator/=() [1/2]

template<typename V >
template<typename E >
VectorQuaternionAdapter& CDPL::Math::VectorQuaternionAdapter< V >::operator/= ( const QuaternionExpression< E > &  e)
inline

Divides this view by the quaternion expression e (Hamilton-quotient semantics).

Template Parameters
EThe source quaternion expression type.
Parameters
eThe quaternion expression to divide by.
Returns
A reference to itself.

◆ operator/=() [2/2]

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

Divides every component 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 >
VectorQuaternionAdapter& CDPL::Math::VectorQuaternionAdapter< V >::assign ( const QuaternionExpression< E > &  e)
inline

Assigns the quaternion expression e to this view without intermediate temporary (use only when e does not alias the wrapped vector).

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

◆ plusAssign()

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

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

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

◆ minusAssign()

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

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

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

◆ swap()

template<typename V >
void CDPL::Math::VectorQuaternionAdapter< V >::swap ( VectorQuaternionAdapter< V > &  a)
inline

Swaps the components of this view with those of a.

Parameters
aThe adapter to swap with.

◆ set()

template<typename V >
void CDPL::Math::VectorQuaternionAdapter< V >::set ( const ValueType c1 = ValueType(),
const ValueType c2 = ValueType(),
const ValueType c3 = ValueType(),
const ValueType c4 = ValueType() 
)
inline

Assigns the four supplied component values to this view (writing through to the wrapped vector).

Parameters
c1The C1 component value.
c2The C2 component value.
c3The C3 component value.
c4The C4 component value.

Friends And Related Function Documentation

◆ swap

template<typename V >
void swap ( VectorQuaternionAdapter< V > &  a1,
VectorQuaternionAdapter< V > &  a2 
)
friend

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

Parameters
a1The first adapter.
a2The second adapter.

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