Canola  0.8.D001
Public Types | Public Member Functions | Private Attributes
precision_and_rounding Class Reference

#include <precision_and_rounding.h>

List of all members.

Public Types

enum  round_t { round_up, round_off, round_down }

Public Member Functions

virtual ~precision_and_rounding ()
 precision_and_rounding ()
 precision_and_rounding (int precision, round_t round)
 precision_and_rounding (const precision_and_rounding &rhs)
precision_and_roundingoperator= (const precision_and_rounding &rhs)
void apply (number &value)
int get_precision (void) const
round_t get_rounding (void) const

Private Attributes

int precision
round_t round

Detailed Description

The precision_and_rounding class is used to represent the setting of the Decimal Point Selector Dial and Rounding Switch. These are always applied together.

Definition at line 28 of file precision_and_rounding.h.


Member Enumeration Documentation

Enumerator:
round_up 

round away from zero

round_off 

round towards the closest integer.

round_down 

round towards zero

Definition at line 41 of file precision_and_rounding.h.


Constructor & Destructor Documentation

The destructor.

Definition at line 24 of file precision_and_rounding.cc.

The default constructor.

Definition at line 29 of file precision_and_rounding.cc.

A constructor.

Parameters:
precisionthe number of decimal places of precision (places to the rigth of the decimal point).
roundthe rounding direction.

Definition at line 38 of file precision_and_rounding.cc.

The copy constructor.

Parameters:
rhsThe right hand side of the initialization.

Definition at line 48 of file precision_and_rounding.cc.


Member Function Documentation

The apply method is used to apply this precision and rounding to a number value.

Parameters:
valueThe value to be rounded.

Definition at line 70 of file precision_and_rounding.cc.

int precision_and_rounding::get_precision ( void  ) const [inline]

Definition at line 95 of file precision_and_rounding.h.

round_t precision_and_rounding::get_rounding ( void  ) const [inline]

Definition at line 97 of file precision_and_rounding.h.

precision_and_rounding & precision_and_rounding::operator= ( const precision_and_rounding rhs)

The assignment operator.

Parameters:
rhsThe right hand side of the assignment.

Definition at line 58 of file precision_and_rounding.cc.


Member Data Documentation

The precision instance variable is used to remember the number of decimal places of precision (places to the rigth of the decimal point), or -1 for floating point.

Definition at line 105 of file precision_and_rounding.h.

The round instance variable is used to remember the rounding direction.

Definition at line 111 of file precision_and_rounding.h.


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