Public Member Functions | |
gFloatCompressor (REAL min, REAL max) | |
void | Write (nMessage &m, REAL value) const |
REAL | Read (nMessage &m) const |
Private Member Functions | |
gFloatCompressor () | |
Private Attributes | |
REAL | min_ |
REAL | max_ |
Static Private Attributes | |
static const unsigned short | maxShort_ = 0xFFFF |
Definition at line 1197 of file gCycle.cpp.
gFloatCompressor::gFloatCompressor | ( | ) | [private] |
Definition at line 1204 of file gCycle.cpp.
References clamp(), and nMessage::Write().
Referenced by gCycle::WriteSync().
01205 { 01206 clamp( value, min_, max_ ); 01207 unsigned short compressed = static_cast< unsigned short > ( maxShort_ * ( value - min_ )/( max_ - min_ ) ); 01208 m.Write( compressed ); 01209 }
Definition at line 1211 of file gCycle.cpp.
References nMessage::Read().
Referenced by gCycle::ReadSync().
01212 { 01213 unsigned short compressed; 01214 m.Read( compressed ); 01215 01216 return min_ + compressed * ( max_ - min_ )/maxShort_; 01217 }
REAL gFloatCompressor::min_ [private] |
Definition at line 1219 of file gCycle.cpp.
REAL gFloatCompressor::max_ [private] |
Definition at line 1219 of file gCycle.cpp.
const unsigned short gFloatCompressor::maxShort_ = 0xFFFF [static, private] |
Definition at line 1221 of file gCycle.cpp.