NSCore::IntToFloat Class Reference

Converts int-signals into float-signals and backwards. More...

#include <inttofloat.h>

Inheritance diagram for NSCore::IntToFloat:

QObject
Collaboration diagram for NSCore::IntToFloat:

Collaboration graph
[legend]

List of all members.

Public Slots

void value (int n)
 convert int to double
void value (double n)
 convert double to int

Signals

void valueChanged (double)
 Announce the new double value.
void valueChanged (int)
 Announce the new int value.

Public Member Functions

 IntToFloat (double precision, QObject *p)
 Creates a new Integer-to-Double-converter with the given precision.
 IntToFloat (double precision, NSCore::NamedParameterTreeItem *item, QObject *p)
 Creates a new Integer-to-Double-converter with the given precision and connects to the given NSCore::NamedParameterTreeItem.

Private Attributes

double _precision
NSCore::NamedParameterTreeItem_parameter


Detailed Description

Converts int-signals into float-signals and backwards.

IntToFloat converts int-signals to float-signals with a given precision.

The precision means that that the int is multiplied with precision to form the float value. So an int of 8 times a precision of 1E-2 gives 0.08 for the result. The conversion backwards is also done by this class.


Constructor & Destructor Documentation

NSCore::IntToFloat::IntToFloat ( double  precision,
QObject p 
) [inline]

Creates a new Integer-to-Double-converter with the given precision.

Parameters:
precision should be given in the style 1E-3
p the parent QObject

NSCore::IntToFloat::IntToFloat ( double  precision,
NSCore::NamedParameterTreeItem item,
QObject p 
)

Creates a new Integer-to-Double-converter with the given precision and connects to the given NSCore::NamedParameterTreeItem.

Parameters:
precision should be given in the style 1E-3
item the NamedParameterTreeItem to connect to
p the parent QObject


Member Function Documentation

void NSCore::IntToFloat::value ( int  n  )  [inline, slot]

convert int to double

This function converts the given integer to a float by multiplying with the precision given at creation-time.

References _precision, and valueChanged().

void NSCore::IntToFloat::value ( double  n  )  [inline, slot]

convert double to int

This function converts the given double to an int by dividing with the precision and rounding to int.

References _precision, and valueChanged().

void NSCore::IntToFloat::valueChanged ( double   )  [signal]

Announce the new double value.

Referenced by value().

void NSCore::IntToFloat::valueChanged ( int   )  [signal]

Announce the new int value.


Member Data Documentation

Referenced by value().


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

Generated on Tue Apr 12 02:10:26 2011 for epos by  doxygen 1.5.5