Public Member Functions | Static Public Member Functions | Static Public Attributes

Engine::Decimal Class Reference

Incapsulates float type. More...

#include <B2BITS_Decimal.h>

List of all members.

Public Member Functions

 Decimal ()
 Default contructor.
 Decimal (System::i64 m, System::i32 e)
 Contructor Constructs object from mantissa and exponent.
 Decimal (double v)
 Contructor Constructs object from double.
 Decimal (System::i64 x)
 Contructor Constructs object from 64-bit integer.
bool equals (const Decimal &rv) const
 Compares two Decimals.
System::i32 getExponent () const
 Returns exponent part of the value.
System::i64 getMantissa () const
 Returns mantissa part of the value.
bool operator!= (const Decimal &rv) const
 Compares two Decimals.
bool operator== (const Decimal &rv) const
 Compares two Decimals.
double toDouble () const
 Converts stored value to double.
float toFloat () const
 Converts stored value to float.
char * toString (char *buf) const
 Converts decimal to FIX string.
char * toString (char *buf, size_t size) const
 Converts decimal to FIX string.

Static Public Member Functions

static Decimal fromString (AsciiString str)
 Converts string to Decimal.
static Decimal fromString (WideString str)
 Converts wide-string to Decimal.

Static Public Attributes

static unsigned int const ValueSize = 2 + 63 + sizeof("18446744073709551616")
 Maximum buffer size required to store value.

Detailed Description

Incapsulates float type.

Definition at line 60 of file B2BITS_Decimal.h.


Constructor & Destructor Documentation

Engine::Decimal::Decimal (  )

Default contructor.

Engine::Decimal::Decimal ( System::i64  m,
System::i32  e 
)

Contructor Constructs object from mantissa and exponent.

Parameters:
mMantissa
eExponent
Engine::Decimal::Decimal ( double  v )

Contructor Constructs object from double.

Parameters:
vValue of the double type
precisionPrecision
Engine::Decimal::Decimal ( System::i64  x )

Contructor Constructs object from 64-bit integer.

Parameters:
xValue of the i64 type

Member Function Documentation

bool Engine::Decimal::equals ( const Decimal rv ) const

Compares two Decimals.

Parameters:
rvValue to compare with.
Returns:
true if equals; false otherwise
static Decimal Engine::Decimal::fromString ( AsciiString  str ) [static]

Converts string to Decimal.

static Decimal Engine::Decimal::fromString ( WideString  str ) [static]

Converts wide-string to Decimal.

System::i32 Engine::Decimal::getExponent (  ) const [inline]

Returns exponent part of the value.

Returns:
exponent part of the value

Definition at line 77 of file B2BITS_Decimal.h.

System::i64 Engine::Decimal::getMantissa (  ) const [inline]

Returns mantissa part of the value.

Returns:
mantissa part of the value

Definition at line 73 of file B2BITS_Decimal.h.

bool Engine::Decimal::operator!= ( const Decimal rv ) const

Compares two Decimals.

Parameters:
rvValue to compare with.
Returns:
false if equals; true otherwise
bool Engine::Decimal::operator== ( const Decimal rv ) const

Compares two Decimals.

Parameters:
rvValue to compare with.
Returns:
true if equals; false otherwise
double Engine::Decimal::toDouble (  ) const

Converts stored value to double.

Returns:
double representation of the value
float Engine::Decimal::toFloat (  ) const

Converts stored value to float.

Returns:
float representation of the value
char* Engine::Decimal::toString ( char *  buf ) const

Converts decimal to FIX string.

Parameters:
[out]bufBuffer to convert to. Should be enough to store Engine::Decimal::ValueSize bytes.
Returns:
Pointer to the first character of the value

Referenced by Engine::PreparedMessage::set().

char* Engine::Decimal::toString ( char *  buf,
size_t  size 
) const

Converts decimal to FIX string.

If result string is less than passed buffer, remain chars will be filled with zeros according to FIX protocol.

Parameters:
[out]bufBuffer to convert to.
[in]sizeSize of the buffer.

Member Data Documentation

unsigned int const Engine::Decimal::ValueSize = 2 + 63 + sizeof("18446744073709551616") [static]

Maximum buffer size required to store value.

Definition at line 69 of file B2BITS_Decimal.h.