OnixS Borsa Italiana IDEM SOLA HSVF Market Data Handler for C++  1.1.2.0
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Rational Struct Reference

Rational number representation. More...

Public Member Functions

 Rational ()
 Constructs default instance.
 
 Rational (SInt64 numerator, UInt32 denominator)
 Create initialized instance.
 
 Rational (const Rational &other, unsigned int newDenominator)
 Converts some Rational value to another denominator.
 
bool noValue () const
 Indicates if Rational has no value.
 
template<typename T >
convertTo () const
 Converts Rational representation to needed number type. More...
 
 operator float () const
 Implicit conversion to float number type.
 
 operator double () const
 Implicit conversion to double number type.
 
std::string toString () const
 string representation of Rational
 
bool operator== (const Rational &right) const
 Rational comparison.
 
bool operator!= (const Rational &right) const
 
bool operator< (const Rational &right) const
 
bool operator> (const Rational &right) const
 
bool operator<= (const Rational &right) const
 
bool operator>= (const Rational &right) const
 

Public Attributes

SInt64 numerator
 Numerator.
 
UInt32 denominator
 Denominator.
 

Static Public Attributes

static const SInt64 NO_VALUE
 This value indicates that value is in not set.
 

Detailed Description

Rational number representation.

Member Function Documentation

T convertTo ( ) const
inline

Converts Rational representation to needed number type.

Target number type should have accessible constructor from int type, and should have visible operator/.

Deciaml d = rational.convertTo<Decimal>()