Methods for conversion to/from scaled integers and real numbers. More...
#include <scaledinteger.h>
Public Types | |
enum | Type { Byte = 10, Short, UShort, Int, UInt, Long, ULong } |
Enumerations of the different types of scaled integers. More... | |
Static Public Member Functions | |
static int | Write (Packet &packet, const LongFloat real, const LongFloat upper, const LongFloat lower, const Type type, const unsigned int pos=UINT_MAX) |
Convert a floating point value to a scaled integer and write to the packet. | |
static int | Read (const Packet &packet, LongFloat &val, const LongFloat upper, const LongFloat lower, const ScaledInteger::Type type, const unsigned int pos=UINT_MAX) |
Read a real number at the index in the packet that is a scaled int. | |
static double | ToDouble (const JAUS::Byte scaled, const double upper, const double lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static float | ToFloat (const JAUS::Byte scaled, const double upper, const double lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static JAUS::Byte | ToScaledByte (const double real, const double upper, const double lower) |
Converts from a real number to a Scaled Integer value. | |
static JAUS::Byte | ToScaledByte (const float real, const float upper, const float lower) |
Converts from a real number to a Scaled Integer value. | |
static double | ToDouble (const JAUS::Short scaled, const double upper, const double lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static float | ToFloat (const JAUS::Short scaled, const double upper, const double lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static JAUS::Short | ToScaledShort (const double real, const double upper, const double lower) |
Converts from a real number to a Scaled Integer value. | |
static JAUS::Short | ToScaledShort (const float real, const float upper, const float lower) |
Converts from a real number to a Scaled Integer value. | |
static double | ToDouble (const JAUS::UShort scaled, const double upper, const double lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static float | ToFloat (const JAUS::UShort scaled, const double upper, const double lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static JAUS::UShort | ToScaledUShort (const double real, const double upper, const double lower) |
Converts from a real number to a Scaled Integer value. | |
static JAUS::UShort | ToScaledUShort (const float real, const float upper, const float lower) |
Converts from a real number to a Scaled Integer value. | |
static double | ToDouble (const JAUS::Int scaled, double upper, double lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static float | ToFloat (const JAUS::Int scaled, const float upper, const float lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static JAUS::Int | ToScaledInt (const double real, double upper, double lower) |
Converts from a real number to a Scaled Integer value. | |
static JAUS::Int | ToScaledInt (const float real, const float upper, const float lower) |
Converts from a real number to a Scaled Integer value. | |
static double | ToDouble (const JAUS::UInt scaled, double upper, double lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static float | ToFloat (const JAUS::UInt scaled, const float upper, const float lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static JAUS::UInt | ToScaledUInt (const double real, double upper, double lower) |
Converts from a real number to a Scaled Integer value. | |
static JAUS::UInt | ToScaledUInt (const float real, const float upper, const float lower) |
Converts from a real number to a Scaled Integer value. | |
static double | ToDouble (const JAUS::Long scaled, double upper, double lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static float | ToFloat (const JAUS::Long scaled, const float upper, const float lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static JAUS::Long | ToScaledLong (const double real, double upper, double lower) |
Converts from a real number to a Scaled Integer value. | |
static JAUS::Long | ToScaledLong (const float real, const float upper, const float lower) |
Converts from a real number to a Scaled Integer value. | |
static double | ToDouble (const JAUS::ULong scaled, double upper, double lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static float | ToFloat (const JAUS::ULong scaled, const float upper, const float lower) |
Converts a scaled integer to a real number based on the upper and lower limits of the real number. | |
static JAUS::ULong | ToScaledULong (const double real, double upper, double lower) |
Converts from a real number to a Scaled Integer value. | |
static JAUS::ULong | ToScaledULong (const float real, const float upper, const float lower) |
Converts from a real number to a Scaled Integer value. |
Methods for conversion to/from scaled integers and real numbers.
Definition at line 55 of file scaledinteger.h.
Enumerations of the different types of scaled integers.
Definition at line 64 of file scaledinteger.h.
static int JAUS::ScaledInteger::Read | ( | const Packet & | packet, |
LongFloat & | val, | ||
const LongFloat | upper, | ||
const LongFloat | lower, | ||
const ScaledInteger::Type | type, | ||
const unsigned int | pos = UINT_MAX |
||
) | [inline, static] |
Read a real number at the index in the packet that is a scaled int.
[in] | packet | The packet to read from. |
[out] | val | The value read. |
[in] | upper | The upper limit of real. |
[in] | lower | The lower limit of real. |
[in] | type | What type of scaled integer to convert from (ScaledInteger::Int, ScaledInteger::UInt, ScaledInteger::Short, ScaledInteger::UShort, or ScaledInteger::Byte). |
[in] | pos | The byte position within the stream to read at. If pos is equal to UINT_MAX, then the internal read position is used, which is the default behavior. |
Definition at line 161 of file scaledinteger.h.
static double JAUS::ScaledInteger::ToDouble | ( | const JAUS::UShort | scaled, |
const double | upper, | ||
const double | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 384 of file scaledinteger.h.
static double JAUS::ScaledInteger::ToDouble | ( | const JAUS::UInt | scaled, |
double | upper, | ||
double | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 508 of file scaledinteger.h.
static double JAUS::ScaledInteger::ToDouble | ( | const JAUS::Long | scaled, |
double | upper, | ||
double | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 570 of file scaledinteger.h.
static double JAUS::ScaledInteger::ToDouble | ( | const JAUS::Byte | scaled, |
const double | upper, | ||
const double | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 260 of file scaledinteger.h.
static double JAUS::ScaledInteger::ToDouble | ( | const JAUS::ULong | scaled, |
double | upper, | ||
double | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 632 of file scaledinteger.h.
static double JAUS::ScaledInteger::ToDouble | ( | const JAUS::Short | scaled, |
const double | upper, | ||
const double | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 322 of file scaledinteger.h.
static double JAUS::ScaledInteger::ToDouble | ( | const JAUS::Int | scaled, |
double | upper, | ||
double | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 446 of file scaledinteger.h.
static float JAUS::ScaledInteger::ToFloat | ( | const JAUS::Int | scaled, |
const float | upper, | ||
const float | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 462 of file scaledinteger.h.
static float JAUS::ScaledInteger::ToFloat | ( | const JAUS::Short | scaled, |
const double | upper, | ||
const double | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 338 of file scaledinteger.h.
static float JAUS::ScaledInteger::ToFloat | ( | const JAUS::UInt | scaled, |
const float | upper, | ||
const float | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 524 of file scaledinteger.h.
static float JAUS::ScaledInteger::ToFloat | ( | const JAUS::Byte | scaled, |
const double | upper, | ||
const double | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 276 of file scaledinteger.h.
static float JAUS::ScaledInteger::ToFloat | ( | const JAUS::Long | scaled, |
const float | upper, | ||
const float | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 586 of file scaledinteger.h.
static float JAUS::ScaledInteger::ToFloat | ( | const JAUS::UShort | scaled, |
const double | upper, | ||
const double | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 400 of file scaledinteger.h.
static float JAUS::ScaledInteger::ToFloat | ( | const JAUS::ULong | scaled, |
const float | upper, | ||
const float | lower | ||
) | [inline, static] |
Converts a scaled integer to a real number based on the upper and lower limits of the real number.
[in] | scaled | Scaled integer to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 648 of file scaledinteger.h.
static JAUS::Byte JAUS::ScaledInteger::ToScaledByte | ( | const double | real, |
const double | upper, | ||
const double | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 291 of file scaledinteger.h.
static JAUS::Byte JAUS::ScaledInteger::ToScaledByte | ( | const float | real, |
const float | upper, | ||
const float | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 306 of file scaledinteger.h.
static JAUS::Int JAUS::ScaledInteger::ToScaledInt | ( | const double | real, |
double | upper, | ||
double | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 477 of file scaledinteger.h.
static JAUS::Int JAUS::ScaledInteger::ToScaledInt | ( | const float | real, |
const float | upper, | ||
const float | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 492 of file scaledinteger.h.
static JAUS::Long JAUS::ScaledInteger::ToScaledLong | ( | const float | real, |
const float | upper, | ||
const float | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 616 of file scaledinteger.h.
static JAUS::Long JAUS::ScaledInteger::ToScaledLong | ( | const double | real, |
double | upper, | ||
double | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 601 of file scaledinteger.h.
static JAUS::Short JAUS::ScaledInteger::ToScaledShort | ( | const double | real, |
const double | upper, | ||
const double | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 353 of file scaledinteger.h.
static JAUS::Short JAUS::ScaledInteger::ToScaledShort | ( | const float | real, |
const float | upper, | ||
const float | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 368 of file scaledinteger.h.
static JAUS::UInt JAUS::ScaledInteger::ToScaledUInt | ( | const double | real, |
double | upper, | ||
double | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 539 of file scaledinteger.h.
static JAUS::UInt JAUS::ScaledInteger::ToScaledUInt | ( | const float | real, |
const float | upper, | ||
const float | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 554 of file scaledinteger.h.
static JAUS::ULong JAUS::ScaledInteger::ToScaledULong | ( | const double | real, |
double | upper, | ||
double | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 663 of file scaledinteger.h.
static JAUS::ULong JAUS::ScaledInteger::ToScaledULong | ( | const float | real, |
const float | upper, | ||
const float | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 678 of file scaledinteger.h.
static JAUS::UShort JAUS::ScaledInteger::ToScaledUShort | ( | const double | real, |
const double | upper, | ||
const double | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 415 of file scaledinteger.h.
static JAUS::UShort JAUS::ScaledInteger::ToScaledUShort | ( | const float | real, |
const float | upper, | ||
const float | lower | ||
) | [inline, static] |
Converts from a real number to a Scaled Integer value.
[in] | real | Real number to convert. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
Definition at line 430 of file scaledinteger.h.
static int JAUS::ScaledInteger::Write | ( | Packet & | packet, |
const LongFloat | real, | ||
const LongFloat | upper, | ||
const LongFloat | lower, | ||
const Type | type, | ||
const unsigned int | pos = UINT_MAX |
||
) | [inline, static] |
Convert a floating point value to a scaled integer and write to the packet.
[out] | packet | Packet to write to. |
[in] | real | Floating point number to write. |
[in] | upper | Upper limit of real number. |
[in] | lower | Lower limit of real number. |
[in] | type | Type of scaled integer to write. |
[in] | pos | The byte position within the stream to write at. If pos is equal to UINT_MAX, then the internal write position is used, which is the default behavior. |
Definition at line 91 of file scaledinteger.h.