MySQL 9.1.0
Source Code Documentation
my_decimal Class Reference

my_decimal class limits 'decimal_t' type to what we need in MySQL. More...

#include <my_decimal.h>

Inheritance diagram for my_decimal:
[legend]

Public Member Functions

 my_decimal (const my_decimal &rhs)
 
my_decimaloperator= (const my_decimal &rhs)
 
void init ()
 
 my_decimal ()
 
 ~my_decimal ()
 
void sanity_check () const
 
bool sign () const
 
void sign (bool s)
 
uint precision () const
 
void swap (my_decimal &rhs)
 Swap two my_decimal values. More...
 
int check_result (uint, int result) const
 report result of decimal operation. More...
 

Private Attributes

std::array< decimal_digit_t, DECIMAL_BUFF_LENGTHbuffer
 

Additional Inherited Members

- Public Attributes inherited from decimal_t
int intg
 The number of decimal digits (NOT number of decimal_digit_t's !) before the point. More...
 
int frac
 The number of decimal digits after the point. More...
 
int len
 The length of buf (length of allocated space) in decimal_digit_t's, not in bytes. More...
 
bool sign
 False means positive, true means negative. More...
 
decimal_digit_tbuf
 An array of decimal_digit_t's. More...
 

Detailed Description

my_decimal class limits 'decimal_t' type to what we need in MySQL.

It contains internally all necessary space needed by the instance so no extra memory is needed. Objects should be moved using copy CTOR or assignment operator, rather than memcpy/memmove.

Constructor & Destructor Documentation

◆ my_decimal() [1/2]

my_decimal::my_decimal ( const my_decimal rhs)
inline

◆ my_decimal() [2/2]

my_decimal::my_decimal ( )
inline

◆ ~my_decimal()

my_decimal::~my_decimal ( )
inline

Member Function Documentation

◆ check_result()

int my_decimal::check_result ( uint  mask,
int  result 
) const

report result of decimal operation.

Parameters
maskbitmask filtering result, most likely E_DEC_FATAL_ERROR
resultdecimal library return code (E_DEC_* see include/decimal.h)
Returns
result

◆ init()

void my_decimal::init ( )
inline

◆ operator=()

my_decimal & my_decimal::operator= ( const my_decimal rhs)
inline

◆ precision()

uint my_decimal::precision ( ) const
inline

◆ sanity_check()

void my_decimal::sanity_check ( ) const
inline

◆ sign() [1/2]

bool my_decimal::sign ( ) const
inline

◆ sign() [2/2]

void my_decimal::sign ( bool  s)
inline

◆ swap()

void my_decimal::swap ( my_decimal rhs)
inline

Swap two my_decimal values.

Member Data Documentation

◆ buffer

std::array<decimal_digit_t, DECIMAL_BUFF_LENGTH> my_decimal::buffer
private

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