115 INTEGER_BITS + FRACTIONAL_BITS, SIGNED>::type RawType;
130 typename detail::IntegerOfSizeAndSignedness<8, SIGNED>::type x)
135 typename detail::IntegerOfSizeAndSignedness<16, SIGNED>::type x)
140 typename detail::IntegerOfSizeAndSignedness<32, SIGNED>::type x)
144 explicit FixedPoint(
double x)
145 : value_(x * (1 << FRACTIONAL_BITS))
148 explicit FixedPoint(
float x)
149 : value_(x * (1 << FRACTIONAL_BITS))
160 template <
typename T> T
get()
const
162 return get(
reinterpret_cast<TypeWrapper<T> *
>(NULL));
168 RawType
value()
const {
return value_; }
172 template <
typename T>
struct TypeWrapper;
173 vrpn_float32
get(TypeWrapper<vrpn_float32> *)
const
175 return static_cast<vrpn_float32
>(value_) / (1 << FRACTIONAL_BITS);
178 vrpn_float64
get(TypeWrapper<vrpn_float64> *)
const
180 return static_cast<vrpn_float64
>(value_) / (1 << FRACTIONAL_BITS);