Class for floating values restricted to the interval [0..1] and discretized with n bits. More...
#include <float01.hh>
Public Types | |
typedef Floating< void > | category |
typedef std::pair< unsigned, unsigned long > | enc |
Encoding associated type. | |
typedef float | equiv |
Equivalent associated type. | |
typedef float01 | exact_t |
Public Member Functions | |
float01 () | |
Ctor. | |
template<unsigned n> | |
float01 (const float01_< n > &val) | |
Ctor. | |
float01 (unsigned nbits, float val) | |
Ctor. | |
unsigned | nbits () const |
Access to the encoding size. | |
operator float () const | |
Conversion to float. | |
float01 & | set_nbits (unsigned nbits) |
Set the encoding size to nbits. | |
const float01 | to_nbits (unsigned nbits) const |
Return an equivalent gray encoded on nbits bits. | |
float | value () const |
Access to std type. | |
unsigned long | value_ind () const |
Access to the position in the quantized interval. | |
Protected Attributes | |
unsigned | nbits_ |
Encoding size. | |
unsigned long | val_ |
Value. |
Class for floating values restricted to the interval [0..1] and discretized with n bits.
typedef Floating<void> mln::value::Floating< float01 >::category [inherited] |
Reimplemented from mln::value::Scalar< float01 >.
typedef std::pair<unsigned, unsigned long> mln::value::float01::enc |
Encoding associated type.
typedef float mln::value::float01::equiv |
Equivalent associated type.
typedef float01 mln::Object< float01 >::exact_t [inherited] |
mln::value::float01::float01 | ( | ) | [inline] |
Ctor.
mln::value::float01::float01 | ( | const float01_< n > & | val | ) | [inline] |
Ctor.
mln::value::float01::float01 | ( | unsigned | nbits, | |
float | val | |||
) | [inline] |
Ctor.
References mln::value::internal::two_pow_n_minus_1(), and val_.
unsigned mln::value::float01::nbits | ( | ) | const [inline] |
Access to the encoding size.
References nbits_.
Referenced by mln::value::operator<(), mln::value::operator<<(), and mln::value::operator==().
mln::value::float01::operator float | ( | ) | const [inline] |
Conversion to float.
References nbits_, mln::value::internal::two_pow_n_minus_1(), and val_.
float01 & mln::value::float01::set_nbits | ( | unsigned | nbits | ) | [inline] |
Set the encoding size to nbits.
References nbits_, mln::value::internal::two_pow_(), mln::value::internal::two_pow_n_minus_1(), and val_.
Referenced by to_nbits().
const float01 mln::value::float01::to_nbits | ( | unsigned | nbits | ) | const [inline] |
Return an equivalent gray encoded on nbits
bits.
References nbits_, and set_nbits().
Referenced by mln::value::operator<(), and mln::value::operator==().
float mln::value::float01::value | ( | ) | const [inline] |
Access to std type.
References nbits_, mln::value::internal::two_pow_n_minus_1(), and val_.
Referenced by mln::value::operator<(), and mln::value::operator<<().
unsigned long mln::value::float01::value_ind | ( | ) | const [inline] |
Access to the position in the quantized interval.
Referenced by mln::value::operator==().
unsigned mln::value::float01::nbits_ [protected] |
Encoding size.
Referenced by nbits(), operator float(), set_nbits(), to_nbits(), value(), and value_ind().
unsigned long mln::value::float01::val_ [protected] |
Referenced by float01(), operator float(), set_nbits(), value(), and value_ind().