Public Types | Public Member Functions | Protected Types | Protected Member Functions | List of all members
imath::CFixedPointManip Class Reference

Implementation of imath::IDoubleManip interface for fixed point arithmentic. More...

#include <CFixedPointManip.h>

Inheritance diagram for imath::CFixedPointManip:
imath::CDoubleManip imath::IDoubleManip imath::TIValueManip< double > istd::IPolymorphic imath::CComplexDoubleManip

Public Types

enum  RoundingType { RT_NORMAL, RT_FLOOR, RT_CEIL, RT_LAST = RT_CEIL + 1 }
 
typedef CDoubleManip BaseClass
 

Public Member Functions

 CFixedPointManip (int precision=1, RoundingType roundingType=RT_NORMAL)
 
void SetPrecision (int precision)
 Set fixed point precision. More...
 
RoundingType GetRoundingType () const
 Get type of rounding. More...
 
void SetRoundingType (RoundingType roundingType)
 Set type of rounding. More...
 
virtual int GetPrecision () const
 Get number of digits after point. More...
 
virtual double GetRounded (const double &value) const
 Get the nearest value rounded used this arithmetik. More...
 
virtual bool IsEqual (const double &value1, const double &value2) const
 Compare two values and check, if there are equal. More...
 
virtual bool IsSmaller (const double &value1, const double &value2) const
 Compare two values and check, if first one is smaller as the second. More...
 
virtual bool IsSmallerEqual (const double &value1, const double &value2) const
 Compare two values and check, if first one is smaller or equal as the second. More...
 
virtual double GetSmallerValue (const double &value) const
 Return biggest value smaller that specified one. More...
 
virtual double GetBiggerValue (const double &value) const
 Return smallest value bigger that specified one. More...
 
virtual QString GetString (const double &value) const
 Get this value as string. More...
 
virtual bool GetParsed (const QString &text, double &result) const
 Get value converted from string. More...
 
- Public Member Functions inherited from imath::CDoubleManip
 CDoubleManip ()
 
char GetPointChar () const
 Get point character. More...
 
void SetPointChar (char pointChar)
 Set point character. More...
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Protected Types

typedef int(* RoundingFuntionPtr )(qreal value)
 
- Protected Types inherited from imath::CDoubleManip
enum  { PRECISION = 6 }
 

Protected Member Functions

virtual qint32 GetInternalValue (double value) const
 
virtual double GetNormalValue (qint32 intValue) const
 
QString GetString (const double &value, int precision) const
 

Detailed Description

Implementation of imath::IDoubleManip interface for fixed point arithmentic.

Definition at line 15 of file CFixedPointManip.h.

Member Typedef Documentation

Definition at line 18 of file CFixedPointManip.h.

typedef int(* imath::CFixedPointManip::RoundingFuntionPtr)(qreal value)
protected

Definition at line 66 of file CFixedPointManip.h.

Member Enumeration Documentation

Enumerator
RT_NORMAL 

Normal mathematical rounding to the nearest value.

RT_FLOOR 

Rounding down.

RT_CEIL 

Rounding up.

RT_LAST 

Definition at line 20 of file CFixedPointManip.h.

Constructor & Destructor Documentation

imath::CFixedPointManip::CFixedPointManip ( int  precision = 1,
RoundingType  roundingType = RT_NORMAL 
)

Member Function Documentation

double imath::CFixedPointManip::GetBiggerValue ( const double &  value) const
inlinevirtual

Return smallest value bigger that specified one.

Reimplemented from imath::CDoubleManip.

Definition at line 123 of file CFixedPointManip.h.

References GetInternalValue(), and GetNormalValue().

qint32 imath::CFixedPointManip::GetInternalValue ( double  value) const
inlineprotectedvirtual
double imath::CFixedPointManip::GetNormalValue ( qint32  intValue) const
inlineprotectedvirtual

Definition at line 139 of file CFixedPointManip.h.

Referenced by GetBiggerValue(), GetRounded(), and GetSmallerValue().

virtual bool imath::CFixedPointManip::GetParsed ( const QString &  text,
double &  result 
) const
virtual

Get value converted from string.

Parameters
textinput string.
resultresult value.
Returns
true if success.

Reimplemented from imath::CDoubleManip.

Reimplemented in imath::CComplexDoubleManip.

virtual int imath::CFixedPointManip::GetPrecision ( ) const
virtual

Get number of digits after point.

Reimplemented from imath::CDoubleManip.

Referenced by imath::CComplexDoubleManip::SetPrecision(), and imath::CComplexDoubleManip::SetScaleFactor().

double imath::CFixedPointManip::GetRounded ( const double &  value) const
inlinevirtual

Get the nearest value rounded used this arithmetik.

Reimplemented from imath::CDoubleManip.

Definition at line 93 of file CFixedPointManip.h.

References GetInternalValue(), and GetNormalValue().

CFixedPointManip::RoundingType imath::CFixedPointManip::GetRoundingType ( ) const
inline

Get type of rounding.

Definition at line 85 of file CFixedPointManip.h.

double imath::CFixedPointManip::GetSmallerValue ( const double &  value) const
inlinevirtual

Return biggest value smaller that specified one.

Reimplemented from imath::CDoubleManip.

Definition at line 117 of file CFixedPointManip.h.

References GetInternalValue(), and GetNormalValue().

virtual QString imath::CFixedPointManip::GetString ( const double &  value) const
virtual

Get this value as string.

Parameters
valuevalue will be converted.

Reimplemented from imath::CDoubleManip.

Reimplemented in imath::CComplexDoubleManip.

QString imath::CFixedPointManip::GetString ( const double &  value,
int  precision 
) const
protected
bool imath::CFixedPointManip::IsEqual ( const double &  value1,
const double &  value2 
) const
inlinevirtual

Compare two values and check, if there are equal.

Parameters
value1first value.
value2second value.

Reimplemented from imath::CDoubleManip.

Definition at line 99 of file CFixedPointManip.h.

References GetInternalValue().

bool imath::CFixedPointManip::IsSmaller ( const double &  value1,
const double &  value2 
) const
inlinevirtual

Compare two values and check, if first one is smaller as the second.

Parameters
value1first value.
value2second value.

Reimplemented from imath::CDoubleManip.

Definition at line 105 of file CFixedPointManip.h.

References GetInternalValue().

bool imath::CFixedPointManip::IsSmallerEqual ( const double &  value1,
const double &  value2 
) const
inlinevirtual

Compare two values and check, if first one is smaller or equal as the second.

Parameters
value1first value.
value2second value.

Reimplemented from imath::CDoubleManip.

Definition at line 111 of file CFixedPointManip.h.

References GetInternalValue().

void imath::CFixedPointManip::SetPrecision ( int  precision)

Set fixed point precision.

Referenced by imath::CComplexDoubleManip::SetPrecision().

void imath::CFixedPointManip::SetRoundingType ( RoundingType  roundingType)

Set type of rounding.


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

© 2007-2017 Witold Gantzke and Kirill Lepskiy