gFloatCompressor Class Reference

List of all members.

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


Detailed Description

Definition at line 1197 of file gCycle.cpp.


Constructor & Destructor Documentation

gFloatCompressor::gFloatCompressor ( REAL  min,
REAL  max 
) [inline]

Definition at line 1200 of file gCycle.cpp.

01201             : min_( min ), max_( max ){}

gFloatCompressor::gFloatCompressor (  )  [private]


Member Function Documentation

void gFloatCompressor::Write ( nMessage m,
REAL  value 
) const [inline]

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     }

Here is the call graph for this function:

Here is the caller graph for this function:

REAL gFloatCompressor::Read ( nMessage m  )  const [inline]

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     }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

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.


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:39:16 2008 for Armagetron Advanced by  doxygen 1.5.4