ACF $AcfVersion:0$
Public Member Functions | Protected Types | List of all members
imath::CDoubleManip Class Reference

Simple implementation of double value manipulator without rounding or quantization. More...

#include <CDoubleManip.h>

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

Public Member Functions

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

Protected Types

enum  { PRECISION = 6 }
 

Detailed Description

Simple implementation of double value manipulator without rounding or quantization.

Purpose

CDoubleManip provides basic manipulation and formatting of double precision values without any rounding or quantization. It implements the IDoubleManip interface, offering string conversion, comparison, and formatting operations with configurable decimal point character. This class is the base for more specialized manipulators like CFixedPointManip.

Features

Usage Examples

// Create manipulator with default settings
// String conversion with default point character '.'
QString str = manip.GetString(3.14159); // "3.14159" (6 decimals)
// Parse string to double
double value;
if (manip.GetParsed("2.718", value)) {
// value = 2.718
}
// Use European decimal comma
manip.SetPointChar(',');
QString str2 = manip.GetString(1.5); // "1,5"
manip.GetParsed("3,14", value); // Parses "3,14" as 3.14
// Comparison (exact, no tolerance)
if (manip.AreValuesEqual(1.0, 1.0)) {
// true - exact equality
}
if (manip.IsSmaller(1.0, 2.0)) {
// true
}
// Get increment/decrement values for UI spinners
double smaller = manip.GetSmallerValue(5.0); // Returns previous representable value
double bigger = manip.GetBiggerValue(5.0); // Returns next representable value
Simple implementation of double value manipulator without rounding or quantization.
virtual double GetSmallerValue(const double &value) const override
Return biggest value smaller that specified one.
virtual bool AreValuesEqual(const double &value1, const double &value2) const override
Compare two values and check, if there are equal.
virtual bool GetParsed(const QString &text, double &result) const override
Get value converted from string.
virtual bool IsSmaller(const double &value1, const double &value2) const override
Compare two values and check, if first one is smaller as the second.
void SetPointChar(char pointChar)
Set point character.
virtual QString GetString(const double &value) const override
Get this value as string.
virtual double GetBiggerValue(const double &value) const override
Return smallest value bigger that specified one.

CDoubleManip vs CFixedPointManip

Use CDoubleManip when:

Use CFixedPointManip when:

Purpose in Framework

This class is typically used by:

See also
imath::IDoubleManip, imath::CFixedPointManip, imath::TIValueManip, imath::CDouble

Definition at line 88 of file CDoubleManip.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
PRECISION 

Definition at line 117 of file CDoubleManip.h.

Constructor & Destructor Documentation

◆ CDoubleManip()

imath::CDoubleManip::CDoubleManip ( )

Member Function Documentation

◆ AreValuesEqual()

bool imath::CDoubleManip::AreValuesEqual ( const double &  value1,
const double &  value2 
) const
inlineoverridevirtual

Compare two values and check, if there are equal.

Parameters
value1first value.
value2second value.

Implements imath::TIValueManip< double >.

Reimplemented in imath::CFixedPointManip.

Definition at line 148 of file CDoubleManip.h.

◆ GetBiggerValue()

double imath::CDoubleManip::GetBiggerValue ( const double &  value) const
inlineoverridevirtual

Return smallest value bigger that specified one.

Implements imath::TIValueManip< double >.

Reimplemented in imath::CFixedPointManip.

Definition at line 172 of file CDoubleManip.h.

◆ GetParsed()

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

Get value converted from string.

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

Implements imath::TIValueManip< double >.

Reimplemented in imath::CComplexDoubleManip, and imath::CFixedPointManip.

◆ GetPointChar()

char imath::CDoubleManip::GetPointChar ( ) const
inline

Get point character.

Definition at line 128 of file CDoubleManip.h.

◆ GetPrecision()

virtual int imath::CDoubleManip::GetPrecision ( ) const
overridevirtual

Get number of digits after point.

Implements imath::IDoubleManip.

Reimplemented in imath::CFixedPointManip.

◆ GetRounded()

double imath::CDoubleManip::GetRounded ( const double &  value) const
inlineoverridevirtual

Get the nearest value rounded used this arithmetik.

Implements imath::TIValueManip< double >.

Reimplemented in imath::CFixedPointManip.

Definition at line 142 of file CDoubleManip.h.

◆ GetSmallerValue()

double imath::CDoubleManip::GetSmallerValue ( const double &  value) const
inlineoverridevirtual

Return biggest value smaller that specified one.

Implements imath::TIValueManip< double >.

Reimplemented in imath::CFixedPointManip.

Definition at line 166 of file CDoubleManip.h.

◆ GetString()

virtual QString imath::CDoubleManip::GetString ( const double &  value) const
overridevirtual

Get this value as string.

Parameters
valuevalue will be converted.

Implements imath::TIValueManip< double >.

Reimplemented in imath::CComplexDoubleManip, and imath::CFixedPointManip.

◆ IsSmaller()

bool imath::CDoubleManip::IsSmaller ( const double &  value1,
const double &  value2 
) const
inlineoverridevirtual

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

Parameters
value1first value.
value2second value.

Implements imath::TIValueManip< double >.

Reimplemented in imath::CFixedPointManip.

Definition at line 154 of file CDoubleManip.h.

◆ IsSmallerEqual()

bool imath::CDoubleManip::IsSmallerEqual ( const double &  value1,
const double &  value2 
) const
inlineoverridevirtual

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

Parameters
value1first value.
value2second value.

Implements imath::TIValueManip< double >.

Reimplemented in imath::CFixedPointManip.

Definition at line 160 of file CDoubleManip.h.

◆ SetPointChar()

void imath::CDoubleManip::SetPointChar ( char  pointChar)
inline

Set point character.

Definition at line 134 of file CDoubleManip.h.


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