vrpn 07.35
Virtual Reality Peripheral Network
Loading...
Searching...
No Matches
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED > Class Template Reference

A fixed-point value class. More...

#include <vrpn_FixedPoint.h>

Public Types

typedef detail::IntegerOfSizeAndSignedness< INTEGER_BITS, SIGNED >::type IntegerType
 Find an integer type large enough to hold INTEGER_BITS.
 
typedef detail::IntegerOfSizeAndSignedness< INTEGER_BITS+FRACTIONAL_BITS, SIGNED >::type RawType
 

Public Member Functions

Constructors.

The bits of an integral type passed to the constructor will be interpreted as as fixed-point value.

A floating-point type passed to the constructor will be converted to a fixed-point value.

 FixedPoint ()
 
 FixedPoint (typename detail::IntegerOfSizeAndSignedness< 8, SIGNED >::type x)
 
 FixedPoint (typename detail::IntegerOfSizeAndSignedness< 16, SIGNED >::type x)
 
 FixedPoint (typename detail::IntegerOfSizeAndSignedness< 32, SIGNED >::type x)
 
 FixedPoint (double x)
 
 FixedPoint (float x)
 
template<typename T >
get () const
 Returns a floating-point representation of this fixed-point value.
 
Debugging functions.
RawType value () const
 

Detailed Description

template<int INTEGER_BITS, int FRACTIONAL_BITS, bool SIGNED = true>
class vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >

A fixed-point value class.

All values are signed, two's-complement, by default.

Template Parameters
INTEGER_BITSThe number of bits devoted to the integer part.
FRACTIONAL_BITSThe number of bits devoted to the fractional part.

Definition at line 106 of file vrpn_FixedPoint.h.

Member Typedef Documentation

◆ IntegerType

template<int INTEGER_BITS, int FRACTIONAL_BITS, bool SIGNED = true>
typedef detail::IntegerOfSizeAndSignedness<INTEGER_BITS,SIGNED>::type vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >::IntegerType

Find an integer type large enough to hold INTEGER_BITS.

Definition at line 112 of file vrpn_FixedPoint.h.

◆ RawType

template<int INTEGER_BITS, int FRACTIONAL_BITS, bool SIGNED = true>
typedef detail::IntegerOfSizeAndSignedness<INTEGER_BITS+FRACTIONAL_BITS,SIGNED>::type vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >::RawType

Definition at line 115 of file vrpn_FixedPoint.h.

Constructor & Destructor Documentation

◆ FixedPoint() [1/6]

template<int INTEGER_BITS, int FRACTIONAL_BITS, bool SIGNED = true>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >::FixedPoint ( )
inline

Definition at line 125 of file vrpn_FixedPoint.h.

◆ FixedPoint() [2/6]

template<int INTEGER_BITS, int FRACTIONAL_BITS, bool SIGNED = true>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >::FixedPoint ( typename detail::IntegerOfSizeAndSignedness< 8, SIGNED >::type x)
inlineexplicit

Definition at line 129 of file vrpn_FixedPoint.h.

◆ FixedPoint() [3/6]

template<int INTEGER_BITS, int FRACTIONAL_BITS, bool SIGNED = true>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >::FixedPoint ( typename detail::IntegerOfSizeAndSignedness< 16, SIGNED >::type x)
inlineexplicit

Definition at line 134 of file vrpn_FixedPoint.h.

◆ FixedPoint() [4/6]

template<int INTEGER_BITS, int FRACTIONAL_BITS, bool SIGNED = true>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >::FixedPoint ( typename detail::IntegerOfSizeAndSignedness< 32, SIGNED >::type x)
inlineexplicit

Definition at line 139 of file vrpn_FixedPoint.h.

◆ FixedPoint() [5/6]

template<int INTEGER_BITS, int FRACTIONAL_BITS, bool SIGNED = true>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >::FixedPoint ( double x)
inlineexplicit

Definition at line 144 of file vrpn_FixedPoint.h.

◆ FixedPoint() [6/6]

template<int INTEGER_BITS, int FRACTIONAL_BITS, bool SIGNED = true>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >::FixedPoint ( float x)
inlineexplicit

Definition at line 148 of file vrpn_FixedPoint.h.

Member Function Documentation

◆ get()

template<int INTEGER_BITS, int FRACTIONAL_BITS, bool SIGNED = true>
template<typename T >
T vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >::get ( ) const
inline

Returns a floating-point representation of this fixed-point value.

Todo
add operators, lots and lots of operators?

Definition at line 160 of file vrpn_FixedPoint.h.

References vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >::get().

Referenced by vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >::get(), and vrpn_Tracker_OSVRHackerDevKit::on_data_received().

Here is the call graph for this function:

◆ value()

template<int INTEGER_BITS, int FRACTIONAL_BITS, bool SIGNED = true>
RawType vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS, SIGNED >::value ( ) const
inline
Todo
remove these functions after debugging

Definition at line 168 of file vrpn_FixedPoint.h.


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