Overview

RoseUnitSet class holds a collection of RoseUnit settings, one for each RoseMeasureType. This class can be passed to functions that use or convert between more than one kind of value. The class has a get and put function along with wrappers for each type of quantity.

It is defined in the rose_unit.h header file.

RoseUnitSet Constructor

RoseUnitSet();

The RoseUnitSet() default constructor initializes all of the unit values to roseunit_as_is.

get_unit() and Wrappers

RoseUnit get_unit (RoseMeasureType vt);

RoseUnit accel_unit();
RoseUnit angle_unit();
RoseUnit ang_accel_unit();
RoseUnit ang_speed_unit();
RoseUnit area_unit();
RoseUnit force_unit();
RoseUnit length_unit();
RoseUnit mass_unit();
RoseUnit power_unit();
RoseUnit pressure_unit();
RoseUnit solid_angle_unit();
RoseUnit speed_unit();
RoseUnit temp_unit();
RoseUnit time_unit();
RoseUnit torque_unit();
RoseUnit volume_unit();

The get_unit() function sets the unit for a given measure type. For clarity and convenience, there are <qty>_unit() wrapper functions for each of the different types of quantities. No units are needed for count, parameter, ratio, revolution, or tooth values.

RoseUnitSet uts;

// AS-IS by default, but we can also call this
uts.put_as_is_units();

// set some of the defaults to english units 
uts.length_unit   (roseunit_in);
uts.angle_unit    (roseunit_deg);
uts.time_unit     (roseunit_sec);
uts.area_unit     (roseunit_in2);
uts.volume_unit   (roseunit_in3);


// set some of the defaults to millimeter units 
uts.length_unit   (roseunit_mm);
uts.angle_unit    (roseunit_deg);
uts.time_unit     (roseunit_sec);
uts.area_unit     (roseunit_mm2);
uts.volume_unit   (roseunit_mm3);

put_as_is_units()

void put_as_is_units();

The put_as_is_units() function sets all of the unit values in the set to roseunit_as_is.

put_inch_units()

void put_inch_units();

The put_inch_units() function sets the length unit to inches, angle unit to degrees and all other unit values to inch-related units as listed below:

put_millimeter_units()

void put_millimeter_units();

The put_millimeter_units() function sets the length unit to millimeteres, angle unit to degrees and all other unit values to millimeter-related units as listed below:

put_unit() and Wrappers

void put_unit (RoseMeasureType vt, RoseUnit u);

void accel_unit (RoseUnit u);
void angle_unit (RoseUnit u);
void ang_accel_unit (RoseUnit u);
void ang_speed_unit (RoseUnit u);
void area_unit (RoseUnit u);
void force_unit (RoseUnit u);
void length_unit (RoseUnit u);
void mass_unit (RoseUnit u);
void power_unit (RoseUnit u);
void pressure_unit (RoseUnit u);
void solid_angle_unit (RoseUnit u);
void speed_unit (RoseUnit u);
void temp_unit (RoseUnit u);
void time_unit (RoseUnit u);
void torque_unit (RoseUnit u);
void volume_unit (RoseUnit u);

The put_unit() function sets the unit for a given value type. For clarity and convenience, the class defines <qty>_unit() wrapper functions for each of the different types of quantities. No units are needed for count, parameter, ratio, revolution, or tooth values.