TDWExactNumericType Class Reference

Class representing an exact numeric value with a fixed scale. More...

List of all members.

Public Member Functions

TDWExactNumericTypeAdjust (simba_uint16 in_precision, simba_int16 in_scale, bool *out_truncation=NULL)
 Adjust the numeric to the given precision and scale.
bool GetByteArray (simba_uint32 *out_buffer, simba_uint64 &io_size) const
 Copy the byte array of the numeric value to a destination buffer.
simba_uint16 GetByteCount () const
 Get the number of bytes of this numeric.
simba_double64 GetDouble (bool &out_outOfRange) const
 Get a simba_double64 representation of this numeric.
simba_double64 GetDouble () const
 Get a simba_double64 representation of this numeric.
simba_uint32 GetFraction (bool &out_fracTrunc, bool &out_outOfRange, simba_uint16 in_digitCount) const
  Gets the fractional portion of the value as a uint32.
simba_int16 GetInt16 (bool &out_outOfRange) const
 Get a simba_int16 representation of this numeric.
simba_int16 GetInt16 () const
 Get a simba_int16 representation of this numeric.
simba_int32 GetInt32 (bool &out_outOfRange) const
 Get a simba_int32 representation of this numeric.
simba_int32 GetInt32 () const
 Get a simba_int32 representation of this numeric.
simba_int64 GetInt64 (bool &out_outOfRange) const
 Get a simba_int64 representation of this numeric.
simba_int64 GetInt64 () const
 Get a simba_int64 representation of this numeric.
simba_int8 GetInt8 (bool &out_outOfRange) const
 Get a simba_int8 representation of this numeric.
simba_int8 GetInt8 () const
 Get a simba_int8 representation of this numeric.
simba_int16 GetPrecision () const
 Get the number of digits in this numeric.
simba_int32 GetScale () const
 Get the scale of this numeric.
simba_double32 GetSingle (bool &out_outOfRange) const
 Get a simba_double32 representation of this numeric.
simba_double32 GetSingle () const
 Get a simba_double32 representation of this numeric.
simba_uint16 GetUInt16 (bool &out_outOfRange) const
 Get a simba_uint16 representation of this numeric.
simba_uint16 GetUInt16 () const
 Get a simba_uint16 representation of this numeric.
simba_uint32 GetUInt32 (bool &out_outOfRange) const
 Get a simba_uint32 representation of this numeric.
simba_uint32 GetUInt32 () const
 Get a simba_uint32 representation of this numeric.
simba_uint64 GetUInt64 (bool &out_outOfRange) const
 Get a simba_uint64 representation of this numeric.
simba_uint64 GetUInt64 () const
 Get a simba_uint64 representation of this numeric.
simba_uint8 GetUInt8 (bool &out_outOfRange) const
 Get a simba_uint8 representation of this numeric.
simba_uint8 GetUInt8 () const
 Get a simba_uint8 representation of this numeric.
bool HasFraction () const
 Determine if the numeric has a fractional component or not.
simba_uint64 Hash (simba_uint32 in_seed) const
 Get the hash code of this object.
bool IsPositive () const
 Determine if the numeric is positive or not.
bool IsValid () const
 Determine if the numeric is valid or not.
bool IsZero () const
 Indicates if the numeric holds the value zero.
void MultiplyByTenToThePowerOf (simba_int16 in_nth)
 Multiply by the nth power of ten.
void Negate ()
 Negate the numeric.
bool operator!= (const TDWExactNumericType &in_numeric) const
 Overloaded != operator.
TDWExactNumericType operator% (const TDWExactNumericType &in_value) const
 Overloaded % operator.
TDWExactNumericTypeoperator%= (const TDWExactNumericType &in_value)
 Overloaded = operator.
TDWExactNumericType operator* (simba_int64 in_value) const
 Overloaded * operator.
TDWExactNumericType operator* (simba_uint64 in_value) const
 Overloaded * operator.
TDWExactNumericType operator* (simba_uint32 in_value) const
 Overloaded * operator.
TDWExactNumericType operator* (simba_int32 in_value) const
 Overloaded * operator.
TDWExactNumericType operator* (const TDWExactNumericType &in_numeric) const
 Overloaded * operator.
TDWExactNumericTypeoperator*= (simba_int32 in_value)
 Overloaded *= operator.
TDWExactNumericTypeoperator*= (const TDWExactNumericType &in_numeric)
 Overloaded *= operator.
TDWExactNumericType operator+ (simba_int32 in_value) const
 Overloaded + operator.
TDWExactNumericType operator+ (const TDWExactNumericType &in_numeric) const
 Overloaded + operator.
TDWExactNumericTypeoperator+= (simba_int32 in_value)
 Overloaded += operator.
TDWExactNumericTypeoperator+= (const TDWExactNumericType &in_numeric)
 Overloaded += operator.
TDWExactNumericTypeoperator- ()
 Overloaded - (negate) operator.
TDWExactNumericType operator- (const TDWExactNumericType &in_numeric) const
 Overloaded - (subtract) operator.
TDWExactNumericTypeoperator-= (const TDWExactNumericType &in_numeric)
 Overloaded -= (subtract) operator.
TDWExactNumericType operator/ (const simba_uint64 &in_value) const
 Overloaded / operator.
TDWExactNumericType operator/ (const TDWExactNumericType &in_numeric) const
 Overloaded / operator.
TDWExactNumericTypeoperator/= (const TDWExactNumericType &in_numeric)
 Overloaded /= operator.
bool operator< (simba_int32 in_value) const
 Overloaded < operator.
bool operator< (const TDWExactNumericType &in_numeric) const
 Overloaded < operator.
bool operator<= (simba_int32 in_value) const
 Overloaded <= operator.
bool operator<= (const TDWExactNumericType &in_numeric) const
 Overloaded <= operator.
TDWExactNumericTypeoperator= (const simba_double64 &in_value)
 Overloaded = operator.
TDWExactNumericTypeoperator= (const simba_double32 &in_value)
 Overloaded = operator.
TDWExactNumericTypeoperator= (const simba_int64 &in_value)
 Overloaded = operator.
TDWExactNumericTypeoperator= (const simba_uint64 &in_value)
 Overloaded = operator.
TDWExactNumericTypeoperator= (simba_int32 in_value)
 Overloaded = operator.
TDWExactNumericTypeoperator= (simba_uint32 in_value)
 Overloaded = operator.
TDWExactNumericTypeoperator= (simba_int16 in_value)
 Overloaded = operator.
TDWExactNumericTypeoperator= (simba_uint16 in_value)
 Overloaded = operator.
TDWExactNumericTypeoperator= (simba_int8 in_value)
 Overloaded = operator.
TDWExactNumericTypeoperator= (simba_uint8 in_value)
 Overloaded = operator.
TDWExactNumericTypeoperator= (const TDWExactNumericType &in_numeric)
 Overloaded = operator.
bool operator== (simba_int32 in_value) const
 Overloaded == operator.
bool operator== (const TDWExactNumericType &in_numeric) const
 Overloaded == operator.
bool operator> (simba_int32 in_value) const
 Overloaded > operator.
bool operator> (const TDWExactNumericType &in_numeric) const
 Overloaded > operator.
bool operator>= (simba_int32 in_value) const
 Overloaded >= operator.
bool operator>= (const TDWExactNumericType &in_numeric) const
 Overloaded >= operator.
TDWExactNumericTypeRound (simba_int16 in_scale)
 Round the numeric in place to the given scale.
void Set (const SQL_NUMERIC_STRUCT &in_value, bool in_throwOnError=true)
 Set the current numeric to the value, sign, precision and scale contained in the given SQL_NUMERIC_STRUCT.
void Set (const simba_byte *in_value, simba_int16 in_valueLength, bool in_isPositive, simba_int16 in_scale, bool in_throwOnError=true)
 Set the current numeric to the value contained in the given array and based on the given sign and scale.
void Set (const simba_wstring &in_value, bool in_throwOnError=true)
 Set the current numeric to the given wstring value.
void Set (const simba_string &in_value, bool in_throwOnError=true)
 Set the current numeric to the given string value.
void Set (const simba_char *in_value, simba_size_t in_length, bool in_throwOnError=true)
 Set the current numeric to the given string value.
void Set (const simba_char *in_value, bool in_throwOnError=true)
 Set the current numeric to the given string value.
bool SetScale (simba_int16 in_scale, bool &out_outOfRange)
 Adjust the scale of the numeric to the specified scale.
bool SetScale (simba_int16 in_scale)
 Adjust the scale of the numeric to the specified scale.
 TDWExactNumericType (const simba_wstring &in_value, bool in_throwOnError=true)
 Constructor.
 TDWExactNumericType (const simba_string &in_value, bool in_throwOnError=true)
 Constructor.
 TDWExactNumericType (const simba_char *in_value, simba_size_t in_length, bool in_throwOnError=true)
 Constructor.
 TDWExactNumericType (const simba_char *in_value, bool in_throwOnError=true)
 Constructor.
 TDWExactNumericType (const TDWExactNumericType &in_value)
 Copy constructor.
 TDWExactNumericType (const SQL_NUMERIC_STRUCT &in_value)
 Constructor.
 TDWExactNumericType (const simba_byte *in_value, simba_int16 in_valueLength, bool in_isPositive, simba_int16 in_scale)
 Constructor.
 TDWExactNumericType (simba_double64 in_value)
 Constructor.
 TDWExactNumericType (simba_double32 in_value)
 Constructor.
 TDWExactNumericType (simba_uint64 in_value)
 Constructor.
 TDWExactNumericType (simba_int64 in_value)
 Constructor.
 TDWExactNumericType (simba_uint32 in_value)
 Constructor.
 TDWExactNumericType (simba_int32 in_value)
 Constructor.
 TDWExactNumericType (simba_uint16 in_value)
 Constructor.
 TDWExactNumericType (simba_int16 in_value)
 Constructor.
 TDWExactNumericType (simba_uint8 in_value)
 Constructor.
 TDWExactNumericType (simba_int8 in_value)
 Constructor.
 TDWExactNumericType (simba_int8 in_value, simba_int32 in_scale)
 Constructor.
 TDWExactNumericType (simba_int16 in_value, simba_int32 in_scale)
 Constructor.
 TDWExactNumericType (simba_int32 in_value, simba_int32 in_scale)
 Constructor.
 TDWExactNumericType (simba_int64 in_value, simba_int32 in_scale)
 Constructor.
 TDWExactNumericType (simba_uint8 in_value, simba_int32 in_scale, simba_int16 in_sign=1)
 Constructor.
 TDWExactNumericType (simba_uint16 in_value, simba_int32 in_scale, simba_int16 in_sign=1)
 Constructor.
 TDWExactNumericType (simba_uint32 in_value, simba_int32 in_scale, simba_int16 in_sign=1)
 Constructor.
 TDWExactNumericType (simba_uint64 in_value, simba_int32 in_scale, simba_int16 in_sign=1)
 Constructor.
 TDWExactNumericType (const simba_uint32 in_wordArray[], simba_uint16 in_wordCount, simba_int32 in_scale, simba_int16 in_sign=1)
 Constructor.
 TDWExactNumericType ()
 Constructor.
simba_charToCharArray (simba_size_t &out_length, bool in_keepLeadingZero=true) const
 Return a readable string representation of the numeric.
void ToSqlNumericStruct (SQL_NUMERIC_STRUCT &out_numericStruct, simba_int16 in_precision, simba_int16 in_scale, bool &out_outOfRange, bool &out_fractionalTruncation) const
 Converts a TDWExactNumeric to a SQL_NUMERIC_STRUCT while applying the given precision and scale to the output value.
void ToSqlNumericStruct (SQL_NUMERIC_STRUCT &out_numericStruct, bool &out_outOfRange, bool &out_fractionalTruncation) const
 Converts a TDWExactNumeric to a SQL_NUMERIC_STRUCT.
SQL_NUMERIC_STRUCT * ToSqlNumericStruct (bool &out_outOfRange, bool &out_fractionalTruncation) const
 Converts a TDWExactNumeric to a SQL_NUMERIC_STRUCT.
simba_string ToString (bool in_keepLeadingZero=true) const
 Return a readable string representation of the numeric.
TDWExactNumericTypeTruncate (simba_int16 in_scale)
 Truncate the numeric to the given scale.

Static Public Member Functions

static simba_int16 ComputeMaximumNumberBytesForPrecision (simba_int16 in_precision)
 Compute how many bytes are needed to encode the maximum value for a given precision.

Friends

class Simba::Razor::TypeDescriptor

Detailed Description

Class representing an exact numeric value with a fixed scale.


Constructor & Destructor Documentation

Constructor.

TDWExactNumericType ( const simba_uint32  in_wordArray[],
simba_uint16  in_wordCount,
simba_int32  in_scale,
simba_int16  in_sign = 1 
)

Constructor.

Parameters:
in_wordArray The bytes of the value from the least significant word (index-0) to the most significant word.
in_wordCount 1 + the position of the most significant non-zero word in in_wordArray.
in_scale The scale of the numeric
in_sign The sign of the numeric
TDWExactNumericType ( simba_uint64  in_value,
simba_int32  in_scale,
simba_int16  in_sign = 1 
)

Constructor.

Parameters:
in_value The value of the numeric
in_scale The scale of the numeric
in_sign The sign of the numeric
TDWExactNumericType ( simba_uint32  in_value,
simba_int32  in_scale,
simba_int16  in_sign = 1 
)

Constructor.

Parameters:
in_value The value of the numeric
in_scale The scale of the numeric
in_sign The sign of the numeric
TDWExactNumericType ( simba_uint16  in_value,
simba_int32  in_scale,
simba_int16  in_sign = 1 
)

Constructor.

Parameters:
in_value The value of the numeric
in_scale The scale of the numeric
in_sign The sign of the numeric
TDWExactNumericType ( simba_uint8  in_value,
simba_int32  in_scale,
simba_int16  in_sign = 1 
)

Constructor.

Parameters:
in_value The value of the numeric
in_scale The scale of the numeric
in_sign The sign of the numeric
TDWExactNumericType ( simba_int64  in_value,
simba_int32  in_scale 
)

Constructor.

Parameters:
in_value The value of the numeric
in_scale The scale of the numeric
TDWExactNumericType ( simba_int32  in_value,
simba_int32  in_scale 
)

Constructor.

Parameters:
in_value The value of the numeric
in_scale The scale of the numeric
TDWExactNumericType ( simba_int16  in_value,
simba_int32  in_scale 
)

Constructor.

Parameters:
in_value The value of the numeric
in_scale The scale of the numeric
TDWExactNumericType ( simba_int8  in_value,
simba_int32  in_scale 
)

Constructor.

Parameters:
in_value The value of the numeric
in_scale The scale of the numeric
TDWExactNumericType ( simba_int8  in_value  ) 

Constructor.

Parameters:
in_value The integer type value of the numeric.
TDWExactNumericType ( simba_uint8  in_value  ) 

Constructor.

Parameters:
in_value The integer type value of the numeric.
TDWExactNumericType ( simba_int16  in_value  ) 

Constructor.

Parameters:
in_value The integer type value of the numeric.
TDWExactNumericType ( simba_uint16  in_value  ) 

Constructor.

Parameters:
in_value The integer type value of the numeric.
TDWExactNumericType ( simba_int32  in_value  ) 

Constructor.

Parameters:
in_value The integer type value of the numeric.
TDWExactNumericType ( simba_uint32  in_value  ) 

Constructor.

Parameters:
in_value The integer type value of the numeric.
TDWExactNumericType ( simba_int64  in_value  ) 

Constructor.

Parameters:
in_value The integer type value of the numeric.
TDWExactNumericType ( simba_uint64  in_value  ) 

Constructor.

Parameters:
in_value The integer type value of the numeric.
TDWExactNumericType ( simba_double32  in_value  ) 

Constructor.

Parameters:
in_value The single precision value of the numeric.
TDWExactNumericType ( simba_double64  in_value  ) 

Constructor.

Parameters:
in_value The double precision value of the numeric.
TDWExactNumericType ( const simba_byte in_value,
simba_int16  in_valueLength,
bool  in_isPositive,
simba_int16  in_scale 
)

Constructor.

A number is stored in the array as a scaled integer, in little endian mode (the leftmost byte being the least-significant byte). For example, the number 10.001 base 10, with a scale of 4, is scaled to an integer of 100010. Because this is 186AA in hexadecimal format, the value in the array would be at least "AA 86 01" with possible following bytes equal to "00". This format is that same as the one of SQL_NUMERIC_STRUCT but it is not mandatory for the array to have exactly 16 bytes.

Parameters:
in_value The value to set the numeric to.
in_valueLength The number of bytes to use in the value array.
in_isPositive True if the value should be considered as a positive numeric value, false otherwise.
in_scale The scale of the value.
TDWExactNumericType ( const SQL_NUMERIC_STRUCT &  in_value  ) 

Constructor.

This function uses the precision and scale field set in the SQL_NUMERIC_STRUCT to create the exact numeric.

Parameters:
in_value SQL numeric struct to convert from.
TDWExactNumericType ( const TDWExactNumericType in_value  ) 

Copy constructor.

Parameters:
in_value The value of the numeric.
TDWExactNumericType ( const simba_char in_value,
bool  in_throwOnError = true 
)

Constructor.

Parameters:
in_value The NULL-terminated string value of the numeric. (NOT OWN)
in_throwOnError True to throw if the value is invalid; false otherwise.
TDWExactNumericType ( const simba_char in_value,
simba_size_t  in_length,
bool  in_throwOnError = true 
)

Constructor.

Parameters:
in_value The string value of the numeric. (NOT OWN)
in_length The length of the string value.
in_throwOnError True to throw if the value is invalid; false otherwise.
TDWExactNumericType ( const simba_string in_value,
bool  in_throwOnError = true 
)

Constructor.

Parameters:
in_value The string value of the numeric.
in_throwOnError True to throw if the value is invalid; false otherwise.
TDWExactNumericType ( const simba_wstring in_value,
bool  in_throwOnError = true 
)

Constructor.

Parameters:
in_value The string value of the numeric.
in_throwOnError True to throw if the value is invalid; false otherwise.

Member Function Documentation

TDWExactNumericType& Adjust ( simba_uint16  in_precision,
simba_int16  in_scale,
bool *  out_truncation = NULL 
)

Adjust the numeric to the given precision and scale.

Excess scale is padded with zeros, and the numeric is truncated if digits need to be removed.

Parameters:
in_precision The precision to adjust the numeric to.
in_scale The scale to adjust the numeric to.
out_truncation If this is not NULL, it will be set to true if truncation occurs, c
Returns:
the adjusted numeric.
static simba_int16 ComputeMaximumNumberBytesForPrecision ( simba_int16  in_precision  )  [static]

Compute how many bytes are needed to encode the maximum value for a given precision.

For example if the precision is 8, the function computes how many bytes are needed to store in a value array the value 99999999. This value is equal to 0b101111101011110000011111111, meaning 27 bits, meaning 4 bytes.

Parameters:
in_precision The precision.
Returns:
A positive number representing the number of bytes if the precision can be converted, else -1.
bool GetByteArray ( simba_uint32 out_buffer,
simba_uint64 io_size 
) const

Copy the byte array of the numeric value to a destination buffer.

Parameters:
out_buffer The destination buffer. (NOT OWN)
io_size Input is the size of the given buffer, output is the size actually written to the buffer.
Returns:
True if a trunction occurs due to insufficient space in the destination buffer; false if the whole byte array was copied to the destination buffer successfully.
simba_uint16 GetByteCount (  )  const

Get the number of bytes of this numeric.

Returns:
The number of bytes of this numeric.
simba_double64 GetDouble ( bool &  out_outOfRange  )  const

Get a simba_double64 representation of this numeric.

Parameters:
out_outOfRange True if there was an out of range error; false otherwise.
Returns:
the simba_double64 representation of this numeric; invalid if out_outOfRange is true.
simba_double64 GetDouble (  )  const

Get a simba_double64 representation of this numeric.

Exceptions:
SupportException if the numeric is out of range.
Returns:
the simba_double64 representation of this numeric.
simba_uint32 GetFraction ( bool &  out_fracTrunc,
bool &  out_outOfRange,
simba_uint16  in_digitCount 
) const

 Gets the fractional portion of the value as a uint32.

Parameters:
in_digitCount The maximum number of digits & scale of the returned value.
out_fracTrunc True if there was a fractional truncation.
out_outOfRange True if the value which would have been returned doesn't fit into a uint32.
Returns:
 The numerator of N of the fractional portion of the value of this TDWExactNumeric when approximated by N/(pow(in_digitCount, 10));
simba_int16 GetInt16 ( bool &  out_outOfRange  )  const

Get a simba_int16 representation of this numeric.

Parameters:
out_outOfRange True if there was an out of range error; false otherwise.
Returns:
the simba_int16 representation of this numeric; invalid if out_outOfRange is true.
simba_int16 GetInt16 (  )  const

Get a simba_int16 representation of this numeric.

Exceptions:
SupportException if the numeric is out of range.
Returns:
the simba_int16 representation of this numeric.
simba_int32 GetInt32 ( bool &  out_outOfRange  )  const

Get a simba_int32 representation of this numeric.

Parameters:
out_outOfRange True if there was an out of range error; false otherwise.
Returns:
the simba_int32 representation of this numeric; invalid if out_outOfRange is true.
simba_int32 GetInt32 (  )  const

Get a simba_int32 representation of this numeric.

Exceptions:
SupportException if the numeric is out of range.
Returns:
the simba_int32 representation of this numeric.
simba_int64 GetInt64 ( bool &  out_outOfRange  )  const

Get a simba_int64 representation of this numeric.

Parameters:
out_outOfRange True if there was an out of range error; false otherwise.
Returns:
the simba_int64 representation of this numeric; invalid if out_outOfRange is true.
simba_int64 GetInt64 (  )  const

Get a simba_int64 representation of this numeric.

Exceptions:
SupportException if the numeric is out of range.
Returns:
the simba_int64 representation of this numeric.
simba_int8 GetInt8 ( bool &  out_outOfRange  )  const

Get a simba_int8 representation of this numeric.

Parameters:
out_outOfRange True if there was an out of range error; false otherwise.
Returns:
the simba_int8 representation of this numeric; invalid if out_outOfRange is true.
simba_int8 GetInt8 (  )  const

Get a simba_int8 representation of this numeric.

Exceptions:
SupportException if the numeric is out of range.
Returns:
the simba_int8 representation of this numeric.
simba_int16 GetPrecision (  )  const

Get the number of digits in this numeric.

Returns:
The number of digits in the numeric.
simba_int32 GetScale (  )  const

Get the scale of this numeric.

Returns:
The scale of this numeric.
simba_double32 GetSingle ( bool &  out_outOfRange  )  const

Get a simba_double32 representation of this numeric.

Parameters:
out_outOfRange True if there was an out of range error; false otherwise.
Returns:
the simba_double32 representation of this numeric; invalid if out_outOfRange is true.
simba_double32 GetSingle (  )  const

Get a simba_double32 representation of this numeric.

Exceptions:
SupportException if the numeric is out of range.
Returns:
the simba_double32 representation of this numeric.
simba_uint16 GetUInt16 ( bool &  out_outOfRange  )  const

Get a simba_uint16 representation of this numeric.

Parameters:
out_outOfRange True if there was an out of range error; false otherwise.
Returns:
the simba_uint16 representation of this numeric; invalid if out_outOfRange is true.
simba_uint16 GetUInt16 (  )  const

Get a simba_uint16 representation of this numeric.

Exceptions:
SupportException if the numeric is out of range.
Returns:
the simba_uint16 representation of this numeric.
simba_uint32 GetUInt32 ( bool &  out_outOfRange  )  const

Get a simba_uint32 representation of this numeric.

Parameters:
out_outOfRange True if there was an out of range error; false otherwise.
Returns:
the simba_uint32 representation of this numeric; invalid if out_outOfRange is true.
simba_uint32 GetUInt32 (  )  const

Get a simba_uint32 representation of this numeric.

Exceptions:
SupportException if the numeric is out of range.
Returns:
the simba_uint32 representation of this numeric.
simba_uint64 GetUInt64 ( bool &  out_outOfRange  )  const

Get a simba_uint64 representation of this numeric.

Parameters:
out_outOfRange True if there was an out of range error; false otherwise.
Returns:
the simba_uint64 representation of this numeric; invalid if out_outOfRange is true.
simba_uint64 GetUInt64 (  )  const

Get a simba_uint64 representation of this numeric.

Exceptions:
SupportException if the numeric is out of range.
Returns:
the simba_uint64 representation of this numeric.
simba_uint8 GetUInt8 ( bool &  out_outOfRange  )  const

Get a simba_uint8 representation of this numeric.

Parameters:
out_outOfRange True if there was an out of range error; false otherwise.
Returns:
the simba_uint8 representation of this numeric; invalid if out_outOfRange is true.
simba_uint8 GetUInt8 (  )  const

Get a simba_uint8 representation of this numeric.

Exceptions:
SupportException if the numeric is out of range.
Returns:
the simba_uint8 representation of this numeric.
bool HasFraction (  )  const

Determine if the numeric has a fractional component or not.

Note that if the fractional component contains only 0's, then this function will return false.

Returns:
true if there is a fractional component; false otherwise.
simba_uint64 Hash ( simba_uint32  in_seed  )  const

Get the hash code of this object.

Parameters:
in_seed Seed used for hashing.
Returns:
Hash code.
bool IsPositive (  )  const

Determine if the numeric is positive or not.

Note that this will return true if the numeric is 0.

Returns:
true if the numeric is positive or 0; false otherwise.
bool IsValid (  )  const

Determine if the numeric is valid or not.

Returns:
true if the numeric is valid; false otherwise.
bool IsZero (  )  const

Indicates if the numeric holds the value zero.

This does not check if the numeric is valid.

Returns:
true if the numeric holds the value zero.
void MultiplyByTenToThePowerOf ( simba_int16  in_nth  ) 

Multiply by the nth power of ten.

Parameters:
in_nth Multiply by the nth of power of ten, can be negative
void Negate (  )  [inline]

Negate the numeric.

bool operator!= ( const TDWExactNumericType in_numeric  )  const

Overloaded != operator.

TDWExactNumericType operator% ( const TDWExactNumericType in_value  )  const

Overloaded % operator.

TDWExactNumericType& operator%= ( const TDWExactNumericType in_value  ) 

Overloaded = operator.

TDWExactNumericType operator* ( simba_int64  in_value  )  const

Overloaded * operator.

TDWExactNumericType operator* ( simba_uint64  in_value  )  const

Overloaded * operator.

TDWExactNumericType operator* ( simba_uint32  in_value  )  const

Overloaded * operator.

TDWExactNumericType operator* ( simba_int32  in_value  )  const

Overloaded * operator.

TDWExactNumericType operator* ( const TDWExactNumericType in_numeric  )  const

Overloaded * operator.

TDWExactNumericType& operator*= ( simba_int32  in_value  ) 

Overloaded *= operator.

TDWExactNumericType& operator*= ( const TDWExactNumericType in_numeric  ) 

Overloaded *= operator.

TDWExactNumericType operator+ ( simba_int32  in_value  )  const

Overloaded + operator.

TDWExactNumericType operator+ ( const TDWExactNumericType in_numeric  )  const

Overloaded + operator.

TDWExactNumericType& operator+= ( simba_int32  in_value  ) 

Overloaded += operator.

TDWExactNumericType& operator+= ( const TDWExactNumericType in_numeric  ) 

Overloaded += operator.

TDWExactNumericType& operator- (  ) 

Overloaded - (negate) operator.

TDWExactNumericType operator- ( const TDWExactNumericType in_numeric  )  const

Overloaded - (subtract) operator.

TDWExactNumericType& operator-= ( const TDWExactNumericType in_numeric  ) 

Overloaded -= (subtract) operator.

TDWExactNumericType operator/ ( const simba_uint64 in_value  )  const

Overloaded / operator.

TDWExactNumericType operator/ ( const TDWExactNumericType in_numeric  )  const

Overloaded / operator.

TDWExactNumericType& operator/= ( const TDWExactNumericType in_numeric  ) 

Overloaded /= operator.

bool operator< ( simba_int32  in_value  )  const

Overloaded < operator.

bool operator< ( const TDWExactNumericType in_numeric  )  const

Overloaded < operator.

bool operator<= ( simba_int32  in_value  )  const

Overloaded <= operator.

bool operator<= ( const TDWExactNumericType in_numeric  )  const

Overloaded <= operator.

TDWExactNumericType& operator= ( const simba_double64 in_value  ) 

Overloaded = operator.

TDWExactNumericType& operator= ( const simba_double32 in_value  ) 

Overloaded = operator.

TDWExactNumericType& operator= ( const simba_int64 in_value  ) 

Overloaded = operator.

TDWExactNumericType& operator= ( const simba_uint64 in_value  ) 

Overloaded = operator.

TDWExactNumericType& operator= ( simba_int32  in_value  ) 

Overloaded = operator.

TDWExactNumericType& operator= ( simba_uint32  in_value  ) 

Overloaded = operator.

TDWExactNumericType& operator= ( simba_int16  in_value  ) 

Overloaded = operator.

TDWExactNumericType& operator= ( simba_uint16  in_value  ) 

Overloaded = operator.

TDWExactNumericType& operator= ( simba_int8  in_value  ) 

Overloaded = operator.

TDWExactNumericType& operator= ( simba_uint8  in_value  ) 

Overloaded = operator.

TDWExactNumericType& operator= ( const TDWExactNumericType in_numeric  ) 

Overloaded = operator.

bool operator== ( simba_int32  in_value  )  const

Overloaded == operator.

bool operator== ( const TDWExactNumericType in_numeric  )  const

Overloaded == operator.

bool operator> ( simba_int32  in_value  )  const

Overloaded > operator.

bool operator> ( const TDWExactNumericType in_numeric  )  const

Overloaded > operator.

bool operator>= ( simba_int32  in_value  )  const

Overloaded >= operator.

bool operator>= ( const TDWExactNumericType in_numeric  )  const

Overloaded >= operator.

TDWExactNumericType& Round ( simba_int16  in_scale  ) 

Round the numeric in place to the given scale.

Parameters:
in_scale The scale to round the numeric to.
Returns:
The truncated numeric.
void Set ( const SQL_NUMERIC_STRUCT &  in_value,
bool  in_throwOnError = true 
)

Set the current numeric to the value, sign, precision and scale contained in the given SQL_NUMERIC_STRUCT.

If the precision is invalid based on the maximum value that can be stored in the value field of the SQL_NUMERIC_STRUCT, the precision is ignored and all bytes of the value field are converted.

Parameters:
in_value The value to set the numeric to.
in_throwOnError True to throw if the value is invalid; false otherwise.
void Set ( const simba_byte in_value,
simba_int16  in_valueLength,
bool  in_isPositive,
simba_int16  in_scale,
bool  in_throwOnError = true 
)

Set the current numeric to the value contained in the given array and based on the given sign and scale.

A number is stored in the array as a scaled integer, in little endian mode (the leftmost byte being the least-significant byte). For example, the number 10.001 base 10, with a scale of 4, is scaled to an integer of 100010. Because this is 186AA in hexadecimal format, the value in the array would be at least "AA 86 01" with possible following bytes equal to "00". This format is that same as the one of SQL_NUMERIC_STRUCT but it is not mandatory for the array to have exactly 16 bytes.

Parameters:
in_value The value to set the numeric to.
in_valueLength The number of bytes to use in the value array.
in_isPositive True if the value should be considered as a positive numeric value, false otherwise.
in_scale The scale of the value.
in_throwOnError True to throw if the value is invalid or overflow; false otherwise.
void Set ( const simba_wstring in_value,
bool  in_throwOnError = true 
)

Set the current numeric to the given wstring value.

Parameters:
in_value The value to set the numeric to.
in_throwOnError True to throw if the value is invalid; false otherwise.
void Set ( const simba_string in_value,
bool  in_throwOnError = true 
)

Set the current numeric to the given string value.

Parameters:
in_value The value to set the numeric to.
in_throwOnError True to throw if the value is invalid; false otherwise.
void Set ( const simba_char in_value,
simba_size_t  in_length,
bool  in_throwOnError = true 
)

Set the current numeric to the given string value.

Parameters:
in_value The value to set the numeric to. (NOT OWN)
in_length The length of the string value.
in_throwOnError True to throw if the value is invalid; false otherwise.
void Set ( const simba_char in_value,
bool  in_throwOnError = true 
)

Set the current numeric to the given string value.

Parameters:
in_value The NULL-terminated string value of the numeric. (NOT OWN)
in_throwOnError True to throw if the value is invalid; false otherwise.
bool SetScale ( simba_int16  in_scale,
bool &  out_outOfRange 
)

Adjust the scale of the numeric to the specified scale.

Parameters:
in_scale The new scale to set.
Returns:
True if truncation occurred, false otherwise.
bool SetScale ( simba_int16  in_scale  ) 

Adjust the scale of the numeric to the specified scale.

Parameters:
in_scale The new scale to set.
Returns:
True if truncation occurred, false otherwise.
Exceptions:
SupportException in case of out-of-range error.
simba_char* ToCharArray ( simba_size_t out_length,
bool  in_keepLeadingZero = true 
) const

Return a readable string representation of the numeric.

Parameters:
out_length The length of the string representation of the numeric. This is the total number of characters in the returned buffer before the NULL-terminator.
in_keepLeadingZero True use the format as 0.xxxx; false to have it as .xxxx.
Returns:
a NULL-terminated character array representing the numeric. (OWN)
void ToSqlNumericStruct ( SQL_NUMERIC_STRUCT &  out_numericStruct,
simba_int16  in_precision,
simba_int16  in_scale,
bool &  out_outOfRange,
bool &  out_fractionalTruncation 
) const

Converts a TDWExactNumeric to a SQL_NUMERIC_STRUCT while applying the given precision and scale to the output value.

This function forces the exact numeric value to match the given precision and scale before trying to fit it into a SQL_NUMERIC_STRUCT. Fractional truncation can occur during this rescaling. This function is compliant to the behavior defined in the ODBC specification when retrieving data into SQL_NUMERIC_STRUCT. However it adds support for negative scale which is not defined in the ODBC specifications.

Parameters:
out_numericStruct The SQL_NUMERIC_STRUCT to fill. May be garbage if out_outOfRange is true.
in_precision The precision to set in the SQL_NUMERIC_STRUCT.
in_scale The scale to set in the SQL_NUMERIC_STRUCT.
out_outOfRange True if the value is out of range of a SQL_NUMERIC_STRUCT, false otherwise.
out_fractionalTruncation True if fractional truncation occurred, false otherwise.
void ToSqlNumericStruct ( SQL_NUMERIC_STRUCT &  out_numericStruct,
bool &  out_outOfRange,
bool &  out_fractionalTruncation 
) const

Converts a TDWExactNumeric to a SQL_NUMERIC_STRUCT.

This function does its best to fit the exact numeric value into the output SQL_NUMERIC_STRUCT forcing a fractional truncation if need be.

Parameters:
out_numericStruct The SQL_NUMERIC_STRUCT to fill. May be garbage if out_outOfRange is true.
out_outOfRange True if the value is out of range of a SQL_NUMERIC_STRUCT, false otherwise.
out_fractionalTruncation True if fractional truncation occurred, false otherwise.
SQL_NUMERIC_STRUCT* ToSqlNumericStruct ( bool &  out_outOfRange,
bool &  out_fractionalTruncation 
) const

Converts a TDWExactNumeric to a SQL_NUMERIC_STRUCT.

This function does its best to fit the exact numeric value into the output SQL_NUMERIC_STRUCT forcing a fractional truncation if need be.

Parameters:
out_outOfRange True if the value is out of range of a SQL_NUMERIC_STRUCT, false otherwise.
out_fractionalTruncation True if fractional truncation occurred, false otherwise.
Returns:
The value as a SQL_NUMERIC_STRUCT. May be garbage if out_outOfRange is true.
simba_string ToString ( bool  in_keepLeadingZero = true  )  const

Return a readable string representation of the numeric.

Parameters:
in_keepLeadingZero True use the format as 0.xxxx; false to have it as .xxxx.
Returns:
the string representation of the numeric struct.
TDWExactNumericType& Truncate ( simba_int16  in_scale  ) 

Truncate the numeric to the given scale.

Positive number will leave that many decimals left. Negative numbers will truncate to the left of the decimal.

Parameters:
in_scale The scale to truncate the numeric to.
Returns:
the truncated numeric.

Friends And Related Function Documentation

friend class Simba::Razor::TypeDescriptor [friend]

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

Generated on Wed May 17 14:21:19 2017 for SimbaEngine 10.1.3.1011 by simba