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

Lightweight quaternion expression that proxies a reference to an underlying quaternion container. More...

#include <Quaternion.hpp>

+ Inheritance diagram for CDPL::Math::QuaternionReference< Q >:

Public Types

typedef Q QuaternionType
 The wrapped quaternion type. More...
 
typedef Q::ValueType ValueType
 The scalar component value type of the wrapped quaternion. More...
 
typedef std::conditional< std::is_const< Q >::value, typename Q::ConstReference, typename Q::Reference >::type Reference
 Mutable component reference type (degrades to ConstReference when the wrapped quaternion is const). More...
 
typedef Q::ConstReference ConstReference
 Constant component reference type. More...
 
typedef SelfType ClosureType
 Closure type used when this proxy appears inside another expression. More...
 
typedef const SelfType ConstClosureType
 Constant closure type used when this proxy appears inside another expression. More...
 
- Public Types inherited from CDPL::Math::QuaternionExpression< QuaternionReference< Q > >
typedef QuaternionReference< Q > ExpressionType
 The derived quaternion expression type. More...
 
- Public Types inherited from CDPL::Math::Expression< E >
typedef E ExpressionType
 The derived expression type. More...
 

Public Member Functions

 QuaternionReference (QuaternionType &q)
 Constructs the reference proxy referring to q. More...
 
Reference getC1 ()
 Returns a mutable reference to the real component C1. More...
 
Reference getC2 ()
 Returns a mutable reference to the imaginary component C2. More...
 
Reference getC3 ()
 Returns a mutable reference to the imaginary component C3. More...
 
Reference getC4 ()
 Returns a mutable reference to the imaginary component C4. More...
 
ConstReference getC1 () const
 Returns a const reference to the real component C1. More...
 
ConstReference getC2 () const
 Returns a const reference to the imaginary component C2. More...
 
ConstReference getC3 () const
 Returns a const reference to the imaginary component C3. More...
 
ConstReference getC4 () const
 Returns a const reference to the imaginary component C4. More...
 
const QuaternionTypegetData () const
 Returns a const reference to the wrapped quaternion. More...
 
QuaternionTypegetData ()
 Returns a reference to the wrapped quaternion. More...
 
QuaternionReferenceoperator= (const QuaternionReference &r)
 Copy-assigns the wrapped quaternion from the quaternion referenced by r. More...
 
template<typename E >
QuaternionReferenceoperator= (const QuaternionExpression< E > &e)
 Assigns the quaternion expression e to the wrapped quaternion. More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, QuaternionReference >::type & operator= (const T &t)
 Assigns the scalar t to the real component of the wrapped quaternion (other components are zeroed). More...
 
template<typename E >
QuaternionReferenceoperator+= (const QuaternionExpression< E > &e)
 Adds the quaternion expression e component-wise to the wrapped quaternion. More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, QuaternionReference >::type & operator+= (const T &t)
 Adds the scalar t to the real component of the wrapped quaternion. More...
 
template<typename E >
QuaternionReferenceoperator-= (const QuaternionExpression< E > &e)
 Subtracts the quaternion expression e component-wise from the wrapped quaternion. More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, QuaternionReference >::type & operator-= (const T &t)
 Subtracts the scalar t from the real component of the wrapped quaternion. More...
 
template<typename E >
QuaternionReferenceoperator*= (const QuaternionExpression< E > &e)
 Right-multiplies the wrapped quaternion by the quaternion expression e (Hamilton product). More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, QuaternionReference >::type & operator*= (const T &t)
 Multiplies every component of the wrapped quaternion by the scalar t. More...
 
template<typename E >
QuaternionReferenceoperator/= (const QuaternionExpression< E > &e)
 Right-divides the wrapped quaternion by the quaternion expression e (Hamilton-product inverse). More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, QuaternionReference >::type & operator/= (const T &t)
 Divides every component of the wrapped quaternion by the scalar t. More...
 
template<typename E >
QuaternionReferenceassign (const QuaternionExpression< E > &e)
 Assigns the quaternion expression e to the wrapped quaternion without intermediate temporary. More...
 
template<typename E >
QuaternionReferenceplusAssign (const QuaternionExpression< E > &e)
 Adds the quaternion expression e to the wrapped quaternion without intermediate temporary. More...
 
template<typename E >
QuaternionReferenceminusAssign (const QuaternionExpression< E > &e)
 Subtracts the quaternion expression e from the wrapped quaternion without intermediate temporary. More...
 
void swap (QuaternionReference &r)
 Swaps the contents of the two wrapped quaternions. More...
 
void set (const ValueType &c1=ValueType(), const ValueType &c2=ValueType(), const ValueType &c3=ValueType(), const ValueType &c4=ValueType())
 Sets the components of the wrapped quaternion to the supplied values (omitted components default to the value-initialized ValueType). More...
 
- Public Member Functions inherited from CDPL::Math::QuaternionExpression< QuaternionReference< Q > >
const ExpressionTypeoperator() () const
 Returns a const reference to the derived quaternion expression class instance. More...
 
ExpressionTypeoperator() ()
 Returns a reference to the derived quaternion expression class instance. More...
 

Friends

void swap (QuaternionReference &r1, QuaternionReference &r2)
 ADL-enabled free-function form of swap(). More...
 

Additional Inherited Members

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

Detailed Description

template<typename Q>
class CDPL::Math::QuaternionReference< Q >

Lightweight quaternion expression that proxies a reference to an underlying quaternion container.

Template Parameters
QThe wrapped quaternion type.

Member Typedef Documentation

◆ QuaternionType

template<typename Q >
typedef Q CDPL::Math::QuaternionReference< Q >::QuaternionType

The wrapped quaternion type.

◆ ValueType

template<typename Q >
typedef Q::ValueType CDPL::Math::QuaternionReference< Q >::ValueType

The scalar component value type of the wrapped quaternion.

◆ Reference

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

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

◆ ConstReference

template<typename Q >
typedef Q::ConstReference CDPL::Math::QuaternionReference< Q >::ConstReference

Constant component reference type.

◆ ClosureType

template<typename Q >
typedef SelfType CDPL::Math::QuaternionReference< Q >::ClosureType

Closure type used when this proxy appears inside another expression.

◆ ConstClosureType

template<typename Q >
typedef const SelfType CDPL::Math::QuaternionReference< Q >::ConstClosureType

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

Constructor & Destructor Documentation

◆ QuaternionReference()

template<typename Q >
CDPL::Math::QuaternionReference< Q >::QuaternionReference ( QuaternionType q)
inlineexplicit

Constructs the reference proxy referring to q.

Parameters
qThe wrapped quaternion to proxy.

Member Function Documentation

◆ getC1() [1/2]

template<typename Q >
Reference CDPL::Math::QuaternionReference< Q >::getC1 ( )
inline

Returns a mutable reference to the real component C1.

Returns
A mutable reference to C1.

◆ getC2() [1/2]

template<typename Q >
Reference CDPL::Math::QuaternionReference< Q >::getC2 ( )
inline

Returns a mutable reference to the imaginary component C2.

Returns
A mutable reference to C2.

◆ getC3() [1/2]

template<typename Q >
Reference CDPL::Math::QuaternionReference< Q >::getC3 ( )
inline

Returns a mutable reference to the imaginary component C3.

Returns
A mutable reference to C3.

◆ getC4() [1/2]

template<typename Q >
Reference CDPL::Math::QuaternionReference< Q >::getC4 ( )
inline

Returns a mutable reference to the imaginary component C4.

Returns
A mutable reference to C4.

◆ getC1() [2/2]

template<typename Q >
ConstReference CDPL::Math::QuaternionReference< Q >::getC1 ( ) const
inline

Returns a const reference to the real component C1.

Returns
A const reference to C1.

◆ getC2() [2/2]

template<typename Q >
ConstReference CDPL::Math::QuaternionReference< Q >::getC2 ( ) const
inline

Returns a const reference to the imaginary component C2.

Returns
A const reference to C2.

◆ getC3() [2/2]

template<typename Q >
ConstReference CDPL::Math::QuaternionReference< Q >::getC3 ( ) const
inline

Returns a const reference to the imaginary component C3.

Returns
A const reference to C3.

◆ getC4() [2/2]

template<typename Q >
ConstReference CDPL::Math::QuaternionReference< Q >::getC4 ( ) const
inline

Returns a const reference to the imaginary component C4.

Returns
A const reference to C4.

◆ getData() [1/2]

template<typename Q >
const QuaternionType& CDPL::Math::QuaternionReference< Q >::getData ( ) const
inline

Returns a const reference to the wrapped quaternion.

Returns
A const reference to the wrapped quaternion.

◆ getData() [2/2]

template<typename Q >
QuaternionType& CDPL::Math::QuaternionReference< Q >::getData ( )
inline

Returns a reference to the wrapped quaternion.

Returns
A reference to the wrapped quaternion.

◆ operator=() [1/3]

template<typename Q >
QuaternionReference& CDPL::Math::QuaternionReference< Q >::operator= ( const QuaternionReference< Q > &  r)
inline

Copy-assigns the wrapped quaternion from the quaternion referenced by r.

Parameters
rThe source reference proxy.
Returns
A reference to itself.

◆ operator=() [2/3]

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

Assigns the quaternion expression e to the wrapped quaternion.

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

◆ operator=() [3/3]

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

Assigns the scalar t to the real component of the wrapped quaternion (other components are zeroed).

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

◆ operator+=() [1/2]

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

Adds the quaternion expression e component-wise to the wrapped quaternion.

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

◆ operator+=() [2/2]

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

Adds the scalar t to the real component of the wrapped quaternion.

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

◆ operator-=() [1/2]

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

Subtracts the quaternion expression e component-wise from the wrapped quaternion.

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

◆ operator-=() [2/2]

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

Subtracts the scalar t from the real component of the wrapped quaternion.

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

◆ operator*=() [1/2]

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

Right-multiplies the wrapped quaternion by the quaternion expression e (Hamilton product).

Template Parameters
EThe right-hand quaternion expression type.
Parameters
eThe right-hand quaternion expression.
Returns
A reference to itself.

◆ operator*=() [2/2]

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

Multiplies every component of the wrapped quaternion by the scalar t.

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

◆ operator/=() [1/2]

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

Right-divides the wrapped quaternion by the quaternion expression e (Hamilton-product inverse).

Template Parameters
EThe right-hand quaternion expression type.
Parameters
eThe right-hand quaternion expression.
Returns
A reference to itself.

◆ operator/=() [2/2]

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

Divides every component of the wrapped quaternion by the scalar t.

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

◆ assign()

template<typename Q >
template<typename E >
QuaternionReference& CDPL::Math::QuaternionReference< Q >::assign ( const QuaternionExpression< E > &  e)
inline

Assigns the quaternion expression e to the wrapped quaternion without intermediate temporary.

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

◆ plusAssign()

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

Adds the quaternion expression e to the wrapped quaternion without intermediate temporary.

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

◆ minusAssign()

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

Subtracts the quaternion expression e from the wrapped quaternion without intermediate temporary.

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

◆ swap()

template<typename Q >
void CDPL::Math::QuaternionReference< Q >::swap ( QuaternionReference< Q > &  r)
inline

Swaps the contents of the two wrapped quaternions.

Parameters
rThe reference proxy to swap with.

◆ set()

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

Sets the components of the wrapped quaternion to the supplied values (omitted components default to the value-initialized ValueType).

Parameters
c1The real component.
c2The first imaginary component.
c3The second imaginary component.
c4The third imaginary component.

Friends And Related Function Documentation

◆ swap

template<typename Q >
void swap ( QuaternionReference< Q > &  r1,
QuaternionReference< Q > &  r2 
)
friend

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

Parameters
r1The first reference proxy.
r2The second reference proxy.

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