casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
Percent Class Reference

Defines a class for quantities that may be expressed in percent. More...

#include <ATMPercent.h>

Public Member Functions

 Percent ()
 Default constructor. More...
 
 Percent (double percent)
 A full constructor: Amount in default units (relative to 1) More...
 
 Percent (double percent, const std::string &units)
 A full constructor: Amount + units. More...
 
 ~Percent ()
 
Percentoperator= (const Percent &rhs)
 Operator "equal to a Percent". More...
 
Percentoperator= (double rhs)
 Operator "equal to a double converted to Percent in %". More...
 
Percent operator+ (const Percent &rhs)
 Operator "addition of percentages". More...
 
Percent operator- (const Percent &rhs)
 Operator "substraction of percentages". More...
 
Percent operator* (double scf)
 Operator "multiplication of a percent by a double". More...
 
Percent operator* (float scf)
 Operator "multiplication of a percent by a float". More...
 
Percent operator* (int scf)
 Operator "multiplication of a percent by an int". More...
 
Percent operator* (unsigned int scf)
 Operator "multiplication of a percent by an unsigned int". More...
 
Percent operator/ (double scf)
 Operator "division of a percent by a double". More...
 
Percent operator/ (float scf)
 Operator "division of a percent by a float". More...
 
Percent operator/ (int scf)
 Operator "division of a percent by an int". More...
 
Percent operator/ (unsigned int scf)
 Operator "division of a percent by an unsigned int". More...
 
bool operator< (const Percent &rhs) const
 Operator "comparator < for two percentages". More...
 
bool operator> (const Percent &rhs) const
 Operator "comparator > for two percentages". More...
 
bool operator<= (const Percent &rhs) const
 Operator "comparator <= for two percentages". More...
 
bool operator>= (const Percent &rhs) const
 Operator "comparator >= for two percentages". More...
 
bool operator== (const Percent &rhs) const
 Operator "comparator == for two percentages". More...
 
bool operator!= (const Percent &rhs) const
 Operator "comparator != for two percentages". More...
 
double get () const
 Accessor to the percent value in International System units. More...
 
double get (const std::string &units) const
 Accessor to the percent value in specified units. More...
 

Private Attributes

double valueIS_
 

Detailed Description

Defines a class for quantities that may be expressed in percent.

This class is aimed at quantities that may be defined in percent. Default is proposed with no units (relative to one), and an alternative is considered for units in %.

Definition at line 44 of file ATMPercent.h.

Constructor & Destructor Documentation

Percent::Percent ( )

Default constructor.

Referenced by operator*(), operator+(), operator-(), and operator/().

Percent::Percent ( double  percent)

A full constructor: Amount in default units (relative to 1)

Percent::Percent ( double  percent,
const std::string &  units 
)

A full constructor: Amount + units.

Valid units are: %

Percent::~Percent ( )

Member Function Documentation

double Percent::get ( ) const

Accessor to the percent value in International System units.

Referenced by operator!=(), operator+(), operator-(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

double Percent::get ( const std::string &  units) const

Accessor to the percent value in specified units.

bool Percent::operator!= ( const Percent rhs) const
inline

Operator "comparator != for two percentages".

Definition at line 98 of file ATMPercent.h.

References get(), and valueIS_.

Percent Percent::operator* ( double  scf)
inline

Operator "multiplication of a percent by a double".

Definition at line 72 of file ATMPercent.h.

References Percent(), and valueIS_.

Percent Percent::operator* ( float  scf)
inline

Operator "multiplication of a percent by a float".

Definition at line 74 of file ATMPercent.h.

References Percent(), and valueIS_.

Percent Percent::operator* ( int  scf)
inline

Operator "multiplication of a percent by an int".

Definition at line 76 of file ATMPercent.h.

References Percent(), and valueIS_.

Percent Percent::operator* ( unsigned int  scf)
inline

Operator "multiplication of a percent by an unsigned int".

Definition at line 78 of file ATMPercent.h.

References Percent(), and valueIS_.

Percent Percent::operator+ ( const Percent rhs)
inline

Operator "addition of percentages".

Definition at line 68 of file ATMPercent.h.

References get(), Percent(), and valueIS_.

Percent Percent::operator- ( const Percent rhs)
inline

Operator "substraction of percentages".

Definition at line 70 of file ATMPercent.h.

References get(), Percent(), and valueIS_.

Percent Percent::operator/ ( double  scf)
inline

Operator "division of a percent by a double".

Definition at line 80 of file ATMPercent.h.

References Percent(), and valueIS_.

Percent Percent::operator/ ( float  scf)
inline

Operator "division of a percent by a float".

Definition at line 82 of file ATMPercent.h.

References Percent(), and valueIS_.

Percent Percent::operator/ ( int  scf)
inline

Operator "division of a percent by an int".

Definition at line 84 of file ATMPercent.h.

References Percent(), and valueIS_.

Percent Percent::operator/ ( unsigned int  scf)
inline

Operator "division of a percent by an unsigned int".

Definition at line 86 of file ATMPercent.h.

References Percent(), and valueIS_.

bool Percent::operator< ( const Percent rhs) const
inline

Operator "comparator < for two percentages".

Definition at line 88 of file ATMPercent.h.

References get(), and valueIS_.

bool Percent::operator<= ( const Percent rhs) const
inline

Operator "comparator <= for two percentages".

Definition at line 92 of file ATMPercent.h.

References get(), and valueIS_.

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

Operator "equal to a Percent".

Definition at line 64 of file ATMPercent.h.

References valueIS_.

Percent& Percent::operator= ( double  rhs)
inline

Operator "equal to a double converted to Percent in %".

Definition at line 66 of file ATMPercent.h.

References valueIS_.

bool Percent::operator== ( const Percent rhs) const
inline

Operator "comparator == for two percentages".

Definition at line 96 of file ATMPercent.h.

References get(), and valueIS_.

bool Percent::operator> ( const Percent rhs) const
inline

Operator "comparator > for two percentages".

Definition at line 90 of file ATMPercent.h.

References get(), and valueIS_.

bool Percent::operator>= ( const Percent rhs) const
inline

Operator "comparator >= for two percentages".

Definition at line 94 of file ATMPercent.h.

References get(), and valueIS_.

Member Data Documentation

double Percent::valueIS_
private

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