vrpn  07.33
Virtual Reality Peripheral Network
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS > Class Template Reference

A fixed-point value class. More...

#include <vrpn_FixedPoint.h>

Public Types

typedef detail::IntegerOfSize< INTEGER_BITS >::type IntegerType
 Find an integer type large enough to hold INTEGER_BITS. More...
 
typedef detail::IntegerOfSize< INTEGER_BITS+FRACTIONAL_BITS >::type RawType
 

Public Member Functions

template<typename T >
get () const
 Returns a floating-point representation of this fixed-point value. More...
 
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 (vrpn_int8 x)
 
 FixedPoint (vrpn_int16 x)
 
 FixedPoint (vrpn_int32 x)
 
 FixedPoint (vrpn_uint8 x)
 
 FixedPoint (vrpn_uint16 x)
 
 FixedPoint (vrpn_uint32 x)
 
 FixedPoint (double x)
 
 FixedPoint (float x)
 
Debugging functions.
RawType value () const
 

Detailed Description

template<int INTEGER_BITS, int FRACTIONAL_BITS>
class vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS >

A fixed-point value class.

All values are signed, two's-complement.

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

Definition at line 80 of file vrpn_FixedPoint.h.

Member Typedef Documentation

◆ IntegerType

template<int INTEGER_BITS, int FRACTIONAL_BITS>
typedef detail::IntegerOfSize<INTEGER_BITS>::type vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS >::IntegerType

Find an integer type large enough to hold INTEGER_BITS.

Definition at line 85 of file vrpn_FixedPoint.h.

◆ RawType

template<int INTEGER_BITS, int FRACTIONAL_BITS>
typedef detail::IntegerOfSize<INTEGER_BITS + FRACTIONAL_BITS>::type vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS >::RawType

Definition at line 88 of file vrpn_FixedPoint.h.

Constructor & Destructor Documentation

◆ FixedPoint() [1/9]

template<int INTEGER_BITS, int FRACTIONAL_BITS>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS >::FixedPoint ( )
inline

Definition at line 99 of file vrpn_FixedPoint.h.

◆ FixedPoint() [2/9]

template<int INTEGER_BITS, int FRACTIONAL_BITS>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS >::FixedPoint ( vrpn_int8  x)
inlineexplicit

Definition at line 103 of file vrpn_FixedPoint.h.

◆ FixedPoint() [3/9]

template<int INTEGER_BITS, int FRACTIONAL_BITS>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS >::FixedPoint ( vrpn_int16  x)
inlineexplicit

Definition at line 107 of file vrpn_FixedPoint.h.

◆ FixedPoint() [4/9]

template<int INTEGER_BITS, int FRACTIONAL_BITS>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS >::FixedPoint ( vrpn_int32  x)
inlineexplicit

Definition at line 111 of file vrpn_FixedPoint.h.

◆ FixedPoint() [5/9]

template<int INTEGER_BITS, int FRACTIONAL_BITS>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS >::FixedPoint ( vrpn_uint8  x)
inlineexplicit

Definition at line 115 of file vrpn_FixedPoint.h.

◆ FixedPoint() [6/9]

template<int INTEGER_BITS, int FRACTIONAL_BITS>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS >::FixedPoint ( vrpn_uint16  x)
inlineexplicit

Definition at line 119 of file vrpn_FixedPoint.h.

◆ FixedPoint() [7/9]

template<int INTEGER_BITS, int FRACTIONAL_BITS>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS >::FixedPoint ( vrpn_uint32  x)
inlineexplicit

Definition at line 123 of file vrpn_FixedPoint.h.

◆ FixedPoint() [8/9]

template<int INTEGER_BITS, int FRACTIONAL_BITS>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS >::FixedPoint ( double  x)
inlineexplicit

Definition at line 127 of file vrpn_FixedPoint.h.

◆ FixedPoint() [9/9]

template<int INTEGER_BITS, int FRACTIONAL_BITS>
vrpn::FixedPoint< INTEGER_BITS, FRACTIONAL_BITS >::FixedPoint ( float  x)
inlineexplicit

Definition at line 131 of file vrpn_FixedPoint.h.

Member Function Documentation

◆ get()

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

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

Todo:
add operators, lots and lots of operators?

Definition at line 143 of file vrpn_FixedPoint.h.

◆ value()

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

Definition at line 151 of file vrpn_FixedPoint.h.


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