Isomet Modular Synthesiser (iMS) API  v1.4.2
iMS API
Public Member Functions | Static Public Member Functions | List of all members
iMS::Percent Class Reference

Type Definition for all operations that require a percentage specification. More...

#include <include/IMSTypeDefs.h>

Public Member Functions

 Percent ()
 Default Constructor assigns 0.0%. More...
 
 Percent (double arg)
 Construct a Percent object from a double argument and check its value is within the range 0.0 <= arg <= 100.0. If not, the object is still constructed, but the value is clipped to the upper or lower bound. More...
 
Percentoperator= (double arg)
 Assignment of a double argument in percent to an existing Percent object. More...
 
 operator double () const
 Return a double representing the Percent object's value. More...
 

Static Public Member Functions

static unsigned int RenderAsImagePoint (const IMSSystem &, const Percent)
 Used internally by the library to convert a Percent object into a hardware-dependent integer representation used by the Image for RF Output amplitude. More...
 
static unsigned int RenderAsCompensationPoint (const IMSSystem &, const Percent)
 Used internally by the library to convert a Percent object into a hardware-dependent integer representation used by the Compensation Table for Compensation amplitude. More...
 
static unsigned int RenderAsCalibrationTone (const IMSSystem &, const Percent)
 Used internally by the library to convert a Percent object into a hardware-dependent integer representation used by the Calibration Tone for Single Tone amplitude. More...
 

Detailed Description

Type Definition for all operations that require a percentage specification.

Internally, the Percent value is stored as a double precision variable and is bounds-limited to 0.0 <= Percent <= 100.0.

Author
Dave Cowan
Date
2015-11-03
Since
1.0

Constructor & Destructor Documentation

iMS::Percent::Percent ( )
inline

Default Constructor assigns 0.0%.

Since
1.1
iMS::Percent::Percent ( double  arg)
inline

Construct a Percent object from a double argument and check its value is within the range 0.0 <= arg <= 100.0. If not, the object is still constructed, but the value is clipped to the upper or lower bound.

Parameters
[in]argThe percentage value
Since
1.0

Member Function Documentation

iMS::Percent::operator double ( ) const
inline

Return a double representing the Percent object's value.

Since
1.0
Percent& iMS::Percent::operator= ( double  arg)
inline

Assignment of a double argument in percent to an existing Percent object.

The double argument of the assigner must be within the range 0.0 <= arg <= 100.0 else it will be limited to those bounds.

// In a group of 7 children, 3 of them have dark hair
Percent ChildrenWithDarkHair = (3.0 / 7.0) * 100.0;
std::cout << ChildrenWithDarkHair << "% of the group have dark hair" << std::endl;

prints:

42.8571% of the group have dark hair
Since
1.0
static unsigned int iMS::Percent::RenderAsCalibrationTone ( const IMSSystem ,
const Percent   
)
static

Used internally by the library to convert a Percent object into a hardware-dependent integer representation used by the Calibration Tone for Single Tone amplitude.

Not intended for use in application code

Since
1.1.0
static unsigned int iMS::Percent::RenderAsCompensationPoint ( const IMSSystem ,
const Percent   
)
static

Used internally by the library to convert a Percent object into a hardware-dependent integer representation used by the Compensation Table for Compensation amplitude.

Not intended for use in application code

static unsigned int iMS::Percent::RenderAsImagePoint ( const IMSSystem ,
const Percent   
)
static

Used internally by the library to convert a Percent object into a hardware-dependent integer representation used by the Image for RF Output amplitude.

Not intended for use in application code


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