Had a bit of spare time so tried out the policy design pattern I've been learning about, applying it to PQ converters.

Some interesting results:
* Minor simplification of PQ converters and unit ctors; may not seem like much, but I think it enables possible future simplifications of a similar kind.
* CMeasurementPrefix is gone, no longer needed. Now prefixes are applied at the template stage.
* Apart from that, PQs public API is unchanged.
* Discovered that ft/s^2 conversion factor was wrong: fixed.
This commit is contained in:
Mathew Sutcliffe
2013-09-15 22:01:11 +01:00
parent 00473e6f5f
commit e12d7fbd7a
5 changed files with 211 additions and 661 deletions

View File

@@ -15,15 +15,9 @@ namespace BlackMiscTest
*/
int CSamplesPhysicalQuantities::samples()
{
// cases which must not work
// CMeasurementUnit mu; //must not work
// CLengthUnit du1(CAngleUnit::rad());
CMeasurementPrefix pf1 = CMeasurementPrefix::h();
CMeasurementPrefix pf2 = CMeasurementPrefix::M();
qDebug() << pf1 << pf2 << (1.0 * pf1.toDouble());
CLengthUnit lu1(CLengthUnit::cm());
CLengthUnit lu2(CLengthUnit::ft());
QString lu1s = lu1.toQString(true);